A telephone-based conversational agent built with Pipecat, powered by Google's Gemini APIs and Twilio. This bot plays "Two Truths and a Lie". The bot will provide three statements and you have to guess which one is false.
Learn how to run and deploy these bots on Pipecat Cloud.
Call 1-970-LIVE-API (1-970-548-3274) to talk to a Gemini Live Pipecat bot over the phone.
- Python 3.10 or later
- uv package manager installed
You'll need API keys for the following services:
- Gemini LLMs: Live API and Text completions
- Google STT & TTS for Speech-to-Text and Text-to-Speech
- Twilio for phone calling
💡 Tip: Sign up these services. You'll need them for both local and cloud deployment.
-
Clone this repository
git clone https://github.com/daily-co/pcc-gemini-twilio.git cd pcc-gemini-twilio -
Configure your API keys:
Create a
.envfile:cp env.example .env
Then, add your API keys:
GOOGLE_API_KEY= GOOGLE_CREDENTIALS_PATH=./credentials.json TWILIO_ACCOUNT_SID= TWILIO_AUTH_TOKEN=
If you're running bot-cascade.py, you'll need to add a
credentials.jsonfile containing your Google Service Account credentials. -
Set up a virtual environment and install dependencies
uv sync
For local development, we'll use Pipecat's P2P WebRTC transport, SmallWebRTCTransport. This transports is free to run and allows for faster iteration for development and testing.
Run the bot using:
uv run bot.pyOpen http://localhost:7860 in your browser and click Connect to start talking to your bot.
💡 First run note: The initial startup may take ~20 seconds as Pipecat downloads required models and imports.
Transform your local bot into a production-ready service. Pipecat Cloud handles scaling, monitoring, and global deployment.
-
Set up Docker for building your bot image:
-
Install Docker on your system
-
Create a Docker Hub account
-
Login to Docker Hub:
docker login
-
-
Log in with the
pipecatcloudCLI (installed with the project) is used to manage your deployment and secrets.uv run pcc auth login
Tip: Use the CLI with the
pcccommand alias.
-
Purchase a phone number from Twilio, if you haven't already. Ensure the number has voice capabilities.
-
Retrieve your Pipecat Cloud organization name using the pipecatcloud CLI. This information is required when creating the TwiML configuration.
pcc organizations list
-
Create a TwiML Bin with the following configuration:
<?xml version="1.0" encoding="UTF-8"?> <Response> <Connect> <Stream url="wss://api.pipecat.daily.co/ws/twilio"> <Parameter name="_pipecatCloudServiceHost" value="AGENT_NAME.ORGANIZATION_NAME"/> </Stream> </Connect> </Response>
Replace the placeholder values:
AGENT_NAMEwith your deployed bot’s name (e.g., my-first-agent)ORGANIZATION_NAMEwith your organization name from step 2
For example, if your agent is named “pcc-gemini-twilio” and your organization is “industrious-purple-cat-123”, your value would be: pcc-gemini-twilio.industrious-purple-cat-123
-
Assign the TwiML Bin to your Twilio phone number:
- Navigate to the "Phone Numbers" section in your Twilio dashboard (Phone Numbers > Manage > Active numbers)
- Select your phone number from the list
- In the "Configure" tab, under “Voice Configuration” section, find “A call comes in”
- Set this dropdown to “TwiML Bin”
- Select the "TwiML Bin" you created in step 3
- Click Save to apply your changes
The pcc-deploy.toml file tells Pipecat Cloud how to run your bot. Update the image field with your Docker Hub username by editing pcc-deploy.toml.
agent_name = "pcc-gemini-twilio"
image = "YOUR_DOCKERHUB_USERNAME/pcc-gemini-twilio:0.1" # 👈 Update this line
secret_set = "pcc-gemini-twilio-secrets"
[scaling]
min_agents = 1Understanding the TOML file settings:
agent_name: Your bot's name in Pipecat Cloudimage: The Docker image to deploy (format:username/image:version)secret_set: Where your API keys are stored securelymin_agents: Number of bot instances to keep ready (1 = instant start)
💡 Tip: Set up
image_credentialsin your TOML file for authenticated image pulls
Upload your API keys to Pipecat Cloud's secure storage:
uv run pcc secrets set pcc-gemini-twilio-secrets --file .envThis creates a secret set called pcc-gemini-twilio-secrets (matching your TOML file) and uploads all your API keys from .env.
Build your Docker image and push to Docker Hub:
uv run pcc docker build-pushDeploy to Pipecat Cloud:
uv run pcc deployCall the Twilio number you set up earlier to speak with your bot! 🚀
- 🔧 Customize your bot: Modify
bot.pyto change personality, add functions, or integrate with your data - 📚 Learn more: Check out Pipecat's docs for advanced features
- ⚙️ Provide custom data: Learn how to provide custom data to your bot at run time
- 💬 Get help: Join Pipecat's Discord to connect with the community