How do I see one whole conversation in an agent built with AutoGen?
Rius groups an AutoGen conversation by session: scope each run with rius.session() and reuse your conversation id, and every trace of that conversation lists together. The AutoGen integration records the agents, tool calls and model calls on its own. You add one wrapper on your entrypoint and the session. Open the Session link in any trace header to see every span in the conversation.
How it works
AutoGen combines two sources of data, and you do not wrap anything for either of them.
- Framework spans. AutoGen emits
create_agent,invoke_agentandexecute_toolspans on its own, andrius.init()installs the tracer provider they go through. - Model calls. Model calls go through the OpenAI client from
autogen-ext[openai], so theopenaiintegration records each one as aChatCompletiongeneration with model, tokens and cost.
Two things need your own code:
- An entrypoint wrapper. One
observewrapper with the AGENT kind on the function that handles a unit of work groups agent creation and invocation into a single trace. - A session. One conversation is one session. Scope each run with
rius.session()and reuse your conversation id, so each run is a trace and the traces of one conversation share a session. Without a session id, every trace is its own session.
Do not wrap AutoGen tool functions with observe. AutoGen runs tools in a detached context, so the wrapper cannot find the run and splits off as its own single-span trace. The execute_tool spans already cover your tools.
The AutoGen integration page has the full recipe, and the integrations overview shows how the other frameworks compare.
Set it up
- Install the SDK with the OpenAI extra, plus AutoGen. The extra installs the instrumentation, not the library, so AutoGen and its OpenAI client come from their own packages.
pip install "glassflow-rius[openai]" "autogen-agentchat" "autogen-ext[openai]"- Call
rius.init()once at startup and wrap your entrypoint withobserveand the AGENT kind. Leave the tool function unwrapped.
import rius
from autogen_agentchat.agents import AssistantAgent
from autogen_ext.models.openai import OpenAIChatCompletionClient
from rius import SpanKind
rius.init(api_key="ri_...", service_name="my-agent")
def account_status(email: str) -> str:
"""Fetch a customer's account standing by email."""
return lookup(email)
@rius.observe(name="handle-ticket", kind=SpanKind.AGENT)
async def handle_ticket(ticket: str) -> str:
agent = AssistantAgent(
name="support_agent",
model_client=OpenAIChatCompletionClient(model="gpt-5-mini"),
tools=[account_status],
system_message="Answer support questions; check accounts with the tool.",
)
result = await agent.run(task=ticket)
return str(result.messages[-1].content)- Call each run of the conversation inside
rius.session(), passing the conversation id you already keep. Use the same id for every turn. - Run a request that calls a tool, then open Traces in the console. The root span, the framework’s
invoke_agentandexecute_toolspans, and theChatCompletiongeneration with model, tokens and cost should all be there.
A run that calls a tool looks like this:
handle-ticket AGENT 2.8s
├─ create_agent support_agent 0ms
└─ invoke_agent support_agent 2.8s
├─ ChatCompletion LLM 2.6s
└─ execute_tool account_status 0msWhat you get
- The whole conversation in one list. The Session link in a trace’s header opens the Spans tab filtered to that session. You can also paste a session id into the search box on Spans to list every span in it. See Exploring traces for the filters.
- Structure per run. The waterfall shows the root AGENT span, agent creation, the agent run, each model call and each tool call, with tokens inline on the model calls.
- What each turn added. On a model call with captured messages, Since previous llm call on the Input / Output tab shows what changed since the previous model call in the trace. A dropped turn or a rewritten system prompt stands out.
- Cost and tokens per call. Each
ChatCompletiongeneration carries model, tokens and cost, as a list-price estimate in US dollars.
Three quirks to expect: framework spans arrive with an unset status on success, though the trace status still reads Ok. Generation spans are all named ChatCompletion. And a conversation of several runs is several traces, tied together by the session rather than by one tree.
For the wider picture of watching agents after launch, see Monitor AI agents in production.
When something else fits
- If a conversation should read as a single trace tree, put one
observewrapper around the whole conversation loop instead of each turn. Each turn then no longer shows as its own trace. - If your AutoGen setup does not call models through the OpenAI client, the
openaiintegration does not record those calls, so check the AutoGen integration page before relying on tokens and cost.