Skip to Content
Rius

How do I name my agent in Rius when it uses the Anthropic API?

Rius names your agent from the service_name you pass to init() (or RIUS_SERVICE_NAME), and the Anthropic calls your code makes are traced under that name. Set it once, keep it constant across replicas and deploys, and your agent appears under that name in trace filters, cost breakdowns and the Agents page. Put the build in service_version and the prompt and tool version in main_agent_version, so the name never has to change when you ship.

How it works

The name you set becomes the service.name resource attribute, which the SDK stamps on every span it exports. Each messages.create call that the Anthropic integration traces is one of those spans, so it carries your agent’s name along with the model, token counts and computed cost.

There are two name settings:

  • service_name (RIUS_SERVICE_NAME) is the name you use to find the agent in trace filters, analytics and cost breakdowns. It defaults to unknown_service, 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 together form one logical agent.

The version goes in its own setting, never in the name:

  • service_version (RIUS_SERVICE_VERSION) is the build or release this process runs, stamped as service.version.
  • main_agent_version (RIUS_MAIN_AGENT_VERSION) is the version of the agent definition, meaning its prompt, tools and policy, stamped as rius.main_agent.version. It moves independently of the build.

On the Agents page, Rius picks the agent name from the first of these that is set: gen_ai.main_agent.name on the resource, rius.main_agent.name on the resource, gen_ai.agent.name on the resource, gen_ai.agent.name on the span, then service.name. The SDK sets the main-agent keys for you from your agent name, so you rarely touch them.

A new process start is a fresh instance under the same name, so three replicas show as three instances of one agent.

Set it up

  1. Install the SDK with the Anthropic extra. The extra installs the instrumentation, not anthropic itself. The full install and init() reference is in Installation and configuration.
pip install "glassflow-rius[anthropic]" anthropic
  1. Pass the name and both versions to init(). Replace the values with your own.
import rius from anthropic import Anthropic rius.init( api_key="ri_...", service_name="support-agent", service_version="2026.09.29-a41f3c", main_agent_version="prompt-v12", ) client = Anthropic() # use the client exactly as before
  1. In TypeScript, the same settings are camelCase options.
import { init } from '@glassflow-ai/rius' import Anthropic from '@anthropic-ai/sdk' const rius = init({ apiKey: 'ri_...', serviceName: 'support-agent', serviceVersion: '2026.09.29-a41f3c', mainAgentVersion: 'prompt-v12', }) await rius.ready // integrations attach asynchronously const client = new Anthropic()
  1. Or set them in the environment, which the SDK reads when an argument is not passed. An explicit argument wins over an environment variable.
export RIUS_SERVICE_NAME=support-agent export RIUS_SERVICE_VERSION=2026.09.29-a41f3c export RIUS_MAIN_AGENT_VERSION=prompt-v12
  1. Add agent_name (agentName in TypeScript) only if the Agents page should group under a different name than the service name.

  2. Run one call, then open Agents. Your agent shows an instance as running or ready, and stopped after the process exits. In TypeScript, await rius.shutdown() before a short script exits, because the TypeScript SDK does not export queued spans on exit.

For the Anthropic-specific part, see the Anthropic integration. With a global init(), the integration turns on by itself when its package is installed. All integrations are listed under Integrations.

What you get

  • One name everywhere you search. The service name is how you find the agent in trace filters, analytics and cost breakdowns, so Anthropic spend is attributed to a name you chose.
  • An agent row on the Agents page. You don’t register anything. Rius finds the agent from your traces and heartbeats, lists its instances and lets you search by agent name.
  • Version comparison. With main_agent_version set, Versions and Drift show whether a new prompt or model changed failed rate, cost per trace, latency or tokens per trace. Rius warns when either side has fewer than 20 traces.
  • A stable identity. Each process start is a new instance, not a new agent, because the name stays constant.

Renaming has a cost. Stored spans keep the old service.name and stay filterable under it, while the new name starts empty. The old name’s instances report gone until their heartbeat records age out. Without main_agent_id, gen_ai.main_agent.id falls back to the agent name, so a rename changes it too. Treat the name as an identifier, not a label, and set main_agent_id (RIUS_MAIN_AGENT_ID) to a stable id if you want an identity that survives a rename.

When something else fits

  • If several services together form one agent, give each its own service_name and share one agent_name, so the Agents page groups them under that agent.
  • If you send traces from a plain OpenTelemetry SDK instead of the Rius SDK, set gen_ai.main_agent.id and gen_ai.main_agent.name as resource attributes. Heartbeats need the Rius SDK, so Instances stays empty.
  • If your agent has no version yet, the Agents page tells you which variable to set, and you can add it later without renaming anything.

Still stuck? Get help

Last updated on