Voice Agents
AI agents that handle phone calls with natural speech.
Overview
Voice agents make and receive phone calls using AI. They use ElevenLabs for voice synthesis and Twilio for phone infrastructure.
Key Features
- Natural Conversation - Human-like voice and responses
- Outbound Calls - Agent calls customers
- Inbound Calls - Agent answers incoming calls
- Data Collection - Gather structured data during calls
- Call Transcripts - Full record of conversations
Prerequisites
Before creating voice agents, ensure you have:
- ElevenLabs API Key - For voice synthesis
- Twilio Credentials - For phone infrastructure (required for inbound calls)
- Phone Number - Imported from Twilio
Check prerequisites:
node bin/lux-cli/lux.js voice-agents statusCreating a Voice Agent
Via CLI
node bin/lux-cli/lux.js voice-agents create "Customer Support" \
--voice Rachel \
--prompt "You are a helpful customer support agent..."Available Options:
| Option | Description |
|---|---|
--voice <name> | Voice name (Rachel, Drew, Sarah, Paul, etc.) |
--prompt <text> | System prompt for the agent |
--prompt-file <path> | Read prompt from file |
--greeting <text> | First message when call starts |
--temperature <0-1> | Response creativity (default: 0.7) |
--max-duration <seconds> | Max call length (default: 600) |
Via Lux Studio
- Navigate to Agents → Voice Agents
- Click New Voice Agent
- Configure name, voice, and system prompt
- Save agent
Voice Selection
Available built-in voices:
| Voice | Description |
|---|---|
| Rachel | Female, professional |
| Drew | Male, casual |
| Sarah | Female, friendly |
| Paul | Male, authoritative |
| Clyde | Male, casual |
| Domi | Female, energetic |
| Dave | Male, conversational |
| Fin | Male, British |
| Antoni | Male, warm |
| Thomas | Male, calm |
Agent Configuration
System Prompt
Guide the agent's conversation behavior:
You are an appointment reminder assistant for Dr. Smith's office.
Your task:
1. Confirm the patient's appointment
2. Ask if they need to reschedule
3. Remind them to bring insurance card
Be friendly, professional, and concise. If they want to reschedule,
offer available times. If they're not the right person, apologize
and end the call politely.Greeting
The first message when the call connects:
Hi, this is calling from Dr. Smith's office. Am I speaking with {{customer_name}}?Data Collection
Define fields to collect during the call:
{
"dataCollection": [
{
"identifier": "confirmed",
"type": "boolean",
"description": "Whether patient confirmed the appointment"
},
{
"identifier": "reschedule_requested",
"type": "boolean",
"description": "Whether patient wants to reschedule"
},
{
"identifier": "preferred_time",
"type": "string",
"description": "Preferred reschedule time if requested"
}
]
}Field Format:
| Property | Type | Description |
|---|---|---|
identifier | string | Field name for the collected data |
type | string | string, number, or boolean |
description | string | What the AI should collect |
Built-in Tools
Enable agent capabilities:
{
"builtInTools": {
"endCall": true,
"transferCall": {
"enabled": true,
"phoneNumbers": ["+15551234567"]
},
"languageDetection": true
}
}Voice Settings
Fine-tune voice characteristics:
{
"ttsSettings": {
"stability": 0.5,
"similarityBoost": 0.75,
"speed": 1.0
}
}| Setting | Range | Description |
|---|---|---|
stability | 0-1 | Voice consistency |
similarityBoost | 0-1 | Match to original voice |
speed | 0.5-2 | Speaking rate |
Making Outbound Calls
Via Flow
Use the Voice Agent node:
Voice Agent
{
"id": "voice_agent-1",
"type": "voice_agent",
"label": "Appointment Call",
"config": {
"agentId": "agent_abc123",
"phoneNumberId": "pn_xyz789",
"to": "{{ $input.phone }}",
"dynamicVariables": {
"customer_name": "{{ $input.name }}",
"appointment_time": "{{ $input.appointmentTime }}"
}
}
}Via CLI
# List your agents
node bin/lux-cli/lux.js voice-agents list
# List phone numbers
node bin/lux-cli/lux.js voice-agents phonesInbound Calls
Setup Inbound Handling
- Create a voice agent
- Create a flow with
inbound_call_trigger - Configure the phone number:
# List Twilio numbers with webhook status
node bin/lux-cli/lux.js voice-agents twilio-numbers
# Configure phone for Lux-managed inbound
node bin/lux-cli/lux.js voice-agents configure-inbound +15551234567 <flow-id>Inbound Call Trigger
Inbound Call
{
"id": "inbound_call_trigger-1",
"type": "inbound_call_trigger",
"label": "Support Line",
"config": {
"phoneNumberId": "PNxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
"agentId": "agent_abc123"
}
}How Inbound Calls Work
- Call comes in to your Twilio number
- Trigger fires and connects caller to voice agent
- Workflow pauses while call is in progress
- After call ends, post-call data is sent via webhook
- Workflow resumes with transcript and collected data
Post-Call Data
After the call completes, these variables are available:
| Variable | Description |
|---|---|
{{ $input.transcript }} | Full conversation transcript |
{{ $input.data_collection_results }} | Collected data fields |
{{ $input.call_duration_secs }} | Call duration |
{{ $input.from }} | Caller's phone number |
Example: Log Inbound Call
{
"nodes": [
{
"id": "inbound_call_trigger-1",
"type": "inbound_call_trigger",
"config": {
"phoneNumberId": "PNxxx",
"agentId": "agent_abc"
}
},
{
"id": "table_insert-1",
"type": "table_insert",
"label": "Log Call",
"config": {
"tableName": "call_logs",
"fields": [
{ "column": "id", "value": "{{ $node.generate_uuid-1.id }}" },
{ "column": "caller", "value": "{{ $input.from }}" },
{ "column": "transcript", "value": "{{ $input.transcript }}" },
{ "column": "duration", "value": "{{ $input.call_duration_secs }}" }
]
}
}
]
}CLI Commands Reference
# Check prerequisites
node bin/lux-cli/lux.js voice-agents status
# List agents
node bin/lux-cli/lux.js voice-agents list
# Get agent details
node bin/lux-cli/lux.js voice-agents get <agent-id>
# Create agent
node bin/lux-cli/lux.js voice-agents create "Name" --voice Rachel --prompt "..."
# Update agent
node bin/lux-cli/lux.js voice-agents update <agent-id> --prompt "..."
# Delete agent
node bin/lux-cli/lux.js voice-agents delete <agent-id>
# List Twilio phone numbers
node bin/lux-cli/lux.js voice-agents twilio-numbers
# Configure inbound
node bin/lux-cli/lux.js voice-agents configure-inbound <phone> <flow-id>
# Check inbound status
node bin/lux-cli/lux.js voice-agents inbound-status <phone>
# Reset inbound configuration
node bin/lux-cli/lux.js voice-agents reset-inbound <phone>Best Practices
Prompt Design
- Keep responses short (phone conversations move fast)
- Handle interruptions gracefully
- Include fallbacks for unclear responses
- Define clear exit conditions
Testing
- Test with different scenarios
- Try edge cases (background noise, interruptions)
- Verify data collection works correctly
- Test call transfer if enabled
Error Handling
- Handle unanswered calls
- Manage voicemail detection
- Retry failed calls with backoff
See Also: