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

# Weave Integration

> Wrap an Agno agent run in a @weave.op() decorator to log calls to a Weave project.

Demonstrates logging Agno model calls with Weave.

```python weave_op.py theme={null}
"""
Weave Integration
=================

Demonstrates logging Agno model calls with Weave.
"""

import weave
from agno.agent import Agent
from agno.models.openai import OpenAIChat

# ---------------------------------------------------------------------------
# Setup
# ---------------------------------------------------------------------------
weave.init("agno")


# ---------------------------------------------------------------------------
# Create Agent
# ---------------------------------------------------------------------------
agent = Agent(model=OpenAIChat(id="gpt-4o"), markdown=True)


@weave.op()
def run(content: str):
    return agent.run(content)


# ---------------------------------------------------------------------------
# Run Example
# ---------------------------------------------------------------------------
if __name__ == "__main__":
    run("Share a 2 sentence horror story")
```

## Run the Example

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

  <Step title="Install dependencies">
    ```bash theme={null}
    uv pip install -U agno openai weave
    ```
  </Step>

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

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

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

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

Full source: [cookbook/observability/weave\_op.py](https://github.com/agno-agi/agno/blob/v2.7.4/cookbook/observability/weave_op.py)
