Install
- Python
Set up
This integration instruments AG2, the community-maintained continuation that provides theautogen package. Microsoft’s newer autogen-agentchat package uses a different API and is not currently supported by this integration.
To capture the complete picture—including both the agent orchestrations and the underlying token costs—we highly recommend initializing both the AG2 integration and your specific LLM provider (e.g., Google GenAI, OpenAI, Anthropic).
- Python
Usage
Once initialized, agent conversations and tool calls are captured automatically:Verify
Run your code and confirm the trace arrives:- In the TraceRoot UI: Navigate to Tracing > Traces in TraceRoot Cloud. You should see a trace with root span
user_proxy.initiate_chat, named after the agent that opened the chat. - Via the CLI: Run
traceroot traces listto inspect your recent traces from the terminal.
What gets captured
Limitations
- AutoGen (AG2) requires initializing both
Integration.AUTOGENand your underlying LLM provider integration (such asIntegration.GOOGLE_GENAIorIntegration.OPENAI) to capture full token usage and pricing.
Run the example
Clone the repo and run a complete agent end-to-end.Python
Run the Python example
Next steps
Python SDK Reference
Explore the full Python SDK reference and instrumentation options.
Cost Tracking
Learn how TraceRoot calculates token costs and tracks model spend.

