@langwatch/scenario
    Preparing search index...

    Class ElevenLabsAgentAdapter

    Hosted ElevenLabs Conversational AI adapter.

    Connect, send PCM16 audio chunks, and drain agent audio over the wss://api.elevenlabs.io/v1/convai/conversation?agent_id=... socket.

    Hierarchy (View Summary)

    Index

    Constructors

    Properties

    agentId: string
    agentSpeakingEvent?: AgentSpeakingEvent

    Set when the adapter has emitted its first agent audio chunk for the current turn — gates timing-based barge-in. Concrete adapters expose this so scenario.interrupt can wait for real speech before firing the interruption. Optional: adapters without server-VAD-style interrupt sequencing can leave it undefined.

    capabilities: AdapterCapabilities = ...

    Declaration of what this adapter can and cannot do. Concrete subclasses MUST publish a non-default value; the base instance defaults to "nothing supported" so capability-gated steps fail safely when an adapter forgets to declare.

    lastAgentTranscript: string | null = null
    lastUserTranscript: string | null = null
    name?: string
    responseMaxDuration: number = 30.0

    Hard cap on a single agent turn's audio. Prevents runaway loops if a transport never signals end-of-stream. 30s = a long sentence.

    responseTailSilence: number = 0.6

    Tail silence: once the first agent chunk arrives, keep draining receiveAudio until no chunk shows up within this many seconds — that's how we detect the agent finished talking.

    responseTimeout: number = 30.0

    Seconds to wait for agent audio after sending user audio.

    role: AgentRole = AgentRole.AGENT
    streamingTranscript?: string

    Incremental transcript text emitted while the agent speaks. Populated by adapters that advertise capabilities.streamingTranscripts. Read by scenario.interrupt when afterWords: N is set.

    Accessors

    Methods

    • Send a first-class interrupt signal to the agent under test.

      Adapters that advertise capabilities.interruption === true override this to send the transport-native interrupt (e.g. Twilio clear, OpenAI Realtime response.cancel). The default raises UnsupportedCapabilityError; callers (scenario.interrupt()) check capabilities.interruption and fall back to timing-based barge-in when this returns false.

      Returns Promise<void>