@langwatch/scenario
    Preparing search index...

    Class RealtimeAgentAdapter

    Adapter that connects Scenario testing framework to OpenAI Realtime API

    This adapter wraps a connected RealtimeSession to provide the Scenario framework interface. The session must be created and connected externally, ensuring the same session creation pattern is used in both browser and tests.

    // In beforeAll
    const session = createVegetarianRecipeSession();
    await session.connect({ apiKey: process.env.OPENAI_API_KEY });
    const adapter = new RealtimeAgentAdapter({
    session,
    role: AgentRole.AGENT
    });

    // In test
    await scenario.run({
    agents: [adapter, scenario.userSimulatorAgent()],
    script: [scenario.user("quick recipe"), scenario.agent()]
    });

    // In afterAll
    session.close();

    Hierarchy (View Summary)

    Index

    Constructors

    Properties

    name: string
    role: AgentRole

    Methods