Skip to content

livekit-examples/outbound-caller-python

Repository files navigation

LiveKit logo

Python Outbound Call Agent

LiveKit Agents DocsLiveKit CloudBlog

This example demonstrates an full workflow of an AI agent that makes outbound calls. It uses LiveKit SIP and Python Agents Framework.

It has two modes:

  • VoicePipelineAgent: uses a voice pipeline of STT, LLM, and TTS for the call.
  • MultimodalAgent: uses OpenAI's realtime speech to speech model.

The guide for this example is available at https://docs.livekit.io/agents/quickstarts/outbound-calls/. Make sure a SIP outbound trunk is configured before trying this example.

Features

This example demonstrates the following features:

  • Making outbound calls
  • Detecting voicemail
  • Looking up availability via function calling
  • Detecting intent to end the call

Dev Setup

Clone the repository and install dependencies to a virtual environment:

cd outbound-caller-python
python3 -m venv venv
source venv/bin/activate
pip install -r requirements.txt
python agent.py download-files

Set up the environment by copying .env.example to .env.local and filling in the required values:

  • LIVEKIT_URL
  • LIVEKIT_API_KEY
  • LIVEKIT_API_SECRET
  • OPENAI_API_KEY
  • SIP_OUTBOUND_TRUNK_ID
  • DEEPGRAM_API_KEY - optional, only needed for VoicePipelineAgent

Run the agent:

python3 agent.py dev

Now, your worker is running, and waiting for dispatches in order to make outbound calls.

Making a call

You can dispatch an agent to make a call by using the lk CLI:

lk dispatch create \
  --new-room \
  --agent-name outbound-caller \
  --metadata '+1234567890'

About

An Agent that makes outbound calls using SIP and Dispatch APIs

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages