Skip to content
Français

ReplayAgent

import type { ReplayAgent } from "@elie-laloum/outpost";
  • kindRequired
    "replay"
    Always replay. It distinguishes a replay agent, which has no harness or model, from cli and custom agents in the Agent union.
  • sourceRequired
    "harness" | "agent"
    Observation source used for replayed events: harness when the journal came from the Outpost harness, otherwise agent.
  • divergenceRequired
    ReplayDivergencePolicy
    Divergence policy: fail throws ReplayDivergence; warn reports prompt, baseline, tree and unrecorded divergences as warnings and continues.
  • turnsRequired
    readonly ReplayTurn[]
    Recorded turns parsed from the journal, in execution order.
  • remainingTurnsRequired
    number
    Number of recorded turns not yet consumed by a dispatch; 0 after a complete replay.
  • nextTurnRequired
    () => ReplayTurn | undefined
    Consume and return the next recorded turn, or undefined when the journal is exhausted. Dispatch calls it once per turn; a replay agent is single-use.
  • pendingSteeringRequired
    () => readonly string[] | undefined
    Recorded instructions that resumed the next turn, without consuming it; dispatch uses them to continue a steered pass as recorded. Undefined when the next turn was not a steering resumption.
  • nameRequired
    string
    Native agent identifier used in execution events and diagnostics.
  • bootstrapOptional
    string | undefined
    Built-in agent whose pinned CLI Outpost installs on a remote sandbox when the executable is missing: an npm package, or a SHA-512-verified archive for antigravity. An unknown name fails.
  • requiresFinishedEventOptional
    boolean | undefined
    Require the native final event: without it, completion markers do not match and the turn fails with code process, even when the process exits with 0.
  • usageOptional
    "events" | "session" | "unavailable" | undefined
    How token usage is measured: events reads it from the output stream, session reads the session after the process exits, unavailable records none. Missing counters then mark usage incomplete; omitted, reported events are counted without that check.
  • variablesOptional
    Readonly<Record<string, string>> | undefined
    Environment variables added to every command of this agent, over the values from .outpost/.env. A name also set by the sandbox provider fails with code configuration.
  • storageOptional
    ConversationStore | undefined
    Conversation store that captures, locates and restores this agent’s sessions; absent when its conversations are not portable.
  • captureOptional
    boolean | undefined
    Save the conversation to storage after each turn; false skips it. Omitted, a turn is saved whenever storage is present.
  • resumableOptional
    boolean | undefined
    Whether the agent can continue a conversation, as continuation, response repairs and resume-based steering require; false rejects continuation before allocation. Cold continuation also needs storage.
  • forkableOptional
    boolean | undefined
    Whether the agent can fork a conversation; false rejects fork before allocation. Omitted, fork is attempted through request() or the fork hook.
  • transcriptUsageOptional
    ((text: string) => Usage | undefined) | undefined
    Read token usage from the transcript captured after the turn; a result replaces the usage reported by events, undefined keeps it.
export interface ReplayAgent extends AgentFeatures {
  readonly kind: "replay";
  readonly source: "agent" | "harness";
  readonly divergence: ReplayDivergencePolicy;
  readonly turns: readonly ReplayTurn[];
  readonly remainingTurns: number;
  nextTurn(): ReplayTurn | undefined;
  /** Instructions that resumed the next recorded turn, without consuming it. */
  pendingSteering(): readonly string[] | undefined;
}