Skip to main content
Gateway Status lets a running agent look at its own live gateway state — whether it’s busy or idle, how many conversations are active, the delivery backlog, and whether any channel is degraded — so it can proactively warn the user instead of silently under-delivering.
A user asks the agent how it’s doing; the agent reads its own live gateway snapshot and answers from the current state — all within a single turn.

Which tool?

gateway_status is easy to confuse with its two siblings. This decision diagram picks the right one.

Quick Start

1

Enable the Tool

2

React to a Busy State

3

Detect Degraded Channels


How It Works

The running gateway registers a live source into the per-turn context; gateway_status resolves it and serializes a snapshot, returning the no-gateway message when nothing is registered. Core ships only the protocol, the snapshot shape, and the built-in tool; when no source is registered (CLI / one-shot), the tool returns the no-gateway message instead of raising.

Fields Reference

gateway_status() takes no arguments and returns a JSON string serialized from GatewayStatus.as_dict(). Every field defaults to empty so a partial binding is valid. Example returned JSON:

When It’s Available

gateway_status needs a running bot/gateway to read live self-state; a plain CLI run has nothing to report. When no gateway is active the tool returns:
If the bound source’s snapshot() raises, the tool logs and returns "Error reading gateway status: {e}" — it never raises into the agent turn.

User Interaction Flow

A user in Telegram asks the ops assistant “Are you swamped right now?” The agent calls gateway_status(), sees run: "busy", queued: 3, active_sessions: 12, and replies with a grounded estimate instead of a silent delay.

Common Patterns

Proactive backlog warning

Delivery health check before a critical send

Degraded-channel apology


Best Practices

Report state and continue. Don’t loop until run == "idle" — that stalls the turn. A single call gives the agent enough to set expectations.
One call returns the whole picture — run status, sessions, delivery, and degraded owners. There’s no reason to combine multiple health tools.
Check delivery.dead_targets and delivery.dlq before sending to sensitive channels, so the agent can warn the user first.
In tests and one-shot runs the tool returns the no-gateway message. Write instructions that handle that string instead of assuming a JSON snapshot.

Send Message Tool

Deliver a message to a target without waiting for a reply

Ask Conversation Tool

Ask a target and wait for its reply mid-turn

Clarify Tool

Ask the current user for input mid-turn

Messaging Bots

Set up the gateway that makes this tool available