Copy
Ask AI
"""
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, debug_mode=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
Copy
Ask AI
# Clone and setup repo
git clone https://github.com/agno-agi/agno.git
cd agno/cookbook/92_integrations/observability
# Create and activate virtual environment
./scripts/demo_setup.sh
source .venvs/demo/bin/activate
python weave_op.py