Skip to main content
CRON CADENCE: */5 * * * * UTCSOURCE: OFFICIAL STATUSPAGE V2 JSON FEEDS
Agent Outages
MODULE: RPC FAILOVER & IDEMPOTENCY REFERENCEABORT DEADLINE: 4000ms TTFT · JITTER CAP: 12000ms

Resilience & Failover Patterns for Tool-Calling Agents

Hardening an agent pipeline requires treating model endpoints and MCP servers like unreliable network RPCs. Pair these application-level patterns with transport hardening (including checking hybrid TLS 1.3 negotiation on external webhook endpoints via the qdaycheck.com TLS 1.3 readiness scanner).

Analytics display charting system response times and error-budget curves
CIRCUIT TELEMETRYHALF-OPEN PROBE

1. Time-to-First-Token (TTFT) Budgets & Cross-Provider Circuit Breakers

PATTERN-01 // TTFT CIRCUIT BREAKER

Whole-response HTTP timeouts (such as 60 seconds) hide hung inference streams until the user has already abandoned the session. Enforce a strict 4-second Time-to-First-Token deadline and trip a half-open circuit breaker on HTTP 429, 502, 503, or 529.

ttft-fallback-router.tsTYPESCRIPT // NODE 20+
// Deterministic TTFT deadline + secondary model fallback
async function invokeWithFallback(promptPayload, signal) {
  const ttftAbort = AbortSignal.timeout(4000);
  try {
    return await callPrimaryModel(promptPayload, AbortSignal.any([signal, ttftAbort]));
  } catch (err) {
    if (isRetryableProviderFailure(err)) {
      return await callSecondaryModel(promptPayload, signal);
    }
    throw err;
  }
}

2. Deterministic Tool-Call Idempotency Keys

PATTERN-02 // WRITE DEDUPLICATION

When an MCP server or downstream SaaS API times out after 10 seconds, the orchestrator cannot tell whether the write succeeded before the socket dropped. Derive a stable idempotency key from the workflow run ID, step index, and canonicalised arguments.

tool-idempotency-key.tsTYPESCRIPT // NODE 20+
import crypto from 'node:crypto';

export function buildToolIdempotencyKey(runId, stepIndex, toolName, args) {
  const canonical = JSON.stringify({ runId, stepIndex, toolName, args });
  return 'idem_' + crypto.createHash('sha256').update(canonical).digest('hex').slice(0, 32);
}

3. Full-Jitter Exponential Backoff for HTTP 429 & 529 Bursts

PATTERN-03 // ANTI-HERD JITTER

Fixed-interval retries synchronise across concurrent agent workers and turn a 30-second rate-limit dip into a 20-minute self-inflicted outage. Always apply full random jitter between 0 and the capped backoff ceiling.

full-jitter-backoff.tsTYPESCRIPT // NODE 20+
export function computeFullJitterDelayMs(attempt, baseMs = 400, capMs = 12000) {
  const expCeiling = Math.min(capMs, baseMs * Math.pow(2, attempt));
  return Math.floor(Math.random() * expCeiling);
}

Reviewed by Nadia Lindqvist, Lead Reliability & Agent Systems Editor

Reviews distributed retry budgets, circuit-breaker state machines, and agent RPC patterns.

Last reviewed:

Reviewed every 3 months

AI-assistance & editorial check: Research outlining and formatting are assisted by AI tools in an offline draft workflow. Nothing on this site publishes automatically without verification. A named human editor opens and verifies every primary source link, command snippet, and factual statement prior to publication. See our Editorial Policy and Corrections Policy.

Verified Primary Sources

Receive Tested Agent Reliability Patterns

Agent Uptime & Failover Post-Mortems

Store your email for quarterly updates on multi-provider routing, MCP transport resilience, and verified outage post-mortems. No emails are sent yet.

Protected by Cloudflare Turnstile · Isolated per-site D1 (agentoutages-leads).