Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

History

103 Commits

Repository files navigation

Python Voice Agent Examples

A collection of production-ready voice AI agent examples built with Plivo. Each example demonstrates a different combination of AI models and frameworks for building real-time phone-based voice agents on the Plivo voice AI platform.

How It Works

All examples follow the same general pattern:

┌─────────┐ ┌─────────────┐ ┌─────────────┐ ┌─────────────┐
│ Phone │────▶│ Plivo │────▶│ Server │────▶│ AI Agent │
│ Call │◀────│ (Voice AI) │◀────│ (FastAPI) │◀────│ │
└─────────┘ └─────────────┘ └─────────────┘ └─────────────┘
  1. A phone call comes in (or is initiated) through Plivo
  2. Plivo hits a webhook on your FastAPI server
  3. The server establishes a bidirectional WebSocket for audio streaming
  4. The AI agent processes speech and generates responses in real-time

Examples

Each example directory is self-contained with its own dependencies, environment configuration, and documentation. Directory names follow the convention {llm}-{stt}-{tts}-{framework} (see CONTRIBUTING.md for details).

Speech-to-Speech (S2S)

These examples use models that handle both speech input and output natively — the simplest architecture with the fewest moving parts.

ExampleModelFrameworkHighlights
gemini2.5-live-nativeGemini 2.5 LiveNoneDirect API integration, function calling, auto-webhook config
gemini2.5-live-pipecatGemini 2.5 LivePipecatModular pipeline, built-in VAD, less code
gptrealtime1.5-nativeGPT Realtime 1.5NoneSilero VAD, barge-in support, function calling
grok3-voice-nativeGrok 3 VoiceNoneSilero VAD, barge-in support, function calling

STT + LLM + TTS Pipeline

These examples wire up separate providers for speech-to-text, language model, and text-to-speech — offering more flexibility to mix and match.

ExampleSTTLLMTTSFramework
gemini2-deepgramnova2-cartesiasonic2-nativeDeepgram Nova 2Gemini 2Cartesia Sonic 2None
gemini2-deepgramnova2-elevenflashv2.5-nativeDeepgram Nova 2Gemini 2ElevenLabs Flash v2.5None
gpt4o-deepgramnova3-openaitts4o-pipecatDeepgram Nova 3GPT-4oOpenAI TTS 4oPipecat
gpt5.4-assemblyaiu3-cartesiasonic3-nativeAssemblyAI U3GPT 5.4Cartesia Sonic 3None
daily-plivoDeepgramOpenAICartesiaPipecat + Daily

Prerequisites

  • Python 3.10+ (3.12 recommended)
  • uv package manager (recommended) or pip
  • ngrok for local development
  • A Plivo account with a phone number
  • API keys for the AI services used by your chosen example

Quick Start

  1. Choose an example from the tables above and navigate to its directory:

    cd gemini2.5-live-native # or any other example
  2. Install dependencies:

    uv sync
    # or: uv pip install -r requirements.txt
  3. Configure environment variables:

    cp .env.example .env

    Edit .env with your API keys and Plivo credentials.

  4. Start ngrok (in a separate terminal):

    ngrok http 8000 # port varies by example
  5. Update PUBLIC_URL in .env with your ngrok HTTPS URL.

  6. Run the server:

    uv run python server.py # entry point varies by example
  7. Call your Plivo phone number to talk to the agent.

See each example's README for detailed setup and configuration.

Contributing

Want to add a new voice agent example? See CONTRIBUTING.md for the project naming convention, required structure, and submission guidelines.

License

MIT

About

No description, website, or topics provided.

Resources

Contributing

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Used by

Contributors

Languages