Integrating Agno with Traceloop
Traceloop provides an LLM observability platform built on OpenLLMetry, an open-source OpenTelemetry extension. By integrating Agno with Traceloop, you can automatically trace agent execution, team workflows, tool calls, and token usage metrics.Prerequisites
-
Install Dependencies
Ensure you have the necessary packages installed:
-
Setup Traceloop Account
- Sign up for an account at Traceloop.
- Obtain your API key from Settings > API Keys.
-
Set Environment Variables
Configure your environment with the Traceloop API key:
Sending Traces to Traceloop
Example: Basic Agent Instrumentation
Initialize Traceloop at the start of your application. The SDK automatically instruments Agno agent execution.Example: Development Mode (Disable Batching)
For local development, disable batching to see traces immediately:Example: Multi-Agent Team Tracing
Team execution is automatically traced, showing the coordination between multiple agents:Example: Using Workflow Decorators
Use the@workflow decorator to create custom spans for organizing your traces:
Example: Async Agent with Tools
Async agent execution is fully supported with automatic tool call tracing:Notes
- Initialization: Call
Traceloop.init()before creating any agents to ensure proper instrumentation. - Development Mode: Use
disable_batch=Trueduring development for immediate trace visibility. - Async Support: Both sync (
run()) and async (arun()) methods are fully instrumented. - Privacy Control: Set
TRACELOOP_TRACE_CONTENT=falseto disable logging of prompts and completions.