Skip to content

mksinha01/agent-starter-embed

Repository files navigation

Voice AI Agent Starter Template Banner

๐ŸŽ™๏ธ Pipecat Voice AI Agent - Universal Template

A production-ready, framework-agnostic template for integrating Pipecat voice AI agents with any frontend

Docker Python License

Transform any web application into a voice-enabled AI assistant in minutes. This standardized template provides everything you need to integrate real-time voice conversations powered by Pipecat AI framework.


โญ Key Features

  • โœ… Frontend Agnostic: Works with React, Vue, Angular, Next.js, or vanilla JavaScript
  • โœ… Plug & Play AI Services: Easily swap STT, TTS, and LLM providers
  • โœ… Docker Ready: Full containerization for instant deployment
  • โœ… Production Tested: CORS, health checks, error handling, logging included
  • โœ… WebRTC Real-time: Low-latency voice communication via Daily.co
  • โœ… Well Documented: Comprehensive guides for customization and deployment
  • โœ… Example Integrations: React, Vue, and vanilla JS examples included

๐Ÿš€ Quick Start (5 Minutes)

Prerequisites

1. Clone & Setup

git clone <your-repo-url>
cd pipecat-voice-agent-template

# Copy environment template
cp backend/.env.example backend/.env

2. Configure API Keys

Edit backend/.env and add your keys:

DAILY_API_KEY=your_daily_api_key_here        # Required
DEEPGRAM_API_KEY=your_deepgram_key           # Speech-to-Text
CARTESIA_API_KEY=your_cartesia_key           # Text-to-Speech  
GOOGLE_API_KEY=your_google_key               # Language Model

Get API Keys:

3. Run with Docker (Recommended)

# Start both backend and frontend
docker-compose up -d

# View logs
docker-compose logs -f

# Stop
docker-compose down

Access your app:

4. Or Run Locally

Backend:

cd backend
pip install -r requirements.txt
python server.py

Frontend:

cd frontend
npm install
npm run dev

๏ฟฝ How to Use

With the Included Frontend (Next.js)

  1. Open http://localhost:3000
  2. Click "Enable Voice" button
  3. Start speaking - the AI will respond with voice!

Integrate with Your Own Frontend

// Step 1: Create a voice session
const response = await fetch('http://localhost:8001/create-room', {
  method: 'POST'
});
const { room_url, token } = await response.json();

// Step 2: Connect using Pipecat Client SDK
import { RTVIClient } from '@pipecat-ai/client-js';
import { DailyTransport } from '@pipecat-ai/daily-transport';

const client = new RTVIClient({
  transport: new DailyTransport(),
  params: { baseUrl: room_url },
  enableMic: true
});

await client.connect(token);

See detailed integration guides: docs/FRONTEND_INTEGRATION.md


๐ŸŽจ Customization

Swap AI Services

All AI services are configured in backend/bot.py. Mix and match providers:

# Change Speech-to-Text
from pipecat.services.assemblyai import AssemblyAISTTService
stt = AssemblyAISTTService(api_key=os.getenv("ASSEMBLYAI_API_KEY"))

# Change Text-to-Speech
from pipecat.services.elevenlabs import ElevenLabsTTSService
tts = ElevenLabsTTSService(
    api_key=os.getenv("ELEVENLABS_API_KEY"),
    voice_id="rachel"
)

# Change Language Model
from pipecat.services.openai import OpenAILLMService
llm = OpenAILLMService(
    api_key=os.getenv("OPENAI_API_KEY"),
    model="gpt-4"
)

Supported providers:

  • STT: Deepgram, AssemblyAI, Azure, Google, AWS Transcribe
  • TTS: Cartesia, ElevenLabs, Azure, Google, AWS Polly, OpenAI
  • LLM: Google Gemini, OpenAI GPT, Claude, Groq, Local (Ollama)

Full customization guide: docs/AI_SERVICE_CUSTOMIZATION.md

Replace the Frontend

