Skip to main content
This example runs a turn-based debate between two agents, where each agent’s response is narrated in real time using a distinct voice. Voice differentiation makes it easy to follow who is speaking. You can also drive the opening prompt by speaking into a microphone, using the package’s STT helper.

Step 1: Install dependencies

Step 2: Set up two TTS callbacks with different voices

Each speaker gets its own callback so the audio is clearly attributable.

Step 3: Define the debate driver

The driver alternates speakers, runs each turn with the appropriate TTS callback, flushes the buffer, and feeds the prior response as the next agent’s input.

Step 4: Define the two debaters

Use distinct system prompts so the agents argue in character. Keeping the responses short produces a more natural-sounding back-and-forth.

Step 5: Run the debate

See also