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

# LangWatch Integration

> Register the OpenInference AgnoInstrumentor through langwatch.setup() so a YFinance stock-price agent reports spans to LangWatch.

Demonstrates instrumenting an Agno agent and sending traces to LangWatch.

```python langwatch_op.py theme={null}
"""
LangWatch Integration
=====================

Demonstrates instrumenting an Agno agent and sending traces to LangWatch.
"""

import langwatch
from agno.agent import Agent
from agno.models.openai import OpenAIChat
from agno.tools.yfinance import YFinanceTools
from openinference.instrumentation.agno import AgnoInstrumentor

# ---------------------------------------------------------------------------
# Setup
# ---------------------------------------------------------------------------
# Initialize LangWatch and instrument Agno
langwatch.setup(instrumentors=[AgnoInstrumentor()])


# ---------------------------------------------------------------------------
# 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.",
)


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

## Run the Example

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

**1. Install dependencies**

```bash theme={null}
uv pip install -U agno langwatch openai openinference-instrumentation-agno yfinance
```

**2. Export your API keys**

```bash Mac/Linux theme={null}
export LANGWATCH_API_KEY="your_langwatch_api_key_here"
export OPENAI_API_KEY="your_openai_api_key_here"
```

```bash Windows theme={null}
$Env:LANGWATCH_API_KEY="your_langwatch_api_key_here"
$Env:OPENAI_API_KEY="your_openai_api_key_here"
```

**3. Run the example**

Save the code above as `langwatch_op.py`, then run:

```bash theme={null}
python langwatch_op.py
```

Full source: [cookbook/observability/langwatch\_op.py](https://github.com/agno-agi/agno/blob/v3.0.4/cookbook/observability/langwatch_op.py)


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.