Prerequisites
-
Install the required dependencies:
-
Set your OpenAI API key (or other model provider) as an environment variable:
- Configure OTEL tracing in Weave.
Configure OTEL tracing in Weave
To send traces from Agno to Weave, configure OTEL with aTracerProvider and an OTLPSpanExporter. Set the exporter to the correct endpoint and HTTP headers for authentication and project identification.
Store sensitive environment variables like your API key and project info in an environment file (for example,
.env), and load them using os.environ. This keeps your credentials secure and out of your codebase.Required configuration
Configure the OTLP exporter with the following endpoint and headers:- Endpoint:
https://trace.wandb.ai/otel/v1/traces - Headers:
Authorization: Basic auth using your W&B API key.project_id: Your W&B entity/project name (for example,myteam/myproject).
Send OTEL traces from Agno to Weave
After you complete the prerequisites, you can send OTEL traces from Agno to Weave. The following code snippet demonstrates how to configure an OTLP span exporter and tracer provider to send OTEL traces from an Agno application to Weave.Trace Agno agents with OTEL
After you set up the tracer provider, you can create and run Agno agents with automatic tracing. Instrument Agno before you create agents to ensure that Weave captures all subsequent agent activity. The following example demonstrates how to create an agent with tools:
Trace Agno tools with OTEL
When you define and use tools with Agno, the trace also captures these tool calls. The OTEL integration automatically instruments both the agent’s reasoning process and the individual tool executions, which provides a comprehensive view of your agent’s behavior. Here’s an example with multiple tools:
Trace multi-agent teams with OTEL
Agno’s multi-agent architecture lets you create teams of agents that collaborate and share context. Weave also traces these team interactions in full:
Work with reasoning agents
Agno provides built-in reasoning capabilities that help agents process problems step-by-step. Traces also capture these reasoning processes:
Work with memory and knowledge
Agno agents can maintain memory and access knowledge bases, which lets agents persist context across interactions. Weave also traces these operations: