Skip to main content

Test Mode

Test mode lets you interact with your voice agent in the terminal using pure text — no phone calls, no STT/TTS, no external services required. It simulates a phone conversation for rapid agent development.

Quick Start

This opens an interactive REPL:

Commands

CommandDescription
/quitEnd the test session.
/hangupSimulate hanging up the call.
/transfer <number>Simulate a call transfer.
/historyPrint the full conversation history.

Using with on_message

Test mode works with custom message handlers, exactly as they would work in production:
The call_control parameter is automatically injected if your handler accepts two arguments.

Using with Built-in LLM Loop

When no on_message handler is provided and OPENAI_API_KEY is available (either from OpenAIRealtime(api_key=...) or the env var), test mode uses the built-in LLM loop with streaming responses:
The LLM loop supports tool calling — tools are executed via their configured webhooks just like in production.

Event Callbacks

Test mode fires the same lifecycle callbacks as serve():
Test mode is designed for development only. It does not use any external APIs (except OpenAI for the LLM loop when no on_message is provided).