Skip to content
Talk to an engineer

Agent Studio

High Availability

Path: Settings → AI Gateway

Keep your agent answering when a model provider throttles or has an outage, and the same failover covers your task agents. Foldspace fails over to the next healthy model and key automatically, usually without the end user noticing.

High availability is the uptime half of model routing. Token Quotas control how much your agents spend; high availability keeps them responding when a provider becomes unavailable.

Live traffic runs on a primary model; when it becomes unavailable Foldspace fails over to a fallback model, then fails back to the primary once it recovers Live traffic users & agents Answered no outage visible Primary model handles requests normally Active Fallback model takes over during an outage Standby Failover primary unavailable Failback primary recovers

A model becomes unavailable in two ways. Both are transient, and failover masks them by moving to the next healthy option. The codes below are how Google’s Gemini API titles them; OpenAI returns the equivalent HTTP statuses.

  • Capacity (429 RESOURCE_EXHAUSTED): the provider’s shared capacity is exhausted, or your key is being throttled. Foldspace retries briefly, then moves to the next option. If it’s your key’s own rate limit, that key gets a short cooldown while the next key or model takes over.
  • Outage (503 UNAVAILABLE, 500 INTERNAL, 504 DEADLINE_EXCEEDED, 408): the provider times out or is down. Same handling: a brief retry, then the next option.

Each request runs against an ordered list of options, where every option is a model plus one of your provider keys. Requests hit your key pool first: if you’ve added more than one key for a provider, Foldspace spreads across those keys before falling back further. The order is:

Failover order: the request tries your key pool on the requested model, then a different provider, then a different model on the same provider, and only falls back to the Foldspace platform key as a last resort Request Your keys Foldspace 1 Requested model your key(s) · tries each key you've added 2 Different provider your key on the other provider (peer model) 3 Different model, same provider your key all your keys exhausted 4 Foldspace platform key last resort · when platform fallback is allowed Healthy first option to respond serves the turn
  1. Requested model, your key(s). Every key you’ve added for that model’s provider.
  2. A different provider, your key. If you have a key for the other provider, Foldspace tries its peer model there (see Model pairs).
  3. A different model on the same provider, your key.
  4. The Foldspace platform key. A last resort, used only when every one of your keys is exhausted and platform fallback is allowed.

“Unavailable” applies to one model + key + region combination, never to a whole provider. A throttled key doesn’t take its provider offline; that combination is skipped and retried once it recovers.

Each tier has a matched peer on the other provider. When Foldspace crosses providers, it uses the requested model’s peer at the same tier.

TierGoogle GeminiOpenAI peer
LiteGemini 3.1 Flash LiteGPT-5.6 Luna
StandardGemini 3.5 FlashGPT-5.6 Terra
ProGemini 3.1 Pro PreviewGPT-5.6 Sol

A model, key, and region combination that was recently marked unavailable is skipped, and the request goes straight to the next healthy option:

  • One of your keys is down: the request continues on another of your keys, then a different provider or model.
  • All your keys are exhausted: the Foldspace platform key handles the turn, when platform fallback is allowed.
  • Nothing healthy is left: the turn fails, and the user sees a brief technical-difficulty message.

Every failover and failback is recorded in Event Explorer as one of four routing events — see Failover events for what each one fires on and the properties it carries. Open it to review each event and understand:

  • Reason — what made the primary unavailable, and why traffic failed back.
  • Timing — when failover happened, and how long the cooldown ran before failback.
  • Customer impact — which requests were affected, and whether the end user saw any disruption.
  • Failover events: the four routing events, their failure reasons, and common investigations.
  • Token Quotas: cap token spend per agent, user, and tier.
  • AI Provider Keys: add and rotate the provider keys failover routes across.