Skip to main content
Automatically capture agent loops, message histories, and tool executions within the AutoGen framework.

Install

Set up

This integration instruments AG2, the community-maintained continuation that provides the autogen 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).

Usage

Once initialized, agent conversations and tool calls are captured automatically:

Verify

Run your code and confirm the trace arrives:
  1. 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.
  2. Via the CLI: Run traceroot traces list to inspect your recent traces from the terminal.

What gets captured

Limitations

  • AutoGen (AG2) requires initializing both Integration.AUTOGEN and your underlying LLM provider integration (such as Integration.GOOGLE_GENAI or Integration.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.