Skip to main content
AutoGen is a Microsoft framework for building multi-agent conversational systems. Braintrust traces individual agents, multi-agent teams, and their tool calls. The integration works with any model provider AutoGen supports. LLM call tracing inside the agent run comes from the provider’s own Braintrust integration.

Setup

Install the Braintrust SDK and AutoGen with the OpenAI extension (used in the examples below), then set your Braintrust and OpenAI API keys.
1

Install packages

2

Set environment variables

.env

Auto-instrumentation

To trace AutoGen alongside Braintrust’s other supported libraries, call braintrust.auto_instrument() before creating AutoGen agents or teams.
To trace AutoGen without auto-instrumenting other libraries, use setup_autogen() instead of braintrust.auto_instrument().
Already running AutoGen with OpenTelemetry? Keep that setup and route spans to Braintrust using the Braintrust OpenTelemetry guide.

What Braintrust traces

Braintrust patches AutoGen’s chat agent, team, and FunctionTool entry points (autogen-agentchat>=0.7.0). Captured spans:
  • Agent run spans (<agent>.run and <agent>.run_stream), with task input, agent metadata (name, description, class), output, and errors. Emitted for both direct agent calls and agents running inside a team (such as RoundRobinGroupChat).
  • Team run spans (<team>.run and <team>.run_stream), with task input, team metadata (name, description, class, participant names), output, and errors.
  • Tool call spans (<tool>.run) for FunctionTool invocations, with arguments, tool metadata (name, description, class), output, and errors.
  • Streaming events aggregated into the parent span’s output, not emitted as per-chunk child spans.
  • Parent-child nesting: agent spans nest under any enclosing team span, and LLM and tool call spans nest under the agent that issued them. With auto_instrument(), provider LLM calls inherit this nesting automatically.

Resources