Synthesize TTS audio. Exposed as a property so tests can replace it with a stub without subclassing.
Signature mirrors python/scenario/voice/tts.py:synthesize(text, voice).
Returns an AudioChunk with the synthesized PCM16 data.
Default: routes through the per-run TTS module (voice/tts#synthesize),
whose "provider/voice" router resolves the backend and whose LRU cache
is keyed on (sha256(text), voice) — effects apply AFTER the cache read
(in voiceify), never baked into the key. Per-run, not a module
global. Tests inject a stub via _synthesize.
LLM invocation function. Can be overridden to customize LLM behavior.
Per-sim interruption probability (PRD §4.2 interrupt_probability). The
executor reads this during proceed() to decide whether to barge in on a
given agent turn. Defaults to 0 (never).
The simulator's own configured TTS voice (PRD §4.2,
userSimulatorAgent({ voice })), or undefined when none was set.
Exposed (mirrors Python's UserSimulatorAgent.voice attribute) so the
executor can decide whether a scripted user("text") step should be
voiceified for a voice agent under test — see
scenario_executor.py:_find_user_sim + the getattr(sim, "voice", None)
guard.
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.
AgentInput containing conversation history, thread context, and scenario state.
The agent's response.
Set a per-step override for voice_style and/or audio_effects. Returns a cleanup function that restores the previous overrides.
Usage:
const restore = sim.setOneShotOverride({ voiceStyle: "angry" });
try { await sim.call(input); } finally { restore(); }
Voiceify an explicit, scripted user line (scenario.user("text")) into an
audio ModelMessage — TTS via the effective voice + any active
per-step effects/overrides. Returns the original text message unchanged
when no voice resolves or the content is empty.
Port of the explicit-content branch of
python/scenario/scenario_executor.py:user (sim._voiceify({...})). The
auto-generated-turn path uses the private voiceify (which also
reads the per-run cfg.voice.tts.voice off AgentInput); this entry
point is for the executor's scripted-content path, where the simulator's
OWN voice is authoritative and the per-run config is supplied directly.
OptionalrunVoiceConfig: { tts?: { voice?: string } }
Abstract base class for user simulator agents. User simulator agents are responsible for generating user messages to drive the conversation.