Weave
Integrate Agno with Weave by WandB to send traces and gain insights into your agent's performance.
Integrating Agno with Weave by WandB
Weave by Weights & Biases (WandB) is a platform for logging and visualizing model calls. By integrating Agno with Weave, you can track and analyze your agent's performance and behavior.
Set OpenAI Key
Set your OPENAI_API_KEY as an environment variable. You can get one from OpenAI.
export OPENAI_API_KEY=sk-***Prerequisites
-
Install Dependencies
Ensure you have the necessary packages installed:
uv pip install agno openai weave -
Authentication Go to WandB and copy your API key
export WANDB_API_KEY="your-api-key"
Logging Model Calls with Weave
Log your Agno agent's model calls with Weave.
import weave
from agno.agent import Agent
from agno.models.openai import OpenAIResponses
# Initialize Weave with your project name
weave.init("agno")
# Create and configure the agent
agent = Agent(model=OpenAIResponses(id="gpt-5.2"), markdown=True, debug_mode=True)
# Define a function to run the agent, decorated with weave.op()
@weave.op()
def run(content: str):
return agent.run(content)
# Use the function to log a model call
run("Share a 2 sentence horror story")Notes
- Environment Variables: Ensure your environment variable is correctly set for the WandB API key.
- Initialization: Call
weave.init("project-name")to initialize Weave with your project name. - Decorators: Use
@weave.op()to decorate functions you want to log with Weave.