How do I name my agent in Rius when it uses AutoGen?
Rius takes your AutoGen agent’s name from service_name in rius.init(), and agent_name overrides it only when several services form one logical agent. Set the version next to the name with service_version and main_agent_version, not inside the name. The name then shows on the Agents page, in trace filters, in analytics and in cost breakdowns.
How it works
Three settings decide how your AutoGen agent appears in Rius.
- service_name (or
RIUS_SERVICE_NAME) sets theservice.nameresource attribute on every span. It is how you find your agent in trace filters, analytics and cost breakdowns. It defaults tounknown_service, and an agent that sends only that placeholder does not appear on the Agents page, so always set it. - agent_name (or
RIUS_AGENT_NAME) controls how instances group on the Agents page. It defaults to the service name. Set it separately only when several services together form one logical agent. - Versions go in their own settings.
service_version(orRIUS_SERVICE_VERSION) is the build or release.main_agent_version(orRIUS_MAIN_AGENT_VERSION) is the version of the agent definition: its prompt, tools and policy. The two move independently, so keep version numbers out of the name.
The SDK stamps the name on the resource as gen_ai.main_agent.name, gen_ai.agent.name and the older rius.main_agent.name. Rius names an agent from the first of these that is set: gen_ai.main_agent.name, rius.main_agent.name, then gen_ai.agent.name on the resource, then gen_ai.agent.name on the span, then service.name. Because the SDK sets the main-agent keys from your init options, the name you pass to rius.init() is the one the Agents page uses.
The name you give an AutoGen agent in code, such as name="support_agent", is a separate label. It appears in the span names the framework emits, create_agent support_agent and invoke_agent support_agent, inside each trace.
Set it up
- Install the SDK with the OpenAI extra and AutoGen. The AutoGen integration page covers the full setup.
pip install "glassflow-rius[openai]" "autogen-agentchat" "autogen-ext[openai]"- Name the agent and its versions in
rius.init(), then wrap your entrypoint withobserve. Use a name that stays constant across replicas and deploys.
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="support-agent",
service_version="2026.09.29-a41f3c",
main_agent_version="prompt-v12",
)
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)lookup stands for your own function that fetches the account.
- Prefer environment variables for versions if your deploy pipeline already sets them. The SDK reads them when the matching argument is not passed.
export RIUS_MAIN_AGENT_VERSION=prompt-v12
export RIUS_SERVICE_VERSION=2026.09.29-a41f3c-
Leave
agent_nameout unless several services form one agent. If you do need it, addagent_name="support-agent"torius.init()or setRIUS_AGENT_NAME. -
Run one request, open Agents, and search for
support-agent. The agent has an instance inrunningorreadybecause heartbeats are on by default and your API key supplies the credentials. Open the agent and check Versions for the version you set. The Installation and configuration page lists everyinitoption, including the identity settings.
Do not wrap the AutoGen tool function with observe. The framework’s own execute_tool spans already cover tools.
What you get
- Your agent listed on the Agents page under the name you chose, searchable by name, with its instances, traces, errors, time to first token and cost.
- The same name as
service.nameon every span, so trace filters, analytics and cost breakdowns find the agent. - Three replicas of one deployment shown as three instances under one name, because each process start gets a fresh instance ID.
- Versions and Drift filled in from
RIUS_MAIN_AGENT_VERSIONorRIUS_SERVICE_VERSION. Compare puts two versions side by side on failed rate, cost per trace, latency and tokens per trace, and warns when either side has fewer than 20 traces. - Readable traces, where the framework’s
create_agent support_agentandinvoke_agent support_agentspans carry the name you gave the AutoGen agent.
Treat the name as an identifier, not a label. Renaming does not re-key history: stored spans keep the old service.name, the new name starts empty, and the old name’s instances report gone until their heartbeat records age out. Without a main_agent_id, renaming the agent also changes gen_ai.main_agent.id, so set main_agent_id if you want an identity that survives a rename.
When something else fits
- If several services together make up one AutoGen system, keep a distinct
service_namefor each and set the sameagent_nameon all of them so they group as one agent. - If you send traces with a plain OpenTelemetry SDK instead of the Rius SDK, set the resource attributes
gen_ai.main_agent.idandgen_ai.main_agent.nameyourself. Everything on the Agents page works except Instances and Lifecycle events, which need the Rius SDK heartbeat. - For the other frameworks and libraries Rius traces, see Integrations.