How do I name my agent in Rius when it uses the OpenAI API?
Rius names your agent from the service name you pass to init, so set it once and every OpenAI call is traced under that name. Set agent_name only if several services form one logical agent, and put versions in their own settings, not in the name. The name then shows on the Agents page, in trace filters, in analytics and in cost breakdowns.
How it works
Rius resolves the agent name from the first of these that is set:
gen_ai.main_agent.nameon the resourcerius.main_agent.nameon the resourcegen_ai.agent.nameon the resourcegen_ai.agent.nameon the span- the service name (
service.name)
The Rius SDK sets the main-agent keys for you, so in practice you set two options:
service_name(RIUS_SERVICE_NAME) is theservice.namestamped on every span. It defaults tounknown_service, which Rius does not accept as an agent name, so always set it.agent_name(RIUS_AGENT_NAME) controls how instances group on the Agents page. It defaults to the service name. Set it separately only when several services form one logical agent.
OpenAI calls need no separate naming. The instrumentation traces every client call in the process, and each span carries the resource attributes of your init() call. See the OpenAI integration for what each call records.
Keep the name constant across replicas and deploys. Each process start is a new instance under the same name, so three replicas show as three instances of one agent. Keep version numbers out of the name:
service_version(RIUS_SERVICE_VERSION) is the build or release, stamped asservice.version.main_agent_version(RIUS_MAIN_AGENT_VERSION) is the version of the agent definition (prompt, tools, policy), stamped asrius.main_agent.version. The SDK never derives one version from the other.
Set it up
- Install the OpenAI instrumentation. The extra installs the instrumentation, not
openaiitself. The Installation and configuration page covers the TypeScript package and every other option.
pip install "glassflow-rius[openai]" openai- Call
init()once, before you create the OpenAI client, with the name and the two versions:
import rius
from openai import OpenAI
rius.init(
api_key="ri_...",
service_name="support-agent",
agent_name="support-agent",
service_version="2026.09.29-a41f3c",
main_agent_version="prompt-v12",
)
client = OpenAI() # use the client exactly as before- In TypeScript the options are camelCase:
import { init } from '@glassflow-ai/rius'
import OpenAI from 'openai'
const rius = init({
apiKey: 'ri_...',
serviceName: 'support-agent',
agentName: 'support-agent',
serviceVersion: '2026.09.29-a41f3c',
mainAgentVersion: 'prompt-v12',
})
const client = new OpenAI()- Or set the same values in the environment, which an explicit argument overrides:
export RIUS_SERVICE_NAME=support-agent
export RIUS_AGENT_NAME=support-agent
export RIUS_SERVICE_VERSION=2026.09.29-a41f3c
export RIUS_MAIN_AGENT_VERSION=prompt-v12-
Run one OpenAI call, open Agents in the console and check that
support-agenthas an instance inrunningorready. Heartbeats need credentials, so an API key must be set. -
Decide on a stable id. Without
main_agent_id(RIUS_MAIN_AGENT_ID),gen_ai.main_agent.idfalls back to the agent name, so renaming the agent also changes that id. Setmain_agent_idif you want an identity that survives a rename.
What you get
- Your agent appears on the Agents page under the name you chose. You can search the list by agent name and open a row for instances, traces, errors, time to first token and cost.
service.nameis how you find the agent in trace filters, analytics and cost breakdowns, so OpenAI cost per agent follows the same name.- With
RIUS_MAIN_AGENT_VERSIONorRIUS_SERVICE_VERSIONset, Versions lists the versions that ran, and Compare sets two side by side on traces, failed rate, cost per trace, latency, time to first token and tokens per trace. The comparison warns when either side has fewer than 20 traces. - The build version in
RIUS_SERVICE_VERSIONis available as a second view next to the agent version when traces carry both. - Replicas of the same agent stay grouped as instances under one name.
Treat the name as an identifier, not a label. Renaming does not re-key history: stored spans keep the old service.name and stay filterable under it, the new name starts empty, and the old name’s instances report gone until their heartbeat records age out.
For the other integrations and how they attach, see Integrations.
When something else fits
- If several services together make up one logical agent, give each its own
service_nameand share oneagent_nameso they group together on the Agents page. - If you send traces with a plain OpenTelemetry SDK instead of the Rius SDK, set
gen_ai.main_agent.idandgen_ai.main_agent.nameas resource attributes. Heartbeats need the Rius SDK, so the Instances section stays empty.