Failures and back-off
An agent behind a gateway sees failures an agent without one never does: a guardrail refusing content, a budget running out, a held call, an operator aborting a run, autonomy demoted after drift. Treat them all the same and one of two things happens. Either a provider outage marks every application in the queue as “failed three times” and hands them all to manual review, or a prompt-injection sample is retried forever. The screening agent avoids both by asking one question of every failed run: whose failure was this?
Two classes
Section titled “Two classes”All of it is decided in screening_agent/failures.py; the scheduler only acts on the
answer.
| Class | Kind | What the agent sees |
|---|---|---|
| application | content_blocked |
A content verdict: guardrail_blocked, semantic_policy_blocked, an argument-policy deny (JSON-RPC -32000) |
rejected_request |
HTTP 400 / 413 / 422, skill_error_400/413/422: the request built from this application was refused |
|
tool_error |
A tool answered with an error about this application (not found, invalid record, unknown class) | |
malformed_output |
A model or tool answer the agent could not use (not JSON) | |
unexpected |
Any other exception while processing this application | |
| system | unreachable |
No HTTP answer: DNS failure, connection refused or reset, timeout |
server_error |
HTTP 5xx, e.g. 503 gateway_resilience_gated, a 502 from a delegate |
|
rate_limited |
HTTP 429: provider credit_balance_exhausted, gateway limits and budgets, run_cap_reached |
|
approval_hold |
A hold outside the record step, e.g. skill_error_202: approval_required after autonomy was demoted |
|
governance_refusal |
autonomy_denied, a run aborted by an operator, 401, a 403 without a content verdict (a missing grant) |
|
unavailable |
404, 405, 408, 409: the gateway could not find or route the target |
|
delegate_failed |
The A2A delegate’s task ended FAILED / REJECTED / CANCELED |
|
delegate_deviated |
The delegate’s checked outcome is not declared, or not one the agent handles |
The order of the rules matters, and it is pinned by tests/test_failures.py, including the
exact errors seen live: no answer at all first, then governance refusals (an
autonomy_denied is the system’s even when it quotes a policy), then holds, then content
verdicts (a guardrail block is a 403 and still the application’s), then the HTTP status,
then the exception family.
Application failures: three strikes
Section titled “Application failures: three strikes”The application stays received and is retried on the next tick. Attempts are counted per
application in DATA_DIR/retries.json. After three, the agent hands it off in a short run
of its own (step give_up, outcome application_processed.sent_to_manual_review):
applications_hand_off moves it to the terminal status needs_manual_review with the
reason as a note, so it leaves the queue for good.
That is what stops the demo’s prompt-injection sample from looping: the organisation’s
baseline guardrail blocks it on mcp_output in intake, three times, and then a human
gets it. If the hand-off call itself fails, the application stays on the local skip list
and the hand-off is retried at the start of each tick.
System failures: stop and back off
Section titled “System failures: stop and back off”Nothing is counted against any application. The tick stops at the first system failure,
and the next 2^(streak-1) - 1 ticks are skipped entirely, with no gateway calls, capped at
BACKOFF_MAX_TICKS (default 6). With ten-minute ticks the probes run at +10, +20, +40 and
+80 minutes, then every 70 minutes, until the system answers. Any run that completes, or
that fails on the application’s own account, clears the back-off. The application that
tripped it is probed last next time, so one misclassified failure cannot hold the rest of
the queue behind it.
The agent’s log says so in plain words: one gateway kind=... status=... line per call, a
run=... state=errored ... failure=system/rate_limited line for the run, then
SYSTEM failure (system/rate_limited) and backing off.
GET :9201/status on the agent shows the back-off state (backoff.streak,
backoff.ticks_left, last_failure) and the system_failures count.
Why this is an assurance concern, not just resilience
Section titled “Why this is an assurance concern, not just resilience”- Closing every run. A failed run is closed
errored(withPOST /v1/runs/{root}/endwhen the failing call could not carry the header), and reports no outcome. Errors are execution, not outcomes. A run the agent abandons is recorded asabandonedby the sweeper, which the envelope grades as a failure of the agent. - Honest error rates. The Errors signal shows failed runs by error cause. If the
agent retried system failures in a tight loop, an hour-long provider outage would become
hundreds of errored runs and a
max_error_ratebreach that is about the provider, not the agent. Backing off keeps the evidence about the agent. - Never failing open. An outage never drops an underwriter’s approval, and “could not assess affordability” is never read as “affordable”. A failure always makes the outcome more conservative or leaves the application where it was.

Putting applications back
Section titled “Putting applications back”An operator who fixed the cause can re-queue handed-off applications:
./demo.sh requeue APP-20261028-007 # or: ./demo.sh requeue --all-skippedThat moves them back to received in the origination system and clears them from the
agent’s skip list; the running scheduler screens them on its next tick with fresh attempts.

