> ## Documentation Index
> Fetch the complete documentation index at: https://docs.agno.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Arize Phoenix Local Via OpenInference

> Send stock-agent traces to a self-hosted Phoenix collector at localhost:6006 under a named project.

Demonstrates instrumenting an Agno agent and sending traces to a local Phoenix instance.

```python arize_phoenix_via_openinference_local.py theme={null}
"""
Arize Phoenix Local Via OpenInference
=====================================

Demonstrates instrumenting an Agno agent and sending traces to a local Phoenix instance.
"""

import os

from agno.agent import Agent
from agno.models.openai import OpenAIChat
from agno.tools.yfinance import YFinanceTools
from phoenix.otel import register

# ---------------------------------------------------------------------------
# Setup
# ---------------------------------------------------------------------------
os.environ["PHOENIX_COLLECTOR_ENDPOINT"] = "http://localhost:6006"

# Configure the Phoenix tracer
tracer_provider = register(
    project_name="agno-stock-price-agent",  # Default is 'default'
    auto_instrument=True,  # Automatically use the installed OpenInference instrumentation
)


# ---------------------------------------------------------------------------
# Create Agent
# ---------------------------------------------------------------------------
agent = Agent(
    name="Stock Price Agent",
    model=OpenAIChat(id="gpt-5.2"),
    tools=[YFinanceTools()],
    instructions="You are a stock price agent. Answer questions in the style of a stock analyst.",
    debug_mode=True,
)


# ---------------------------------------------------------------------------
# Run Example
# ---------------------------------------------------------------------------
if __name__ == "__main__":
    agent.print_response("What is the current price of Tesla?")
```

## Run the Example

<Steps>
  <Snippet file="create-venv-step.mdx" />

  <Step title="Install dependencies">
    ```bash theme={null}
    uv pip install -U agno arize-phoenix openai openinference-instrumentation-agno yfinance
    ```
  </Step>

  <Step title="Export your OpenAI API key">
    <CodeGroup>
      ```bash Mac/Linux theme={null}
      export OPENAI_API_KEY="your_openai_api_key_here"
      ```

      ```bash Windows theme={null}
      $Env:OPENAI_API_KEY="your_openai_api_key_here"
      ```
    </CodeGroup>
  </Step>

  <Step title="Start Phoenix">
    Start the local Phoenix receiver on port 6006:

    ```bash theme={null}
    python -m phoenix.server.main serve
    ```
  </Step>

  <Step title="Run the example">
    Save the code above as `arize_phoenix_via_openinference_local.py`, then run:

    ```bash theme={null}
    python arize_phoenix_via_openinference_local.py
    ```
  </Step>
</Steps>

Full source: [cookbook/observability/arize\_phoenix\_via\_openinference\_local.py](https://github.com/agno-agi/agno/blob/main/cookbook/observability/arize_phoenix_via_openinference_local.py)
