Per-call prompt personalization with {variable} placeholder substitution in system prompts and first messages.
Part of the Patter Voice AI SDK.
cd python
cp ../.env.example .env # fill in your keys
pip install -r requirements.txt
python main.pycd typescript
cp ../.env.example .env # fill in your keys
npm install
npx tsx main.ts| Variable | Required | Description |
|---|---|---|
OPENAI_API_KEY |
Yes | OpenAI API key with Realtime access |
TWILIO_ACCOUNT_SID |
Yes | Twilio account SID |
TWILIO_AUTH_TOKEN |
Yes | Twilio auth token |
TWILIO_PHONE_NUMBER |
Yes | Your Twilio phone number (E.164) |
WEBHOOK_URL |
No | Public URL for webhooks (auto-tunneled if omitted) |
variablesinagent()— define default placeholder values when creating an agent{placeholder}syntax — use{customer_name},{account_number}, etc. in system prompts and first messageson_call_startreturning variable overrides — dynamically swap variables per caller at runtime- Per-caller personalization — look up caller info from a database and inject it into the conversation
- Define an agent with
{variable}placeholders in the system prompt and first message - Provide default values via the
variablesparameter - When a call comes in,
on_call_startlooks up the caller in a database - If found, return
{"variables": {...}}to override defaults for that specific call - Patter substitutes all placeholders before the conversation begins
- Inbound Agent — minimal inbound voice agent
- Custom LLM — bring your own LLM
- Production Setup — full production configuration
- Full documentation
- All templates
MIT