Pipecat
Connect AgentDuet to a Pipecat pipeline.
Use the pipecat-agentduet transport package.
What this integration provides
AgentDuetTransport transfers audio between an AgentDuet call and a Pipecat pipeline.
It also sends call events to the pipeline.
Your application opens a connection to AgentDuet and keeps it open. AgentDuet sends incoming calls through this connection. You do not need a public webhook endpoint or an ngrok tunnel for call delivery.
Key Features
- No Webhook Hosting: Public URLs, ngrok tunnels, and reverse proxies are not necessary.
- PCM audio: Uses mono 16-bit PCM at 8 kHz, 16 kHz, or 24 kHz. Manual format conversion is not necessary.
- Call events: Answers the call when the pipeline starts. Releases resources when the pipeline ends. Cancels tasks when the caller disconnects.
- Built-in Barge-in: Works with Pipecat’s VAD and turn processors to clear audio on interruption.
Prerequisites
- Python 3.12+
- An API key and connector UUID from agentduet.com
- A Deepgram API Key (for STT and TTS)
- A Google AI Studio API Key (for the Gemini LLM)
Step 1: Create a project folder
Step 2: Configure .env
Create a .env file in your project directory:
Step 3: Write voice_bot.py
Create voice_bot.py next to .env:
Step 4: Run the bot
Start your voice bot:
Call your AgentDuet phone number. The bot answers and greets you. Speak while it replies to test interruption handling.
Event Lifecycle
Register call lifecycle handlers on the AgentDuetTransport instance with @transport.event_handler(event_name):
Audio Architecture
AgentDuetTransport reads the audio configuration from the Call object.
It sets the pipeline input and output to the same format.
The format is mono 16-bit PCM at 8 kHz, 16 kHz, or 24 kHz.
Pipecat automatically converts sample rates between services. For example, it can convert between speech recognition and speech generation rates.
