Skip to content
reaatechREAATECH

Files · OpenRouter Voice Agent for Cal.com Appointment Scheduling

74 (1 binary, 621.7 kB total)attempt 1

README.md·2173 B·markdown
markdown
# OpenRouter Voice Agent for Cal.com Appointment Scheduling
 
> Let callers book, reschedule, or cancel Cal.com appointments through a conversational voice agent that uses any LLM via OpenRouter.
 
A reference solution demonstrating how to build a voice-enabled appointment scheduling agent. The system uses Twilio Media Streams for telephony, Deepgram for speech-to-text, ElevenLabs for text-to-speech, and OpenRouter for LLM access — all coordinated by the `@reaatech/voice-agent-core` pipeline.
 
## Architecture
 
```
Twilio Call → WebSocket → TwilioMediaStreamHandler → Deepgram STT 
  → Intent Classifier (ConfidenceRouter + OpenRouter LLM)
  → Cal.com REST API (create/reschedule/cancel bookings)
  → ElevenLabs TTS → Twilio Media Stream → Caller hears response
```
 
Each LLM call is budget-checked via `@reaatech/agent-budget-engine` and traced via Langfuse.
 
## Setup
 
1. Configure environment variables in `.env`:
   - `OPENROUTER_API_KEY` — from [OpenRouter keys](https://openrouter.ai/keys)
   - `DEEPGRAM_API_KEY` — from [Deepgram console](https://console.deepgram.com)
   - `ELEVENLABS_API_KEY` — from [ElevenLabs settings](https://elevenlabs.io/speech-synthesis)
   - `CALCOM_CLIENT_ID` + `CALCOM_CLIENT_SECRET` — create an OAuth client in Cal.com admin
2. Start the dev server: `pnpm dev`
3. Configure your Twilio phone number's Media Streams to point at `wss://your-domain.com/api/voice`
4. Optionally configure Cal.com webhooks to `https://your-domain.com/api/calcom/webhook`
 
## Running locally
 
```bash
pnpm test            # vitest run with coverage
pnpm dev             # next dev
pnpm typecheck       # TypeScript check
pnpm lint            # ESLint check
```
 
## Project layout
 
```
app/api/voice/route.ts       Twilio Media Streams WebSocket handler
app/api/calcom/webhook/route.ts  Cal.com webhook receiver
app/api/health/route.ts       Health check endpoint
src/services/                 Pipeline, speech, intent, Cal.com, budget, observability
src/lib/                      Config, types, Cal.com API client
tests/                        Vitest suite (unit + integration)
```
 
## License
 
MIT — see [LICENSE](./LICENSE).