# harshachakravarthy/voice-agent architecture

> Architecture diagram of the GitHub repository harshachakravarthy/voice-agent, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-18). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/harshachakravarthy/voice-agent
- Repository: https://github.com/harshachakravarthy/voice-agent

## Overview

This is a managed AI voice-agent service with a business-operations dashboard. A caller reaches the Twilio webhook; the service loads business context, streams audio through speech recognition and AI response generation, speaks back over the call, and processes call outcomes afterward. The dashboard supports login, knowledge, calendar, notifications, and settings. The graph also shows the API, service, and persistence layers. Several route and service implementations were not excerpted, so documented capabilities are included without speculative internal call links.

Main entry points: [`src/app/services/webhook_service.py`](https://github.com/harshachakravarthy/voice-agent/blob/f-Final/src/app/services/webhook_service.py) (Call orchestration), [`src/app/api/routes`](https://github.com/harshachakravarthy/voice-agent/tree/f-Final/src/app/api/routes) (Business and call routes), [`src/app/services/notification_service.py`](https://github.com/harshachakravarthy/voice-agent/blob/f-Final/src/app/services/notification_service.py) (Notifications), [`frontend/src/App.tsx`](https://github.com/harshachakravarthy/voice-agent/blob/f-Final/frontend/src/App.tsx) (Dashboard routes)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_client["Dashboard"]
  node_frontend["Dashboard routes<br/>[App.tsx]"]
  node_auth["Dashboard auth<br/>[AuthContext.tsx]"]
  node_dashboard_features["Business dashboard"]
  node_api_client["Typed API client<br/>[api.ts]"]
end

subgraph group_api["API and Services"]
  node_api_router["API router<br/>[router.py]"]
  node_api_routes["Business and call routes"]
  node_webhook_routes["Voice webhooks<br/>[webhooks.py]"]
  node_appointment_service["Appointments"]
  node_knowledge_service["Knowledge management"]
  node_calendar_oauth["Calendar connection"]
  node_notification_service["Notifications"]
  node_outbox["Notification outbox<br/>[outbox_worker.py]"]
end

subgraph group_voice["Voice Runtime"]
  node_webhook_service["Call orchestration<br/>[webhook_service.py]"]
  node_media_stream["Media stream"]
  node_business_context["Business context"]
  node_ai_service["AI response<br/>[ai_service.py]"]
end

subgraph group_data["Persistence and Integrations"]
  node_stt["Speech recognition<br/>[client.py]"]
  node_ai_client["AI provider<br/>[client.py]"]
  node_tts["Speech synthesis<br/>[client.py]"]
  node_voice_client["Voice provider<br/>[client.py]"]
  node_calendar_client["Google Calendar<br/>[client.py]"]
  node_email_client["Email provider<br/>[client.py]"]
  node_repositories["Business repositories"]
  node_supabase[("Supabase data store<br/>[supabase.py]")]
end

node_owner(("Business operator"))
node_caller(("Incoming caller"))
node_twilio{{"Twilio"}}

node_owner -->|"uses dashboard"| node_frontend
node_frontend -->|"provides auth"| node_auth
node_frontend -->|"routes to"| node_dashboard_features
node_dashboard_features -->|"requests data"| node_api_client
node_api_client -->|"calls API"| node_api_router
node_api_router -->|"registers routes"| node_api_routes
node_caller -->|"places call"| node_twilio
node_twilio -->|"posts call events"| node_webhook_routes
node_webhook_routes -->|"delegates calls"| node_webhook_service
node_webhook_service -->|"loads context"| node_business_context
node_webhook_service -->|"starts stream"| node_media_stream
node_business_context -->|"loads business data"| node_repositories
node_webhook_service -->|"transcribes audio"| node_stt
node_webhook_service -->|"requests response"| node_ai_client
node_webhook_service -->|"synthesizes speech"| node_tts
node_media_stream -->|"streams audio"| node_twilio
node_webhook_service -.->|"uses voice provider"| node_voice_client
node_webhook_service -->|"handles booking"| node_appointment_service
node_api_routes -.->|"serves appointments"| node_appointment_service
node_api_routes -.->|"serves knowledge"| node_knowledge_service
node_api_routes -.->|"serves calendar"| node_calendar_oauth
node_calendar_oauth -->|"exchanges tokens"| node_calendar_client
node_appointment_service -->|"manages events"| node_calendar_client
node_api_routes -.->|"serves notifications"| node_notification_service
node_outbox -->|"dispatches notices"| node_notification_service
node_notification_service -->|"sends email"| node_email_client
node_webhook_service -->|"sends call alerts"| node_notification_service
node_repositories -->|"reads and writes"| node_supabase

click node_frontend "https://github.com/harshachakravarthy/voice-agent/blob/f-Final/frontend/src/App.tsx"
click node_auth "https://github.com/harshachakravarthy/voice-agent/blob/f-Final/frontend/src/context/AuthContext.tsx"
click node_dashboard_features "https://github.com/harshachakravarthy/voice-agent/tree/f-Final/frontend/src/pages"
click node_api_client "https://github.com/harshachakravarthy/voice-agent/blob/f-Final/frontend/src/lib/api.ts"
click node_api_router "https://github.com/harshachakravarthy/voice-agent/blob/f-Final/src/app/api/router.py"
click node_api_routes "https://github.com/harshachakravarthy/voice-agent/tree/f-Final/src/app/api/routes"
click node_webhook_routes "https://github.com/harshachakravarthy/voice-agent/blob/f-Final/src/app/api/routes/webhooks.py"
click node_webhook_service "https://github.com/harshachakravarthy/voice-agent/blob/f-Final/src/app/services/webhook_service.py"
click node_media_stream "https://github.com/harshachakravarthy/voice-agent/blob/f-Final/src/app/services/media_stream_service.py"
click node_business_context "https://github.com/harshachakravarthy/voice-agent/blob/f-Final/src/app/services/business_context_service.py"
click node_ai_service "https://github.com/harshachakravarthy/voice-agent/blob/f-Final/src/app/services/ai_service.py"
click node_appointment_service "https://github.com/harshachakravarthy/voice-agent/blob/f-Final/src/app/services/appointment_service.py"
click node_knowledge_service "https://github.com/harshachakravarthy/voice-agent/blob/f-Final/src/app/services/knowledge_service.py"
click node_calendar_oauth "https://github.com/harshachakravarthy/voice-agent/blob/f-Final/src/app/services/calendar_oauth_service.py"
click node_notification_service "https://github.com/harshachakravarthy/voice-agent/blob/f-Final/src/app/services/notification_service.py"
click node_outbox "https://github.com/harshachakravarthy/voice-agent/blob/f-Final/src/app/workers/outbox_worker.py"
click node_stt "https://github.com/harshachakravarthy/voice-agent/blob/f-Final/src/app/integrations/stt/client.py"
click node_ai_client "https://github.com/harshachakravarthy/voice-agent/blob/f-Final/src/app/integrations/ai/client.py"
click node_tts "https://github.com/harshachakravarthy/voice-agent/blob/f-Final/src/app/integrations/tts/client.py"
click node_voice_client "https://github.com/harshachakravarthy/voice-agent/blob/f-Final/src/app/integrations/voice/client.py"
click node_calendar_client "https://github.com/harshachakravarthy/voice-agent/blob/f-Final/src/app/integrations/calendar/client.py"
click node_email_client "https://github.com/harshachakravarthy/voice-agent/blob/f-Final/src/app/integrations/email/client.py"
click node_repositories "https://github.com/harshachakravarthy/voice-agent/tree/f-Final/src/app/repositories"
click node_supabase "https://github.com/harshachakravarthy/voice-agent/blob/f-Final/src/app/db/supabase.py"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_frontend,node_auth,node_dashboard_features,node_api_client toneBlue
class node_api_router,node_api_routes,node_webhook_routes,node_appointment_service,node_knowledge_service,node_calendar_oauth,node_notification_service,node_outbox toneAmber
class node_webhook_service,node_media_stream,node_business_context,node_ai_service toneMint
class node_stt,node_ai_client,node_tts,node_voice_client,node_calendar_client,node_email_client,node_repositories,node_supabase toneRose
class node_owner,node_caller,node_twilio toneIndigo
```

## Components

### Dashboard

- [Dashboard routes](https://github.com/harshachakravarthy/voice-agent/blob/f-Final/frontend/src/App.tsx): `frontend/src/App.tsx`
- [Dashboard auth](https://github.com/harshachakravarthy/voice-agent/blob/f-Final/frontend/src/context/AuthContext.tsx): `frontend/src/context/AuthContext.tsx`
- [Business dashboard](https://github.com/harshachakravarthy/voice-agent/tree/f-Final/frontend/src/pages): `frontend/src/pages`
- [Typed API client](https://github.com/harshachakravarthy/voice-agent/blob/f-Final/frontend/src/lib/api.ts): `frontend/src/lib/api.ts`

### API and Services

- [API router](https://github.com/harshachakravarthy/voice-agent/blob/f-Final/src/app/api/router.py): `src/app/api/router.py`
- [Business and call routes](https://github.com/harshachakravarthy/voice-agent/tree/f-Final/src/app/api/routes): `src/app/api/routes`
- [Voice webhooks](https://github.com/harshachakravarthy/voice-agent/blob/f-Final/src/app/api/routes/webhooks.py): `src/app/api/routes/webhooks.py`
- [Appointments](https://github.com/harshachakravarthy/voice-agent/blob/f-Final/src/app/services/appointment_service.py): `src/app/services/appointment_service.py`
- [Knowledge management](https://github.com/harshachakravarthy/voice-agent/blob/f-Final/src/app/services/knowledge_service.py): `src/app/services/knowledge_service.py`
- [Calendar connection](https://github.com/harshachakravarthy/voice-agent/blob/f-Final/src/app/services/calendar_oauth_service.py): `src/app/services/calendar_oauth_service.py`
- [Notifications](https://github.com/harshachakravarthy/voice-agent/blob/f-Final/src/app/services/notification_service.py): `src/app/services/notification_service.py`
- [Notification outbox](https://github.com/harshachakravarthy/voice-agent/blob/f-Final/src/app/workers/outbox_worker.py): `src/app/workers/outbox_worker.py`

### Voice Runtime

- [Call orchestration](https://github.com/harshachakravarthy/voice-agent/blob/f-Final/src/app/services/webhook_service.py): `src/app/services/webhook_service.py`
- [Media stream](https://github.com/harshachakravarthy/voice-agent/blob/f-Final/src/app/services/media_stream_service.py): `src/app/services/media_stream_service.py`
- [Business context](https://github.com/harshachakravarthy/voice-agent/blob/f-Final/src/app/services/business_context_service.py): `src/app/services/business_context_service.py`
- [AI response](https://github.com/harshachakravarthy/voice-agent/blob/f-Final/src/app/services/ai_service.py): `src/app/services/ai_service.py`

### Persistence and Integrations

- [Speech recognition](https://github.com/harshachakravarthy/voice-agent/blob/f-Final/src/app/integrations/stt/client.py): `src/app/integrations/stt/client.py`
- [AI provider](https://github.com/harshachakravarthy/voice-agent/blob/f-Final/src/app/integrations/ai/client.py): `src/app/integrations/ai/client.py`
- [Speech synthesis](https://github.com/harshachakravarthy/voice-agent/blob/f-Final/src/app/integrations/tts/client.py): `src/app/integrations/tts/client.py`
- [Voice provider](https://github.com/harshachakravarthy/voice-agent/blob/f-Final/src/app/integrations/voice/client.py): `src/app/integrations/voice/client.py`
- [Google Calendar](https://github.com/harshachakravarthy/voice-agent/blob/f-Final/src/app/integrations/calendar/client.py): `src/app/integrations/calendar/client.py`
- [Email provider](https://github.com/harshachakravarthy/voice-agent/blob/f-Final/src/app/integrations/email/client.py): `src/app/integrations/email/client.py`
- [Business repositories](https://github.com/harshachakravarthy/voice-agent/tree/f-Final/src/app/repositories): `src/app/repositories`
- [Supabase data store](https://github.com/harshachakravarthy/voice-agent/blob/f-Final/src/app/db/supabase.py): `src/app/db/supabase.py`

### Other components

- **Business operator**
- **Incoming caller**
- **Twilio**

## Connections

- Business operator → Dashboard routes: uses dashboard (evidence: `frontend/src/App.tsx`)
- Dashboard routes → Dashboard auth: provides auth (evidence: `frontend/src/App.tsx`)
- Dashboard routes → Business dashboard: routes to (evidence: `frontend/src/App.tsx`)
- Business dashboard → Typed API client: requests data (evidence: `frontend/src/pages/CalendarPage.tsx`)
- Typed API client → API router: calls API (evidence: `frontend/src/lib/api.ts`)
- API router → Business and call routes: registers routes (evidence: `src/app/api/router.py`)
- Incoming caller → Twilio: places call (evidence: `README.md`)
- Twilio → Voice webhooks: posts call events (evidence: `README.md`)
- Voice webhooks → Call orchestration: delegates calls (evidence: `src/app/api/routes/webhooks.py`)
- Call orchestration → Business context: loads context (evidence: `src/app/services/webhook_service.py`)
- Call orchestration → Media stream: starts stream (evidence: `src/app/api/routes/webhooks.py`)
- Business context → Business repositories: loads business data (evidence: `src/app/services/business_context_service.py`)
- Call orchestration → Speech recognition: transcribes audio (evidence: `src/app/services/webhook_service.py`)
- Call orchestration → AI provider: requests response (evidence: `src/app/services/webhook_service.py`)
- Call orchestration → Speech synthesis: synthesizes speech (evidence: `src/app/services/webhook_service.py`)
- Media stream → Twilio: streams audio (evidence: `README.md`)
- Call orchestration → Voice provider: uses voice provider (evidence: `src/app/services/webhook_service.py`)
- Call orchestration → Appointments: handles booking (evidence: `src/app/services/webhook_service.py`)
- Business and call routes → Appointments: serves appointments
- Business and call routes → Knowledge management: serves knowledge
- Business and call routes → Calendar connection: serves calendar
- Calendar connection → Google Calendar: exchanges tokens (evidence: `src/app/services/calendar_oauth_service.py`)
- Appointments → Google Calendar: manages events (evidence: `src/app/services/appointment_service.py`)
- Business and call routes → Notifications: serves notifications
- Notification outbox → Notifications: dispatches notices (evidence: `src/app/workers/outbox_worker.py`)
- Notifications → Email provider: sends email (evidence: `src/app/services/notification_service.py`)
- Call orchestration → Notifications: sends call alerts (evidence: `src/app/services/webhook_service.py`)
- Business repositories → Supabase data store: reads and writes (evidence: `src/app/repositories/base.py`)
