{"id":49165713,"url":"https://github.com/mj-deving/voice-agent","last_synced_at":"2026-04-22T15:03:59.546Z","repository":{"id":351316198,"uuid":"1207633661","full_name":"mj-deving/voice-agent","owner":"mj-deving","description":"AI phone agent for medical practices — appointment booking, emergency detection, call routing. 156 tests, deployed on Fly.io. Python, FastAPI, Vapi.","archived":false,"fork":false,"pushed_at":"2026-04-22T06:41:33.000Z","size":68,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2026-04-22T08:32:43.072Z","etag":null,"topics":["ai-agents","fastapi","python","telephony","vapi","voice-ai"],"latest_commit_sha":null,"homepage":null,"language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/mj-deving.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2026-04-11T07:26:51.000Z","updated_at":"2026-04-22T06:41:37.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/mj-deving/voice-agent","commit_stats":null,"previous_names":["mj-deving/voice-agent"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/mj-deving/voice-agent","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mj-deving%2Fvoice-agent","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mj-deving%2Fvoice-agent/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mj-deving%2Fvoice-agent/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mj-deving%2Fvoice-agent/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mj-deving","download_url":"https://codeload.github.com/mj-deving/voice-agent/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mj-deving%2Fvoice-agent/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32141504,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-22T14:31:12.705Z","status":"ssl_error","status_checked_at":"2026-04-22T14:27:43.037Z","response_time":58,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["ai-agents","fastapi","python","telephony","vapi","voice-ai"],"created_at":"2026-04-22T15:03:58.589Z","updated_at":"2026-04-22T15:03:59.535Z","avatar_url":"https://github.com/mj-deving.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Voice Agent — Praxis Dr. Müller\n\n![FastAPI](https://img.shields.io/badge/-FastAPI-009688?style=flat-square) ![Vapi](https://img.shields.io/badge/-Vapi-7C3AED?style=flat-square) ![Python](https://img.shields.io/badge/-Python-3776AB?style=flat-square) ![Docker](https://img.shields.io/badge/-Docker-2496ED?style=flat-square)\n\n**AI phone agent for medical practices — answers calls in German, books appointments with availability checking, detects emergencies, transfers calls, and adapts greetings to holidays and office hours.** Multi-practice support via YAML config. 156 tests, analytics dashboard, 5/5 live scenarios passed.\n\n## Table of Contents\n\n- [Quick Start](#quick-start)\n- [What It Does](#what-it-does)\n- [Architecture](#architecture)\n- [Project Structure](#project-structure)\n- [Live Vapi Call Results](#live-vapi-call-results)\n- [Configuration](#configuration)\n- [Multi-Practice Support](#multi-practice-support)\n- [Holiday \u0026 Hours-Aware Greetings](#holiday--hours-aware-greetings)\n- [Analytics Dashboard](#analytics-dashboard)\n- [Setup](#setup)\n- [Deployment](#deployment)\n- [Tests](#tests)\n- [Tech Stack](#tech-stack)\n- [Costs (Verified)](#costs-verified)\n\n## Prerequisites\n\n- Python 3.12+\n- [Vapi.ai](https://vapi.ai) account (Free Tier, $10 credits)\n- [ngrok](https://ngrok.com) or similar tunnel for local development\n- Anthropic API access (via Vapi — no separate key needed)\n- Docker (optional, for deployment)\n\n## Quick Start\n\n```bash\n# 1. Setup\npython3 -m venv venv\nsource venv/bin/activate\npip install -r requirements.txt\n\n# 2. Configure\ncp .env.example .env  # then fill in your keys\n\n# 3. Create Vapi Assistant\npython scripts/setup_vapi.py --webhook-url https://your-tunnel.ngrok.io\n\n# 4. Start webhook server\npython src/main.py\n```\n\n## What It Does\n\nLisa, the AI assistant for Dr. Sarah Müller's practice, answers incoming calls in German:\n\n- Greets callers context-aware (holiday / outside hours / normal) and asks for their concern\n- Distinguishes new and existing patients\n- Books appointments with availability checking (`book_appointment`) — suggests alternatives when slots are taken\n- Transfers calls to the practice for prescriptions/referrals (`transfer_call`) — real phone transfer via Vapi\n- Detects emergencies and immediately recommends calling 112\n- Sends call summaries to the practice team via email and/or webhook (`send_summary`)\n- Answers questions about office hours and address\n\n## Architecture\n\n```mermaid\nflowchart TD\n    A[\"📞 Incoming Call\"] --\u003e B\n\n    subgraph VAPI[\"Vapi Agent — Lisa\"]\n        B[\"STT · Claude Sonnet 4 · ElevenLabs TTS\"]\n        B --\u003e C{\"Tool Call?\"}\n    end\n\n    C -- \"book_appointment\\ntransfer_call\\nsend_summary\" --\u003e D\n\n    subgraph SERVER[\"FastAPI Server\"]\n        D[\"/api/vapi/webhook\"] --\u003e E[\"HMAC Verify\"]\n        E --\u003e F[\"Route Tool Call\"]\n        F --\u003e G[\"📅 Check Availability\\n\u0026 Book Appointments\"]\n        F --\u003e H[\"📲 Transfer Call (SIP)\"]\n        F --\u003e I[\"📧 Notify Team\\n(Email / Webhook)\"]\n        F --\u003e J[\"📝 Log to JSONL\"]\n    end\n\n    G --\u003e K[\"Response String (German)\"]\n    H --\u003e K\n    I --\u003e K\n    K --\u003e B\n    B --\u003e L[\"🔊 Caller hears response\"]\n\n    subgraph ANALYTICS[\"Analytics\"]\n        J --\u003e M[\"GET /api/analytics\"]\n        M --\u003e N[\"📊 Dashboard\\n(Chart.js)\"]\n    end\n```\n\n## Project Structure\n\n```\nvoice-agent/\n├── src/\n│   ├── main.py              # Entry point — starts webhook server\n│   ├── agent_config.py      # System prompt, tools, voice/model config (YAML-driven)\n│   ├── webhook_server.py    # FastAPI server for Vapi tool calls + analytics API\n│   ├── analytics.py         # Call log analytics (KPIs, charts data)\n│   ├── holidays.py          # German holiday detection + office hours check\n│   ├── webhook_auth.py      # HMAC-SHA256 signature verification middleware\n│   ├── availability.py      # Appointment slot checking \u0026 booking\n│   ├── notifications.py     # Email (SMTP) + webhook notification dispatch\n│   └── call_logger.py       # JSONL call logging\n├── scripts/\n│   ├── setup_vapi.py        # Automated Vapi assistant + tools + phone setup\n│   └── test_call.py         # Trigger test calls for 5 scenarios\n├── configs/\n│   ├── scenarios.yaml       # 5 test scenarios (appointment, prescription, emergency, etc.)\n│   ├── availability.yaml    # Office hours, holidays, slot duration, bookings path\n│   ├── praxis_template.yaml # Base template for new practice configs\n│   └── examples/            # Example practice configs (Mueller, Schmidt, Weber)\n├── static/\n│   └── dashboard.html       # Call analytics dashboard (Chart.js)\n├── tests/                   # 156 tests\n│   ├── test_agent_config.py # Agent configuration (42 tests)\n│   ├── test_analytics.py    # Call analytics (19 tests)\n│   ├── test_holidays.py     # Holiday detection + greetings (29 tests)\n│   ├── test_webhook.py      # Webhook endpoints (22 tests)\n│   ├── test_availability.py # Availability system (23 tests)\n│   ├── test_notifications.py# Notification dispatch (12 tests)\n│   └── test_webhook_auth.py # HMAC auth + transfer (9 tests)\n├── data/\n│   ├── call_log.jsonl       # Call event log (auto-created)\n│   └── bookings.json        # Booked appointments (auto-created)\n├── Dockerfile               # Production container\n├── fly.toml                 # Fly.io deployment config\n└── docker-compose.yml       # Local Docker deployment\n```\n\n## Live Vapi Call Results\n\nVerified with live Vapi calls on 2026-04-14. Assistant \"Lisa\" (ID: `2f93f394`) on Vapi Free Tier.\n\n| # | Scenario | Caller | Expected Action | Result | Notes |\n|---|----------|--------|----------------|--------|-------|\n| 1 | New patient, back pain | Thomas Schneider | `book_appointment` | PASS | Appointment booked, new patient recognized |\n| 2 | Existing patient, prescription | Maria Weber | `transfer_call` | PASS | Transferred to practice for prescription refill |\n| 3 | Emergency, chest pain | Hans Müller | Recommend 112 | PASS | Immediate emergency detection, 112 recommended |\n| 4 | Office hours inquiry | Anna Schmidt | Provide info | PASS | Office hours read correctly from config |\n| 5 | Pharma representative | Dr. Klaus Fischer | `send_summary` | PASS | Summary created, action_required flag set |\n\n**5/5 scenarios passed** — all webhook handlers triggered correctly, fluent German responses.\n\n```bash\n# List scenarios\npython scripts/test_call.py --list\n\n# Run specific scenario\npython scripts/test_call.py --scenario 1 --assistant-id \u003cID\u003e\n```\n\n## Configuration\n\nSet in `.env`:\n\n```bash\n# Required\nVAPI_API_KEY=your-vapi-api-key\n\n# Webhook auth (optional — disabled if not set)\nVAPI_WEBHOOK_SECRET=your-hmac-secret\n\n# Transfer destination\nPRAXIS_PHONE_NUMBER=+498912345678\n\n# Email notifications (optional — skipped if not set)\nSMTP_HOST=smtp.gmail.com\nSMTP_PORT=587\nSMTP_USER=praxis@example.com\nSMTP_PASSWORD=app-password\nNOTIFICATION_EMAIL_TO=team@example.com\nNOTIFICATION_EMAIL_FROM=lisa@example.com\n\n# Webhook notifications (optional — skipped if not set)\nNOTIFICATION_WEBHOOK_URL=https://hooks.slack.com/services/...\n\n# Server\nHOST=0.0.0.0\nPORT=8000\nDEBUG=true\n```\n\n## Multi-Practice Support\n\nThe agent is configurable for any medical practice via YAML:\n\n```bash\n# Setup with custom practice config\npython scripts/setup_vapi.py --webhook-url https://... --config configs/examples/praxis_schmidt_zahnarzt.yaml\n\n# Default: Praxis Dr. Müller\npython scripts/setup_vapi.py --webhook-url https://your-tunnel.ngrok.io\n```\n\nNew practice = new YAML file. See `configs/praxis_template.yaml` for all fields.\n\n## Holiday \u0026 Hours-Aware Greetings\n\nLisa's greeting adapts automatically:\n\n| Situation | Greeting (in German) |\n|-----------|---------------------|\n| Holiday | \"The practice is closed today due to {holiday}. In emergencies...\" |\n| Outside hours | \"The practice is currently closed. Our office hours are...\" |\n| Normal hours | Standard greeting from practice YAML config |\n\nHolidays are configured in `configs/availability.yaml` (13 German holidays: 9 federal + 4 Bavaria).\n\n## Analytics Dashboard\n\nView call analytics at `http://localhost:8000/static/dashboard.html`:\n\n- KPI cards: total calls, calls today, booking rate, average duration\n- Bar chart: top appointment reasons\n- Timeline: calls per day\n- Date range filter\n\nAPI: `GET /api/analytics?from=2026-04-01\u0026to=2026-04-14`\n\n## Setup\n\n```bash\n# Basic — creates assistant with tools\npython scripts/setup_vapi.py --webhook-url https://your-tunnel.ngrok.io\n\n# With webhook auth\npython scripts/setup_vapi.py --webhook-url https://... --webhook-secret my-secret\n\n# With phone number provisioning\npython scripts/setup_vapi.py --webhook-url https://... --phone-number\n```\n\n## Deployment\n\n```bash\n# Docker\ndocker compose up --build\n\n# Fly.io (Frankfurt region)\nfly deploy\n```\n\n## Tests\n\n```bash\npytest tests/ -v\n# 156 tests covering agent config, analytics, holidays, webhook server, availability, notifications, auth\n```\n\n## Tech Stack\n\n| Component | Version / Detail |\n|-----------|-----------------|\n| Python | 3.12+ |\n| FastAPI | webhook server |\n| uvicorn | ASGI server |\n| Vapi.ai | voice + LLM orchestration |\n| vapi-server-sdk | assistant/tool CRUD |\n| Claude Sonnet 4 | LLM (via Vapi) |\n| ElevenLabs | TTS (German voice) |\n| Chart.js | analytics dashboard |\n| Docker | production container |\n| Fly.io | deployment (Frankfurt) |\n\n## Costs (Verified)\n\n| Component | Cost | Verified |\n|-----------|------|----------|\n| Vapi Free Tier | $10 credits (~200 min) | 2026-04-14 |\n| Phone Number | ~$1/month | 2026-04-14 |\n| Claude Sonnet 4 (via Vapi) | ~$0.01-0.03/call | 2026-04-14 |\n| **5 Live Test Calls** | **~$0.50 total** | 2026-04-14 |\n\n## License\n\nMIT\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmj-deving%2Fvoice-agent","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmj-deving%2Fvoice-agent","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmj-deving%2Fvoice-agent/lists"}