> ## 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.

# The Context Company

> Demonstrates instrumenting an Agno agent with The Context Company.

```python the_context_company.py theme={null}
"""
The Context Company
===================

Demonstrates instrumenting an Agno agent with The Context Company.

Setup:
    pip install "contextcompany[agno]>=1.9.1" agno openai yfinance

Set TCC_API_KEY and OPENAI_API_KEY before running this example.
See https://docs.thecontextcompany.com/frameworks/agno for the complete setup guide.
"""

import asyncio

from contextcompany.agno import instrument_agno

# ---------------------------------------------------------------------------
# Setup
# ---------------------------------------------------------------------------
# Initialize instrumentation before importing Agno.
instrument_agno()

from agno.agent import Agent  # noqa: E402
from agno.models.openai import OpenAIChat  # noqa: E402
from agno.tools.yfinance import YFinanceTools  # noqa: E402

# ---------------------------------------------------------------------------
# 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
# ---------------------------------------------------------------------------
async def main() -> None:
    await agent.aprint_response(
        "What is the current price of Tesla? Then find the current price of NVIDIA.",
        stream=True,
    )


if __name__ == "__main__":
    asyncio.run(main())
```

## Run the Example

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

  <Step title="Install dependencies">
    ```bash theme={null}
    uv pip install -U "contextcompany[agno]>=1.9.1" agno openai yfinance
    ```
  </Step>

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

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

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

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

Full source: [cookbook/observability/the\_context\_company.py](https://github.com/agno-agi/agno/blob/main/cookbook/observability/the_context_company.py)
