Cerebrium setup
Set up Cerebrium:- Sign up here
- Follow installation docs here
- Create a starter project:
This creates:
main.py
: Entrypoint filecerebrium.toml
: Build and environment configuration
cerebrium.toml
:
main.py
:
templates
folder with stream.xml
inside. This XML response tells Twilio to upgrade to a WebSocket connection:
cerebrium.toml
:
Twilio setup
Twilio provides cloud communications APIs for messaging, voice, video, and authentication. While we use Twilio for this demo, other providers work too. Sign up for a free account here. Purchase a local number (not toll-free) from the phone numbers page. Then set up a webhook to connect calls to your agent.

AI Agent Setup
Createbot.py
to set up the AI agent using PipeCat for component integration, interruption handling, and audio processing:
- Connects to WebSocket transport for audio I/O
- Sets up services:
- Uses Secrets for authentication
- Creates a customizable PipelineTask supporting:
- Image and Vision use cases (docs)
- Built-in interruption handling
- Easy model swapping
- Handles call events (join/leave) via webhooks
Deploy to Cerebrium
To deploy this app to Cerebrium you can simply run the command: cerebrium deploy in your terminal. If it deployed successfully, you should see something like this:
Scaling Pipecat
For scaling PipeCat on Cerebrium:- Use large CPU instances (10 CPUs, 8GB memory) for Twilio’s less than 1s response requirement
- Run concurrent PipeCat processes:
- Each process uses ~0.5 CPUs
- 10 CPU instance handles 20 concurrent calls
- Adjust based on traffic needs
replica_concurrency
setting to spawn new containers based on utilization, preventing cold starts for subsequent calls.
To make the two updates above you can update your cerebrium.toml to contain the following: