An agent failover platform detects that a model, provider or agent harness has stopped doing its job and can route eligible work to a healthy, compatible alternative. Preserving completed work requires durable portable state and reconciliation of prior actions. For agents, unlike single LLM calls, the hard part is not the switch. It is carrying the session across it: conversation history, tool-call state and the record of side effects already committed. HarnessRouter is built around this problem: one API in front of 30+ agent harnesses, models and sandbox providers, so that a backup path can be configured by design rather than by emergency rewrite for supported, compatible configurations.
TL;DR
- Failover for agents is session-level, not request-level: state must be durable before the switch happens, and a backup that lacks the session's tool schema or context window can corrupt it.
- Separate the mechanisms: retries, fallbacks, failover and load balancing solve different failures, and none of them fixes an exhausted spending cap or a malformed request.
- Do not add redundancy everywhere. Map each step to its blast radius and give multi-provider failover to the steps where a wrong or duplicated action is expensive.
- Put fallback rates, retry rates and recovery verification on a dashboard, because a silent failover can hide a failing primary for days.
- A unified interface can simplify backup configuration for supported, compatible components; session migration still needs portable state and recovery controls.
What failover means for an AI agent
In classical infrastructure, failover is the automatic switch to a standby database, server or component when the primary fails. The standby is usually a replica, so the state is already there and the client simply reconnects.
An AI agent breaks that assumption. An agent is a loop: a model reasons, calls tools, reads results, writes files, and reasons again, often across dozens of steps. The primary components are a harness (the runtime that drives the loop, such as a coding agent), a model, a provider that serves the model, and a sandbox where tools execute. Any of these can fail mid-loop, and the replacement is rarely an identical replica. A different model has a different context window, different tool-calling behavior and different output habits.
So an agent failover platform has three jobs:
- Detect that a component is unhealthy or that its output is unusable.
- Route the task or the remainder of the session to an alternative model, provider, harness or sandbox.
- Preserve continuity, meaning the alternative resumes the session instead of restarting it or repeating actions with real-world effects.
The third job is what separates an agent failover platform from a generic LLM proxy. If you are comparing the two layers, our guide to what an LLM proxy does and where it stops covers the boundary.
Which failures should trigger failover
Not every failure deserves the same response. A useful taxonomy separates failures by what you can observe:
| Failure | Typical signal | Right response |
|---|---|---|
| Provider outage or incident | 5xx errors, connection resets, timeouts | When replay is safe and prior actions are reconciled, fail over to an approved, healthy, compatible provider serving the same or an equivalent model, within remaining capacity, time and budget |
| Rate limiting or regional throttling | 429 responses, rising latency | For confirmed temporary throttling, respect Retry-After and shared limits; use only approved routes with remaining budget and capacity |
| Context window exceeded | Explicit length error | Use a compatible model that fits the complete request plus reserved output, or compact the session under the workflow policy |
| Malformed output | Invalid JSON, broken tool-call schema | Retry or fall back only when replay is safe, validation permits it and shared attempt, time and spend budgets remain |
| Confidently wrong output | Passes status checks, fails validation | Escalate to a stronger model or to a human |
| Exhausted spending cap, invalid request | Billing or validation error | None of the above helps; fix the cause |
The first five categories follow the failure modes described in one practitioner guide to AI redundancy, which also frames recovery in layers: model fallback, provider failover, idempotent retry and graceful degradation, with human escalation as the last backstop.
The last row matters. The Frontier Wire's explainer on LLM failover points out that routing to another provider does not repair an exhausted spending cap or a malformed request. Classify errors before routing them, or the platform will cycle a doomed request through every provider in the chain.
Status codes are not enough
A 200 response is not a success. Different models produce different lengths, formats and refusals, and they accept different parameters. The same source notes, for example, that some Claude models reject assistant-message prefill or forced tool choice, so a fallback path needs its own prompt variants and its own evaluation. Recovery verification therefore has to be semantic: check that the output parses, that the tool call matches the schema, and that the step moved the task forward.
Why the session, not the request, is the unit that matters
Standard LLM failover was designed for self-contained requests: if the call fails, send it elsewhere. Orchestration Weekly's analysis of provider failover in agent infrastructure argues that for autonomous agents the unit of value shifts from the response to the session. Losing state midway can invalidate everything the agent has done, including actions already taken outside the system.
The same analysis lists the conditions an agent-aware failover must meet:
- Recoverable session state, including conversation history, tool-call state and available checkpoints, must be durable before failover fires.
- Recovery must be verified beyond status codes.
- The backup provider's capabilities, including tool schema and context window, must match at failover time.
- Stable logical-action keys must travel with the session and be enforced by the receiving tools; otherwise reconcile uncertain outcomes before retry.
A backup must support the tool contract and fit the complete request plus reserved output. A mismatch can fail or degrade recovery; accepting a request does not itself prove corruption. Silent degradation is the failure mode to design against: plausible and wrong.
Teams new to agent operations often benefit from a short online AI bootcamp before they define which session details must survive a switch.
What research says about continuity cost
The academic side is young but concrete. ContinuityBench, submitted to arXiv in July 2026, is a benchmark and systems study of stateful failover in multi-provider LLM routing. It measures continuity latency overhead as the difference between treatment and baseline latency, which is a useful definition to adopt: when you evaluate any platform, measure how much extra time a failover with state preserved costs compared with a plain request.
Checkpoint before side effects
A practical rule follows from the session model: write a durable checkpoint before every tool call that can cause an irreversible effect, such as a payment, an email or a database write. The checkpoint should record the plan, the tool name, the arguments, an idempotency key and the step ordinal. If the worker dies between two side effects, a replacement can resume from a compatible checkpoint and use receiving-service idempotency or an authoritative action-status check to reconcile the last action. This cadence is described in a detailed agent disaster-recovery write-up.

