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.
"""
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-5.6-luna"), 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
Set up your virtual environment
uv venv --python 3.12
source .venv/bin/activateInstall dependencies
uv pip install -U agno openai weaveExport your API keys
export OPENAI_API_KEY="your_openai_api_key_here"
export WANDB_API_KEY="your_wandb_api_key_here"Run the example
Save the code above as weave_op.py, then run:
python weave_op.pyFull source: cookbook/observability/weave_op.py