@langwatch/scenario
    Preparing search index...

    Interface RealtimeUserAgent

    A user-sim agent that speaks scripted text into a realtime transport — the realtime model synthesizes the voice itself, with NO TTS conversion step. Implemented by the OpenAI Realtime adapter when role=USER.

    interface RealtimeUserAgent {
        sendText(text: string): Promise<void>;
        speakUserTurn(
            text: string,
        ): Promise<{ data: Uint8Array; transcript?: string }>;
    }
    Index
    • Inject a text turn into the realtime session and kick off the response (conversation.item.create + response.create). Fire-and-forget — the spoken audio arrives on the adapter's own receiveAudio stream.

      Parameters

      • text: string

      Returns Promise<void>

    • Speak a scripted line AND drain the resulting spoken audio, returning it as one audio chunk (PCM16 bytes + the model's spoken transcript). This is the bridge the executor uses to feed a realtime USER's voice into a SEPARATE agent-under-test (e.g. hosted ElevenLabs) through scenario.run() (#705): the chunk's audio is recorded as the real user turn, and its transcript drives the agent-under-test's turn-commit.

      The returned chunk carries transcript = the model's own spoken transcript (fallback: the scripted text). The adapter owns all protocol framing and end-of-turn detection.

      Parameters

      • text: string

      Returns Promise<{ data: Uint8Array; transcript?: string }>