Retries, fallbacks, failover and load balancing
These four terms are often used interchangeably, and conflating them produces misconfigured systems. The Frontier Wire's definitions are the cleanest:
| Mechanism | What it does | Trigger |
|---|---|---|
| Retry | Resends the same request to the same provider after backoff | Transient error |
| Fallback | Moves the request to the next entry in an ordered chain | Failure of the current entry |
| Failover | Shifts traffic away from a degraded provider, key or region | A health signal |
| Load balancing | Distributes requests proportionally across targets | Always on |
In an agent platform you usually need all four, layered. Retries absorb blips, fallbacks handle individual bad responses, failover handles sustained degradation, and load balancing distributes traffic, while admission controls and rate limits are still needed to keep each target within capacity.
Designing failover: what to evaluate
Reliability: map steps to blast radius
Blanket redundancy can increase cost and recovery latency for steps that do not need it. The sound discipline, argued in the AI redundancy guide, is to map each step to its blast radius: a step that posts to a general ledger earns multi-provider failover, while a step that drafts an internal summary does not. In practice, tag each tool and each task type with a criticality level and attach a failover policy to the level, not to the whole agent. Our guide to measuring and improving AI agent reliability goes deeper on the metrics.
Latency: budget the recovery path
Every layer of recovery adds time. Set a timeout per step, a maximum number of fallback hops, and a total session deadline. Decide in advance whether a slow answer from a healthy primary is better than a fast answer from a backup with a weaker model. For quality, latency and cost trade-offs between models, see multi-model agent architecture, routing and cost.
Retry amplification
Retries compound across layers. The Frontier Wire cites the Google SRE book's example: if three layers each issue three retries, a single user action can generate 64 attempts against an already overloaded backend. If your gateway already retries, reduce retries in the SDK and the agent harness, and keep exactly one layer responsible for each class of error.
Observability: make silent failover visible
A well-working failover can hide a primary that has been failing for days. Fallback rate, retry rate, per-provider error rate and time-to-recover belong on a dashboard with alerts, not only in logs. Each failover event should be a trace span that records the trigger, the origin, the destination and whether the semantic check passed. See what to trace, measure and audit in agent systems for a working list.
Security and isolation
A failover that moves a session to another provider also moves its data. Decide which providers are permitted for which data classes, where API keys live, and whether tool execution stays inside one isolated sandbox while the model behind it changes. Keeping execution separate from inference makes the second part much easier to reason about.
Cost
Failover costs money in three ways: duplicated work when a step is retried, premium models used as backups, and extra tracing volume. Limit repeated inference with shared retry budgets and checkpoints; use enforced idempotency to prevent duplicate external effects, tested backup chains to control model cost and suitable sampling for traces. The LLM cost optimization guide for agent teams covers each lever.
One Agent API
Test recovery before production
Compare primary and backup configurations on representative tasks.
Start buildingLimits you should plan for
Failover reduces risk, and it works best when its boundaries are known up front:
- Streaming cannot be spliced. Once output has started, no gateway can continue the same generation with a different model. Design streamed responses so a failed stream restarts cleanly, or buffer where correctness matters.
- The fallback path needs its own evaluation. Prompts tuned for the primary model should have tested variants for each backup.
- Side effects need idempotency at the tool layer. A gateway cannot know that an email was already sent; the tool must.
- Capabilities must match. Check tool schema support and context size for every model in the chain before an incident, not during one.
These are engineering requirements rather than obstacles: each one is a property you specify when choosing the platform that sits under your agents.
Failover across harnesses, models and sandboxes
Most failover writing stops at the model provider. Production agents have more layers that can fail: the harness that runs the loop, the sandbox that executes tools, the memory store that holds state. A platform that abstracts only the model leaves the other layers as single points of failure.
HarnessRouter takes the broader view. It provides one API in front of agent harnesses such as Codex, Claude Code, Hermes, DeepSeek Harness in developer preview and Pi, with 30+ supported and the list growing. Harnesses, models, providers, skills, tools, plugins, memory and sandboxes are treated as interchangeable building blocks, and tasks run in an isolated sandbox. For supported, compatible configurations, a task can target another harness or model without a separate integration. Moving an in-progress run still requires portable checkpoints, compatible tools and reconciliation. Its agent session management, file handling and environment provisioning features exist so the surrounding state is handled by the platform rather than by each application. The approach is built on the open Unified Harness Protocol (UHP), which keeps the harness layer from becoming a lock-in point. For the routing side of this design, see running and routing multiple agent backends in production, and for the general pattern what an LLM router is and how a unified LLM API works.
A sensible rollout looks like this:
- Inventory the steps in your agent and tag each with a blast radius.
- Define an ordered chain per criticality level, with capability checks on each entry.
- Use stable keys per logical external action when the receiving tool enforces idempotency; otherwise implement deduplication and reconcile uncertain outcomes.
- Checkpoint session state before each such tool call.
- Add semantic validation to the recovery path, not just status codes.
- Put fallback rate and time-to-recover on a dashboard with alerts.
- Benchmark the primary and the backups on your own tasks so the chain is ordered by evidence.
HarnessRouter's benchmarking tools support the last step, comparing harnesses and models on the same workload.
Perspective
Our view is that failover is a property of the architecture, not a feature bolted onto a model call. When the harness, the model, the provider and the sandbox are each a swappable block behind one interface, a backup path is something you declare. When they are hard-wired, it is something you rebuild during an incident.
That is why we built HarnessRouter as a unified interface for agent harnesses and based it on an open protocol, UHP. The harness layer should be open, commoditized infrastructure, so that a team can configure supported, compatible harness, model and sandbox options through a consistent interface.
We also think the right unit of design is the task. For each task, teams can benchmark and select supported, compatible harness, model and module configurations for quality, latency or cost. A failover policy is the same idea applied to bad days: the task keeps its goal, and the components underneath change.
Pricing for teams that want a backup path
HarnessRouter has a free plan at $0 per month, a Developer plan at $20 per month, a Production plan at $200 per month and a Scale plan at $1,000 per month, plus an Enterprise tier. Tracing is in beta, included with Scale and $50 per month on other plans. BYOK routing is free up to $25,000 in monthly model usage at list prices, with a 5% fee above that volume; agent work and memory remain separately billable. Top-up processing is 5.5%, with a $0.80 minimum. Teams that prefer to run it themselves can use the open-source Community Edition.
If you are building an agent product and want to run harnesses and models behind one API, start with the pricing page, or read how the Community Edition works for self-hosting.

