@langwatch/scenario
    Preparing search index...

    Interface ScenarioExecutionLike

    The execution context for a scenario script. This provides the functions to control the flow of the scenario.

    interface ScenarioExecutionLike {
        messages: ModelMessage[];
        threadId: string;
        agent(content?: string | ModelMessage): Promise<void>;
        agentNonBlocking?(content?: string | ModelMessage): void;
        fail(reasoning?: string): Promise<ScenarioResult>;
        judge(options?: { criteria?: string[] }): Promise<ScenarioResult | null>;
        message(message: ModelMessage): Promise<void>;
        proceed(
            turns?: number,
            onTurn?: (state: ScenarioExecutionStateLike) => void | Promise<void>,
            onStep?: (state: ScenarioExecutionStateLike) => void | Promise<void>,
        ): Promise<ScenarioResult | null>;
        succeed(reasoning?: string): Promise<ScenarioResult>;
        user(content?: string | ModelMessage): Promise<void>;
    }

    Implemented by

    Index

    Properties

    messages: ModelMessage[]

    The history of messages in the conversation.

    threadId: string

    The ID of the conversation thread.

    Methods

    • Adds an agent message to the conversation. If no content is provided, the agent under test will generate a message.

      Parameters

      • Optionalcontent: string | ModelMessage

        The content of the agent message.

      Returns Promise<void>

    • Voice-only: fire an agent turn WITHOUT awaiting it — the non-blocking primitive behind agent({ wait: false }) (PRD §4.4). The executor tracks the in-flight turn so a subsequent user call lands as a mid-stream barge-in (interruption) rather than a separate turn. Optional: text-only executors may omit it, in which case the { wait: false } step falls back to a fire-and-forget agent() with no barge-in coordination.

      Parameters

      • Optionalcontent: string | ModelMessage

      Returns void

    • Adds a user message to the conversation. If no content is provided, the user simulator will generate a message.

      Parameters

      • Optionalcontent: string | ModelMessage

        The content of the user message.

      Returns Promise<void>