Skip to main content

Test Mode

Test mode lets you interact with your agent in the terminal using pure text — no phone calls, no STT/TTS, no external services required. It simulates a phone conversation for rapid 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 onMessage

Test mode works with custom message handlers, exactly as they would work in production:
The onMessage handler receives a single data object with text, call_id, caller, and history fields.

Using with Built-in LLM Loop

When no onMessage handler is provided and OPENAI_API_KEY is available (either from new OpenAIRealtime({ apiKey }) 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 onMessage is provided).