@langwatch/scenario
    Preparing search index...

    Class AgentAdapterAbstract

    Abstract base class for integrating custom agents with the Scenario framework.

    This adapter pattern allows you to wrap any existing agent implementation (LLM calls, agent frameworks, or complex multi-step systems) to work with the Scenario testing framework. The adapter receives structured input about the conversation state and returns responses in a standardized format.

    class MyAgent extends AgentAdapter {
    role = AgentRole.AGENT;

    async call(input: AgentInput): Promise<AgentReturnTypes> {
    const userMessage = input.messages.find(m => m.role === 'user');
    if (userMessage) {
    return `You said: ${userMessage.content}`;
    }
    return "Hello!";
    }
    }

    Implemented by

    Index

    Constructors

    Properties

    Methods

    Constructors

    Properties

    role: AgentRole = AgentRole.AGENT

    Methods

    • Process the input and generate a response.

      This is the main method that your agent implementation must provide. It receives structured information about the current conversation state and must return a response in one of the supported formats.

      Parameters

      • input: AgentInput

        AgentInput containing conversation history, thread context, and scenario state.

      Returns Promise<AgentReturnTypes>

      The agent's response.