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.
| Status | Meaning | When |
|---|---|---|
running | Alive and working | Recent heartbeat, at least one open trace |
ready | Alive and idle | Recent heartbeat, no open traces |
stale | Missing heartbeats | No heartbeat for 30 seconds |
gone | Presumed dead | No heartbeat for 60 seconds, and no final heartbeat |
stopped | Shut down | The 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
- 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
initor set asRIUS_API_KEY. A client without credentials sends no heartbeats. - Name the agent. Instances group under
agent_nameorRIUS_AGENT_NAME, which defaults to your service name. - 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- Handle SIGTERM yourself. The SDK installs no signal handlers, so call
shutdown()from your own handler. Otherwise every deploy ends your instances asgone. In TypeScript, Node sends the final heartbeat when the event loop empties.process.exit()and signals skip it, so callawait client.shutdown()first. - Leave the interval at 15 seconds or lower.
RIUS_HEARTBEAT_INTERVALaccepts 5 to 300, butstaleat 30 seconds andgoneat 60 seconds are fixed by Rius. A longer interval makes a live instance show as stale between heartbeats. - Verify. Start your agent, open the Agents page, and look for an instance in
runningorready. Let the process exit and it moves tostopped. If it goes tostaleand thengoneinstead, 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
goneinstance 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 ofcodex. 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.