AI Voice Outbound Agent

Build with Retell AI & Sesame CSM-1B Model

Step-by-Step Guide

Follow these steps to create your AI voice outbound agent using the latest technologies.

1

Environment Setup

Install the required Python libraries for the Retell AI integration.

pip install retell-ai aiohttp
Python 3.8+ required
2

Retell AI Authentication

Authenticate with your Retell AI API key.

import retell

client = retell.Client(api_key="your_api_key")
Get API key from Retell dashboard
3

Agent Behavior

Define your agent's persona and conversation flow.

agent_config = {
    "initial_message": "Hello, this is Alex from Customer Support.",
    "voice": "male-1",
    "persona": "friendly and professional"
}
Customize as needed
4

Sesame AI Integration

Configure the agent to use CSM-1B model.

agent_config["llm"] = {
    "model": "csm-1b",
    "provider": "sesame"
}
Latest Sesame AI model
5

Outbound Call

Initiate the call with recipient's phone number.

response = client.calls.create(
    phone_number="+15551234567",
    agent_config=agent_config
)
E.164 format required
6

Call Events

Handle call events and responses.

@client.on("call.connected")
async def handle_connected(call):
    print(f"Call connected: {call.id}")

@client.on("agent.response")
async def handle_response(response):
    print(f"Agent said: {response.text}")
Register event handlers

Complete Example

Here's the full implementation you can use as a starting point.

import asyncio
import retell

# Initialize client with your API key
client = retell.Client(api_key="your_api_key_here")

# Configure your agent
agent_config = {
    "initial_message": "Hello, this is Alex calling from Customer Support.",
    "voice": "male-1",
    "persona": "friendly and professional",
    "llm": {
        "model": "csm-1b",
        "provider": "sesame"
    }
}

# Event handlers
@client.on("call.connected")
async def handle_connected(call):
    print(f"Call {call.id} connected to {call.phone_number}")

@client.on("agent.response")
async def handle_response(response):
    print(f"Agent response: {response.text}")

@client.on("call.ended")
async def handle_ended(call):
    print(f"Call {call.id} ended")

async def make_call():
    try:
        # Start the call
        response = await client.calls.create(
            phone_number="+15551234567",  # Replace with actual number
            agent_config=agent_config
        )
        print(f"Call initiated: {response.id}")
    except Exception as e:
        print(f"Error making call: {e}")

# Run the call
asyncio.run(make_call())

Potential Issues & Solutions

!

API Key Errors

Ensure your API key is correct and has proper permissions. Rotate keys if needed.

!

Phone Number Format

Use E.164 format (+[country code][number]) for phone numbers.

!

Model Not Available

Check Retell AI documentation for latest supported models if CSM-1B isn't available.

Ready to Build Your AI Agent?

Sign up on Retell AI to get started with the Sesame CSM-1B model today.

Visit Retell AI

Made with DeepSite LogoDeepSite - 🧬 Remix