> ## Documentation Index
> Fetch the complete documentation index at: https://docs.decimal.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# AutoGen / AG2

> Auto-instrument AutoGen and AG2 agent conversations via OpenTelemetry.

The AutoGen integration works with both classic AutoGen and AG2 (the community fork). Like CrewAI, it routes through OpenTelemetry.

## Install

```bash theme={null}
pip install decimalai
```

Install AutoGen separately if you don't already have it.

## Use

```python theme={null}
import decimalai
decimalai.init(api_key="dai_sk_...", autogen=True)

# Agent conversations and tool usage are traced
chat_result = user_proxy.initiate_chat(assistant, message="Hello")
```

## What gets captured

* Each turn of the agent conversation
* Tool invocations and their results
* LLM calls behind each agent's reasoning
* Group chat coordination spans

## Caveats

* AutoGen's conversation model is turn-based, not tree-based. DecimalAI flattens turns into a sequential trace; if you want a tree view, use the explicit `@decimalai.trace` decorator on your top-level orchestrator function.
* Manifest detection captures tool **names** only.

## What's next

<CardGroup cols={2}>
  <Card title="Tracing guide" icon="route" href="/guides/tracing">
    Manual `@trace` decorator if you want tree-shaped traces.
  </Card>

  <Card title="Multi-agent guide" icon="users" href="/guides/multi-agent">
    Modeling group chats and orchestrator patterns.
  </Card>
</CardGroup>
