Skip to Content

How do I track how long sessions take in OpenHands?

Rius traces each OpenHands conversation as one trace, with a span for every agent step, model call and tool call, so you can see where a session’s time goes. You turn it on with three environment variables and no plugin. Rius also reports duration over time and lets you alert on it.

How it works

OpenHands is the one coding agent that needs no Rius plugin. Its SDK already sends OpenTelemetry, and Rius takes that in over OTLP. One OpenHands conversation, which is what OpenHands calls a session, becomes one trace in Rius:

  • The root is the conversation, with conversation.send_message and conversation.run under it.
  • Each agent.step sits under the run, with the model call and the tool call that step made.
  • Tool spans, such as TerminalAction and FileEditorAction, carry the tool that ran (terminal, file_editor, finish) with its input and output, including a terminal command and its exit code.
  • The conversation id becomes the Rius session, so a multi-turn conversation groups together.

Because every step is its own span, a slow session is easy to read. You can tell whether the time went to a model call, to a terminal command or to a long chain of steps. Rius also reports duration in its usage view next to traces, cost, tokens and error rate. That view covers ranges from 15 minutes to 30 days, or a custom range.

Tracing is off until you set the variables, and only the process that has them sends spans.

Set it up

  1. Create a Rius API key with the Send telemetry scope under Settings → API keys in the console. The OpenHands guide covers the SDK install and the web app and Enterprise variants in full.
  2. Set the three variables where the OpenHands SDK script runs:
export OTEL_EXPORTER_OTLP_TRACES_ENDPOINT=https://ingest.eu.console.rius-glassflow.com/v1/traces export OTEL_EXPORTER_OTLP_TRACES_PROTOCOL=http/protobuf export OTEL_EXPORTER_OTLP_TRACES_HEADERS="Authorization=Bearer%20ri_..."
  1. Name the agent and the developer when you create the conversation, so you can find and group sessions by who ran them. Without agent.name, Rius names the agent after the script file. Without user_id, conversations land in the anonymous row on the Users page.
conversation = Conversation( agent=agent, workspace=".", user_id="dev@example.com", observability_metadata={"agent.name": "fib-writer"}, )
  1. Start the script from its own directory, run the conversation, and open the trace list in the console. The conversation appears under its agent name within a few seconds.
  2. Open the trace. The waterfall shows the conversation, each agent step and every model and tool call inside it, so you can see which step took the time.
  3. To be told about slow sessions, create a custom alert rule on duration. Filter it by Agent so it measures whole runs and not single spans, and attach a Slack, email or webhook channel.

If the trace list stays empty, check three things. The protocol must be http/protobuf, the URL must include the full /v1/traces path, and the space after Bearer must be written as %20. Also make sure no LMNR_* variable is set, because it overrides the OTEL settings.

What you get

  • One trace per conversation, so one row in the trace list per session, with its spans laid out in the waterfall.
  • Each step, model call and tool call as its own span, so you can find the slow one inside a long session.
  • Duration reported over time in the usage view, and available as a rule in custom alerts.
  • Sessions grouped by conversation id, so a multi-turn conversation reads as one session.
  • Each developer on the Users page, from the user_id you pass, with their traces, failures and cost.
  • Model calls with tokens and cost for SDK scripts with Claude or GPT-4o. Costs are list-price estimates in US dollars.

What OpenHands does not report:

  • OpenHands Cloud cannot send to Rius, because Cloud agents take no custom environment variables.
  • Web app conversations have every model call and tool call, but no tokens or cost, because their model calls are streamed. OpenAI Responses API models such as GPT-4.1 and GPT-5 also carry no token data.
  • A failed terminal command is not an error span. The non-zero exit code is in the tool output, so error-rate alerts do not count it.
  • Web app conversations show under the agent openhands-agent-server, not under a name you chose.

When something else fits

  • If your developers use Claude Code, the plugin traces each session with timing, tokens and cost. Start with Track Claude Code usage and cost across a team.
  • To compare OpenHands with the other coding agents Rius traces, see Coding agents.
  • If you run OpenHands Cloud, Rius cannot receive its traces today, so use the SDK or the local web app.

Still stuck? Get help

Last updated on