For production architecture and controls around this, AI agents in production is a good next read, and product examples show what teams ship on top of it.
FAQ
What is the purpose of failover for AI agents?
The purpose is to keep an agent task completing when a model, provider, harness or sandbox degrades or fails. For agents the goal goes further than availability: the session, its tool state and its completed side effects must survive the switch so the task resumes rather than restarts.
How is agent failover different from a retry?
A retry resends the same request to the same provider after a delay. Failover moves traffic away from a degraded provider, key or region based on a health signal. Retries handle transient errors, while failover handles sustained ones, and both are needed.
How do I stop failover from duplicating actions like payments or emails?
Use a stable key for the same logical external action and require the receiving service to enforce it. Keep a durable checkpoint and reconcile uncertain action outcomes before replay; a key or checkpoint alone does not prevent duplication.
Should every agent step have a backup provider?
No. Map each step to its blast radius. Steps that change records in a system of record deserve multi-provider failover, while low-stakes steps such as drafting an internal summary can rely on simple retries.
How do I know failover is working?
Track fallback rate, retry rate, per-provider error rate and time-to-recover, and trace each failover event with its trigger and destination. A rising fallback rate on a quiet dashboard is the sign that a primary is failing silently.
Sources
- AI Redundancy: Failover for Agent Systems
- LLM failover and load balancing for AI apps, The Frontier Wire
- LLM Provider Failover and Routing in Agent Infrastructure, Orchestration Weekly
- ContinuityBench: A Benchmark and Systems Study of Stateful Failover, arXiv
- Agent Disaster Recovery: When Working Memory Dies With the Region
- 5-Day Online AI Bootcamp
