@langwatch/scenario
    Preparing search index...

    Interface ScenarioExecutionStateLike

    Defines the state of a scenario execution.

    interface ScenarioExecutionStateLike {
        config: ScenarioConfig;
        description: string;
        get currentTurn(): number;
        get messages(): ModelMessage[];
        get threadId(): string;
        addMessage(message: ModelMessage): void;
        hasToolCall(toolName: string): boolean;
        lastAgentMessage(): AssistantModelMessage;
        lastMessage(): ModelMessage;
        lastToolCall(toolName: string): ToolModelMessage;
        lastUserMessage(): UserModelMessage;
        rollbackMessagesTo(index: number): ModelMessage[];
    }

    Implemented by

    Index

    Properties

    The scenario configuration.

    description: string

    The scenario description.

    Accessors

    Methods

    • Remove all messages from position index onward.

      Truncates the message list and cleans up any pending message queues so no agent sees stale messages.

      Parameters

      • index: number

        Truncate point (clamped to [0, messages.length]). Messages at positions >= index are removed.

      Returns ModelMessage[]

      The removed messages (empty array if nothing to remove).

      If index is negative.