Files · Anthropic Voice Agent for Calendly Appointment Booking
46 (0 binary, 298.5 kB total)attempt 4
README.md·2437 B·markdown
markdown
# Anthropic Voice Agent for Calendly Appointment Booking
A voice assistant that uses Calendly's API to seamlessly schedule appointments, handling natural language availability queries and booking conflicts.
## Overview
This recipe combines `@reaatech/confidence-router` for intent classification and dialog state management, `@reaatech/agent-handoff` for smooth transfer to human receptionists, and `@reaatech/agent-budget-engine` to control LLM costs. The voice pipeline uses Anthropic's models via LiveKit Agents, with custom glue routing calls to Calendly's REST API for real-time availability lookups and booking.
## Architecture
```
Twilio Voice Call
|
v
LiveKit Room (WebRTC)
|
v
LiveKit Agent Worker
|-- Deepgram STT (speech-to-text)
|-- Anthropic LLM (Claude Sonnet 4.6)
|-- Cartesia TTS (text-to-speech)
|
v
Intent Router (ConfidenceRouter)
|
v
Calendly REST API
|
v
Budget Engine / Handoff Manager
```
## Setup
1. Copy `.env.example` to `.env` and fill in all required values.
2. Install dependencies: `pnpm install`
3. Run typecheck: `pnpm typecheck`
4. Run tests: `pnpm test`
5. Start server: `node dist/server.js`
## Environment Variables
| Variable | Required | Description |
|----------|----------|-------------|
| `ANTHROPIC_API_KEY` | Yes | Anthropic API key |
| `CALENDLY_API_KEY` | Yes | Calendly API key |
| `LIVEKIT_API_KEY` | Yes | LiveKit API key |
| `LIVEKIT_API_SECRET` | Yes | LiveKit API secret |
| `LIVEKIT_URL` | Yes | LiveKit server URL |
| `DEEPGRAM_API_KEY` | Yes | Deepgram API key |
| `CARTESIA_API_KEY` | Yes | Cartesia API key |
| `TWILIO_ACCOUNT_SID` | Yes | Twilio account SID |
| `TWILIO_AUTH_TOKEN` | Yes | Twilio auth token |
| `TWILIO_PHONE_NUMBER` | No | Twilio phone number |
| `HUMAN_RECEPTIONIST_PHONE` | No | Human transfer number |
| `APP_LOG_LEVEL` | No | Log level (default: info) |
| `AGENT_BUDGET_LIMIT_USD` | No | Budget limit USD (default: 10) |
| `PORT` | No | Server port (default: 3000) |
## Testing
Run the test suite with coverage:
```bash
pnpm test
```
## Production Deployment
- Use LiveKit Cloud or self-hosted LiveKit server.
- Configure Twilio SIP trunk and incoming phone number webhook to `/voice-incoming`.
- Place the Express server behind a TLS-terminating reverse proxy for webhook security.
- Swap the in-memory `SpendStore` for a persistent database-backed implementation (e.g., Redis or Postgres).