Skip to Content
Rius

How do I know if my AI agent is still running?

Rius shows whether each copy of your agent is alive on the Agents page, where every process appears as an instance with a status of running, ready, stale, gone or stopped. The status comes from heartbeats that the Rius SDK sends every 15 seconds by default, and Rius computes it on the server from the last heartbeat. You can also see how many traces each instance has open right now.

How it works

With the heartbeat on, each instrumented process pings Rius on a fixed interval for its whole lifetime. Every process start gets a fresh instance id, and instances group under the agent name. Three replicas of one agent show as three instances under one name. Rius classifies each instance from its last ping and never trusts the client’s clock or claims.

StatusMeaningWhen
runningAlive and workingRecent heartbeat, at least one open trace
readyAlive and idleRecent heartbeat, no open traces
staleMissing heartbeatsNo heartbeat for 30 seconds
gonePresumed deadNo heartbeat for 60 seconds, and no final heartbeat
stoppedShut downThe process sent its final heartbeat before exiting

The difference between stopped and gone tells you how the process ended. A clean shutdown sends a final heartbeat, so the instance reads stopped. A process that is killed (SIGTERM from a deploy, SIGKILL, an out-of-memory kill) or exits with process.exit() or os._exit() sends none, so it reads gone, which usually points to a crash.

Heartbeats tell you whether a process is alive, not whether the agent is making progress. A hung process that still sends heartbeats shows as running.

The instance id also rides on every span the process exports, as the service.instance.id resource attribute. From an instance you can find its traces, and from a trace you can tell which process ran it, even one that has died. Concepts covers this model, and Monitor AI agents in production puts it in the wider picture.

Set it up

  1. Check that heartbeats can run. They are on by default in both SDKs, so if you followed the quickstart your agent already appears on the Agents page. Heartbeats need credentials: an API key passed to init or set as RIUS_API_KEY. A client without credentials sends no heartbeats.
  2. Name the agent. Instances group under agent_name or RIUS_AGENT_NAME, which defaults to your service name.
  3. Send the final heartbeat on exit. A normal Python interpreter exit sends it, and so does calling shutdown():
import rius client = rius.init( api_key="ri_...", service_name="checkout-agent", agent_name="checkout-agent", heartbeat_interval=15, ) # ... run your agent ... client.shutdown() # sends the final `stopped` heartbeat
  1. Handle SIGTERM yourself. The SDK installs no signal handlers, so call shutdown() from your own handler. Otherwise every deploy ends your instances as gone. In TypeScript, Node sends the final heartbeat when the event loop empties. process.exit() and signals skip it, so call await client.shutdown() first.
  2. Leave the interval at 15 seconds or lower. RIUS_HEARTBEAT_INTERVAL accepts 5 to 300, but stale at 30 seconds and gone at 60 seconds are fixed by Rius. A longer interval makes a live instance show as stale between heartbeats.
  3. Verify. Start your agent, open the Agents page, and look for an instance in running or ready. Let the process exit and it moves to stopped. If it goes to stale and then gone instead, the process was killed before it could send its final heartbeat.

The Agents page documentation has every setting and the troubleshooting steps.

What you get

  • A live count of instances per agent, with how many are alive.
  • An Open traces tile showing runs still in progress as of the last heartbeat, and a running… state on recent traces. A trace shows frozen? when its run is still open but the instance running it has gone stale.
  • Worst-first ordering, so problem rows come first. An agent that sends traces but no heartbeat is marked no heartbeat.
  • A lifecycle events list showing when each instance started, finished, went quiet or came back.
  • A record of crashes. A gone instance stays visible for a week after its last heartbeat, long enough to investigate.
  • Claude Code sessions as live instances of claude-code, and Codex (beta) sessions as live instances of codex. Cursor (beta) sends no heartbeat, so it has no instances.

When something else fits

  • If you need to know whether a run is making progress, a heartbeat does not answer that. Use the open trace on the instance and its recent traces to see what the agent was doing.
  • If your process sends traces through your own exporter without credentials for the Rius client, it sends no heartbeats. The agent still appears from its traces, marked no heartbeat.

Still stuck? Get help

Last updated on