How do I see every tool call in an agent built with AutoGen?
Rius shows every tool call in an AutoGen agent as an execute_tool span, which the framework emits itself, so you add no wrapper around your tools. You add one observe wrapper on the entrypoint so each unit of work becomes one trace. Open the trace in the console to read each tool call inside its agent run, or search the Spans tab for execute_tool to list them all.
How it works
AutoGen (AgentChat, Python) emits its own OpenTelemetry spans through the global tracer provider, which rius.init() installs. Rius records these on its own:
- Agent construction: a
create_agentspan named after the agent. - Agent runs: an
invoke_agentspan named after the agent. - Tool calls: an
execute_toolspan named after the tool, one for each call. - Model calls: a
ChatCompletiongeneration with model, tokens and cost, captured by theopenaiintegration because AutoGen’s model client goes through the OpenAI client.
What you add yourself is one observe wrapper on the function that starts the work. It becomes the root span of the trace and groups agent creation and invocation under it.
Do not wrap your AutoGen tool functions with observe. AutoGen executes tools in a detached context, so the wrapper’s span cannot find the run and splits off as its own single-span trace. The framework’s execute_tool spans already cover every tool call.
There is no AutoGen integration for TypeScript today. This guide covers the Python framework. For the full list of supported frameworks, see Integrations.
Set it up
- Install the SDK with the
openaiextra, plus AutoGen. The extra installs the instrumentation, not the OpenAI library itself.
pip install "glassflow-rius[openai]" "autogen-agentchat" "autogen-ext[openai]"- Call
rius.init()once, then wrap your entrypoint withobserveand the agent span kind. Pass your tool as a plain function intools, with no decorator of your own. Herelookupstands for your own code.
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)-
Run one request that makes the agent call a tool. The AutoGen integration page has the full recipe and the runnable example behind it.
-
Open Traces in the console and select the trace. Check that the root span, the
invoke_agentspan, theexecute_toolspan and theChatCompletiongeneration are all there. See Exploring traces for the views. -
To scope a whole conversation, wrap each run in
rius.session()and reuse your conversation id, so one conversation reads as one session.
What you get
A run that calls a tool looks like this in the waterfall (a real trace from the example, autogen-agentchat 0.7.5):
handle-ticket AGENT 2.8s
├─ create_agent support_agent 0ms
└─ invoke_agent support_agent 2.8s
├─ ChatCompletion LLM 2.6s
└─ execute_tool account_status 0msWhere to look:
- Waterfall view: each tool call sits under the
invoke_agentspan that made it, next to the model call that asked for it. LLM spans show their token counts inline. Repeated calls of a tool that failed and were retried collapse into oneN attemptsrow on the trace page. Successful repeats stay separate rows. - Spans tab: this lists individual spans instead of whole traces. Its search box matches span names, so typing
execute_toolfinds the tool calls across all your traces. Use the status filter and the time range to narrow them down. - Span detail: select a tool span to read its timing and its Raw attributes. Use the previous and next buttons, or
jandk, to step through spans one at a time. - Model section: the
ChatCompletiongeneration shows model, tokens and cost. Costs are list-price estimates in US dollars.
Three quirks to know when reading these traces:
- Framework spans arrive with status UNSET rather than OK on success. The trace status still reads Ok.
- Generation spans share the generic name
ChatCompletion, so tell them apart by position in the tree. - If you wrap a tool with
observeanyway, it appears as its own one-span trace, separate from the run.
For the wider picture of watching agents after launch, see Monitor AI agents in production.
When something else fits
If your AutoGen tools are not called through the framework, for example a helper you call directly from your own code, the framework emits no execute_tool span for it. Use the tracing page for how to record such a function yourself. If you build agents in TypeScript, there is no AutoGen integration, so trace those calls with manual spans as described on the Integrations page.