Skip to content
Français

createScriptedAgent

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

Create a CLI-shaped test agent that consumes a snapshot of turns in declaration order, including retries, passes and response repairs. It emits predefined events and complete zero usage by default; turns exhausted throws code process. Use createMemorySandboxProvider explicitly. Conversation IDs support repairs and resume only in the same open sandbox; capture, cold resume, fork, terminals and live input are unavailable. Each independent test needs a fresh agent.

Complete example and detailed rules.

  • optionsRequired
    ScriptedAgentOptions
    Snapshot of the name and ordered turns for one test agent. No sandbox is allocated until dispatch or createSandbox.
  • options.nameOptional
    string | undefined
    Observer-visible agent name; defaults to scripted. Empty names are rejected.
  • options.turnsRequired
    readonly ScriptedTurn[]
    Nonempty sequence consumed once per agent request, across sandboxes, passes, retries and repairs. Recreate the agent to reset it.

CliAgent

export declare function createScriptedAgent(
  options: ScriptedAgentOptions,
): CliAgent;