Skip to main content
Targets the modern autogen-agentchat / autogen-core architecture (the actively maintained v0.4+ rewrite) - not the older pyautogen / ag2 fork. Install the integration extra:

observer.run()

Wraps an AssistantAgent or Team’s .run(task=...) call. Since AutoGen’s own API is async-native, observer.run() is async too - await it the same way you’d await agent.run(...).
Works the same way for a Team:

What gets traced

Each .run() call produces one trace.
Per-step timing is derived from each message’s real created_at timestamp, chained against the previous message’s timestamp. AutoGen’s message schema has no explicit start/end pair per LLM call, so this is real but approximate - the same caveat CrewAI’s per-task timing has.
observer.run() covers .run() only, not .run_stream() - a deliberate scope boundary, the same as this SDK’s OpenAI and Google Gen AI streaming coverage.

AgentXAutoGenObserver reference

observer.run() parameters

Any additional keyword arguments are passed straight through to agent_or_team.run(...).
Call tracer.flush() before your process exits in scripts or one-shot jobs. In long-running servers it is not required: traces drain automatically in the background.