This template works with any frontend framework:

  1. Keep the backend as-is (it's framework-agnostic)
  2. Replace /frontend with your React/Vue/Angular/etc. app
  3. Integrate using the REST API - See examples:

๐Ÿ“ Repository Structure

pipecat-voice-agent-template/
โ”œโ”€โ”€ backend/                    # Python FastAPI + Pipecat
โ”‚   โ”œโ”€โ”€ bot.py                 # Voice AI agent configuration
โ”‚   โ”œโ”€โ”€ server.py              # REST API server
โ”‚   โ”œโ”€โ”€ requirements.txt       # Python dependencies
โ”‚   โ”œโ”€โ”€ Dockerfile             # Backend container
โ”‚   โ””โ”€โ”€ .env.example           # Environment variables template
โ”‚
โ”œโ”€โ”€ frontend/                   # Next.js frontend (swappable!)
โ”‚   โ”œโ”€โ”€ src/
โ”‚   โ”‚   โ”œโ”€โ”€ components/
โ”‚   โ”‚   โ”‚   โ””โ”€โ”€ ChatInterface.tsx
โ”‚   โ”‚   โ””โ”€โ”€ app/
โ”‚   โ”œโ”€โ”€ package.json
โ”‚   โ””โ”€โ”€ Dockerfile
โ”‚
โ”œโ”€โ”€ docs/                       # Documentation
โ”‚   โ”œโ”€โ”€ FRONTEND_INTEGRATION.md     # How to integrate any frontend
โ”‚   โ”œโ”€โ”€ AI_SERVICE_CUSTOMIZATION.md # How to swap AI services
โ”‚   โ””โ”€โ”€ DEPLOYMENT.md               # Production deployment guide
โ”‚
โ”œโ”€โ”€ examples/                   # Example integrations
โ”‚   โ”œโ”€โ”€ react-example/
โ”‚   โ”œโ”€โ”€ vue-example/
โ”‚   โ””โ”€โ”€ vanilla-js-example/
โ”‚
โ”œโ”€โ”€ docker-compose.yml         # Multi-container orchestration
โ””โ”€โ”€ README.md                  # This file

๐Ÿ—๏ธ Architecture

โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”          โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚  Any Frontend   โ”‚โ—„โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ–บโ”‚  FastAPI Server  โ”‚
โ”‚  (React/Vue/JS) โ”‚  REST APIโ”‚  (Backend)       โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜          โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
        โ”‚                             โ”‚
        โ”‚ WebRTC (Daily.co)          โ”‚
        โ–ผ                             โ–ผ
โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”          โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚ Pipecat Client  โ”‚โ—„โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ–บโ”‚  Pipecat Bot     โ”‚
โ”‚ (Browser SDK)   โ”‚          โ”‚  (Python)        โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜          โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
                                      โ”‚
                                      โ–ผ
                            โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
                            โ”‚  AI Services     โ”‚
                            โ”‚  โ€ข STT (Deepgram)โ”‚
                            โ”‚  โ€ข TTS (Cartesia)โ”‚
                            โ”‚  โ€ข LLM (Gemini)  โ”‚
                            โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜

Key Components:

  1. Backend Server (server.py): REST API for room creation and health checks
  2. Pipecat Bot (bot.py): Voice AI agent with STT โ†’ LLM โ†’ TTS pipeline
  3. Frontend: Any web app that can make HTTP requests and use WebRTC
  4. Daily.co: WebRTC infrastructure for real-time audio streaming

๐Ÿ“š Documentation

Guide Description
Frontend Integration Integrate with React, Vue, Angular, vanilla JS
AI Service Customization Swap STT, TTS, LLM providers
Deployment Guide Deploy to AWS, GCP, Azure, Railway, Render

๐ŸŽฏ Use Cases

Perfect for building:

  • ๐Ÿ“ž Voice Customer Support Bots
  • ๐ŸŽ“ Educational Voice Assistants
  • ๐Ÿฅ Healthcare Virtual Assistants
  • ๐Ÿช E-commerce Voice Shopping
  • ๐ŸŽฎ Gaming Voice NPCs
  • ๐Ÿ“ฑ Mobile App Voice Features
  • ๐ŸŒ Website Voice Interfaces

๐Ÿšข Deployment

Quick Deploy Options

  • Railway: One-click Docker deployment
  • Render: Auto-deploy from GitHub
  • AWS ECS/Fargate: Production-scale containers
  • Google Cloud Run: Serverless containers
  • Azure Container Apps: Multi-container support

See docs/DEPLOYMENT.md for detailed guides.


๏ฟฝ API Reference

POST /create-room

Creates a Daily.co room and starts a bot instance.

Response:

{
  "room_url": "https://your-domain.daily.co/room-name",
  "room_name": "room-name",
  "token": "user-access-token"
}

GET /health

Health check endpoint.

GET /test-daily

Tests Daily.co API configuration.


๐Ÿค Contributing

Contributions are welcome! Please:

  1. Fork this repository
  2. Create a feature branch (git checkout -b feature/amazing-feature)
  3. Commit your changes (git commit -m 'Add amazing feature')
  4. Push to the branch (git push origin feature/amazing-feature)
  5. Open a Pull Request

๐Ÿ“„ License

MIT License - Use this template freely for commercial and personal projects.


๐Ÿ™ Acknowledgments


๐Ÿ“ž Support


โญ Star This Repo!

If this template helps you build amazing voice AI applications, please star the repository!


Built with โค๏ธ using Pipecat and Daily.co

About

No description, website, or topics provided.

Resources

License

Contributing

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 10