Skip to content
Français

createFallbackAgent

import { createFallbackAgent } from "@elie-laloum/outpost";

Order at least two agents into a frozen FallbackAgent that dispatch runs in one sandbox and workspace, without reset. A candidate hands over only on a quota or outage fault listed in on, and the next one restarts from the original brief; every other failure is rethrown. Fewer than two candidates, a nested fallback agent or an invalid on list throws code configuration.

Complete example and detailed rules.

  • agentsRequired
    readonly [Agent, Agent, ...Agent[]]
    Ordered candidates, at least two, each composed with createAgent() or createReplayAgent(); the first is tried first.
  • optionsRequired
    FallbackAgentOptions
    Fallback policy: the on list of failure categories.
  • options.onRequired
    readonly FallbackTrigger[]
    Failure categories that move to the next candidate: quota, unavailable or both. An empty, repeated or unknown entry throws code configuration.

FallbackAgent

export declare function createFallbackAgent(
  agents: readonly [Agent, Agent, ...Agent[]],
  options: FallbackAgentOptions,
): FallbackAgent;