A real-time voice AI agent application that participates in complimentary rap battles. Unlike traditional rap battles, this agent specializes in delivering kind, uplifting compliments and praise through creative wordplay, metaphors, and rhythmic flow. Battle your opponent with kindness - the goal is to out-compliment them!
This project demonstrates a LiveKit-powered voice agent that engages in positive rap battles with two modes:
- Attack Mode: The agent delivers uplifting compliments immediately with genuine enthusiasm and positivity
- Protect Mode: The agent listens to your compliments first, then responds with even more heartfelt appreciation
The agent uses natural voice interaction, maintaining a warm, encouraging style while keeping verses concise and under 20 seconds for quick-fire rounds of kindness.
The application consists of three main services:
- Web Service (
services/web/): Next.js frontend with LiveKit integration for real-time voice communication - Agent Service (
services/agent/): Python-based voice AI agent using LiveKit Agents framework - Nginx: Reverse proxy for routing requests only used in production for SSL certificates
Frontend:
- Next.js with TypeScript
- React Components for UI
- LiveKit Client SDK
Agent:
- Python 3.13+
- LiveKit Agents SDK
- Docker and Docker Compose
- LiveKit account and credentials (Get started)
git clone <repository-url>
cd voice-agent-templateCopy the example environment file:
cp .env.example .envEdit .env and add your LiveKit credentials:
LIVEKIT_API_KEY=your_api_key_here
LIVEKIT_API_SECRET=your_api_secret_here
LIVEKIT_URL=wss://your-project.livekit.cloudDevelopment Mode:
docker-compose -f docker-compose.yml -f docker-compose.dev.yml upThe web interface will be available at http://localhost:3000
Once the application is running:
- Join a Room: Connect to the voice session through the web interface
- Choose Your Mode:
- Attack: Click the attack button to have the agent deliver compliments to you
- Protect: Click the protect button, then share your compliments - the agent will listen and respond
- Add Custom Instructions: Optionally provide specific themes or instructions for the agent's compliments
This project uses GitHub Actions for automated deployment to a production server. The deployment process is designed for workshop participants at TechSpot week.
This agent was originally created for the AI Agents TechSpot workshop happening in Warsaw on October 15th. If you're a workshop participant and need a server for deployment, you can ask the organizers for a promo code to get a free server from our hosting partner is*hosting.
- Workshop Details: https://onthespotdev.com/techspot/ai-agents-techpot-uhub
- Hosting Partner: https://ishosting.com/
Before deploying, you need to configure the following secrets in your GitHub repository (Settings → Secrets and variables → Actions):
SERVER_IP: Your server's IP addressSERVER_PASSWORD: Your server's root password
CR_PAT: GitHub Personal Access Token (classic) withread:packagesandwrite:packagespermissions- Create one here: GitHub Personal Access Tokens
- Note: Author prefers using a classic token for easier setup
LIVEKIT_URL: Your LiveKit server URL (e.g.,wss://your-project.livekit.cloud)LIVEKIT_API_KEY: Your LiveKit API keyLIVEKIT_API_SECRET: Your LiveKit API secret
Important: Use separate LiveKit projects (with different API keys) for development and production environments. This prevents interference between environments and makes debugging easier.
Run the "Setup Server" workflow manually to configure your server with Docker, Docker Compose, and other dependencies:
- Go to Actions tab in your GitHub repository
- Select Setup Server workflow
- Click Run workflow
- Wait for the setup to complete (typically 5-10 minutes)
This workflow will:
- Install Docker and Docker Compose
- Configure swap space
- Initialize Docker Swarm
- Log in to GitHub Container Registry
- Create project directories
Deployment happens automatically on every push to the main branch:
git push origin mainThe deployment workflow will:
- Build Docker images for all services (agent, web, nginx)
- Push images to GitHub Container Registry
- Deploy the stack to your production server
- Configure SSL certificates via Nginx
Check the deployment status in the Actions tab of your GitHub repository. The deployment typically takes 5-10 minutes.
The production deployment uses:
- Docker Swarm for orchestration
- GitHub Container Registry for image storage
- Nginx as reverse proxy with self-signed SSL support
- Separate environment configurations for each service
This project is licensed under the MIT License - see the LICENSE file for details.