Agents
Voice Agents

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:

  1. ElevenLabs API Key - For voice synthesis
  2. Twilio Credentials - For phone infrastructure (required for inbound calls)
  3. Phone Number - Imported from Twilio

Check prerequisites:

node bin/lux-cli/lux.js voice-agents status

Creating 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:

OptionDescription
--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

  1. Navigate to AgentsVoice Agents
  2. Click New Voice Agent
  3. Configure name, voice, and system prompt
  4. Save agent

Voice Selection

Available built-in voices:

VoiceDescription
RachelFemale, professional
DrewMale, casual
SarahFemale, friendly
PaulMale, authoritative
ClydeMale, casual
DomiFemale, energetic
DaveMale, conversational
FinMale, British
AntoniMale, warm
ThomasMale, 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:

PropertyTypeDescription
identifierstringField name for the collected data
typestringstring, number, or boolean
descriptionstringWhat 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
  }
}
SettingRangeDescription
stability0-1Voice consistency
similarityBoost0-1Match to original voice
speed0.5-2Speaking 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 phones

Inbound Calls

Setup Inbound Handling

  1. Create a voice agent
  2. Create a flow with inbound_call_trigger
  3. 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

  1. Call comes in to your Twilio number
  2. Trigger fires and connects caller to voice agent
  3. Workflow pauses while call is in progress
  4. After call ends, post-call data is sent via webhook
  5. Workflow resumes with transcript and collected data

Post-Call Data

After the call completes, these variables are available:

VariableDescription
{{ $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: