# yar-malik/saudi-healthcare-voice-agent architecture

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

- Interactive diagram: https://gitdiagram.com/yar-malik/saudi-healthcare-voice-agent
- Repository: https://github.com/yar-malik/saudi-healthcare-voice-agent

## Overview

This repository is a self-hostable Saudi healthcare voice-agent example. Its primary phone workflow receives Twilio speech, runs a scripted scenario, dispatches recorded or replaceable tools, synthesizes the reply with Voho, and returns audio for playback. The README also documents booking, triage, reminders and reference workflows, plus optional speech-recognition and healthcare-system integration points. The map reflects sampled runtime code and explicit README claims; unsampled scenario details and example-client internals are not inferred.

Main entry points: [`flows.json`](https://github.com/yar-malik/saudi-healthcare-voice-agent/blob/main/flows.json) (Call scenarios), [`server.py`](https://github.com/yar-malik/saudi-healthcare-voice-agent/blob/main/server.py) (Webhook server), [`agent.py`](https://github.com/yar-malik/saudi-healthcare-voice-agent/blob/main/agent.py) (Scenario agent), [`tools.py`](https://github.com/yar-malik/saudi-healthcare-voice-agent/blob/main/tools.py) (Tool registry)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_telephony["Phone interface"]
  node_server["Webhook server<br/>[server.py]"]
  node_clips[("Audio clips<br/>[server.py]")]
end

subgraph group_conversation["Conversation runtime"]
  node_agent["Scenario agent<br/>[agent.py]"]
end

subgraph group_capabilities["Healthcare scenarios"]
  node_flows["Call scenarios<br/>[flows.json]"]
  node_booking["Booking<br/>[flows.json]"]
  node_triage["Symptom triage<br/>[flows.json]"]
  node_reminders["Reminders<br/>[flows.json]"]
  node_reference["Reference workflows<br/>[flows.json]"]
end

subgraph group_integrations["Voice and systems"]
  node_tools["Tool registry<br/>[tools.py]"]
  node_voho["Voho speech client<br/>[voho.py]"]
  node_stt["Speech recognition<br/>[stt.py]"]
end

node_caller(("Caller"))
node_twilio(("Twilio phone"))
node_clinic_systems[("Clinic systems")]
node_voho_api(("Voho API"))
node_stt_services(("STT providers"))

node_caller -->|"calls"| node_twilio
node_twilio -->|"posts speech"| node_server
node_server -->|"starts and replies"| node_agent
node_agent -->|"loads scenarios"| node_flows
node_agent -->|"dispatches tools"| node_tools
node_server -->|"synthesizes replies"| node_voho
node_voho -->|"requests speech"| node_voho_api
node_server -->|"stores audio"| node_clips
node_twilio -->|"fetches playback"| node_server
node_flows -->|"defines"| node_booking
node_flows -->|"defines"| node_triage
node_flows -->|"defines"| node_reminders
node_flows -->|"records"| node_reference
node_tools -.->|"can integrate"| node_clinic_systems
node_stt -->|"transcribes with"| node_stt_services

click node_server "https://github.com/yar-malik/saudi-healthcare-voice-agent/blob/main/server.py"
click node_clips "https://github.com/yar-malik/saudi-healthcare-voice-agent/blob/main/server.py"
click node_agent "https://github.com/yar-malik/saudi-healthcare-voice-agent/blob/main/agent.py"
click node_flows "https://github.com/yar-malik/saudi-healthcare-voice-agent/blob/main/flows.json"
click node_booking "https://github.com/yar-malik/saudi-healthcare-voice-agent/blob/main/flows.json"
click node_triage "https://github.com/yar-malik/saudi-healthcare-voice-agent/blob/main/flows.json"
click node_reminders "https://github.com/yar-malik/saudi-healthcare-voice-agent/blob/main/flows.json"
click node_reference "https://github.com/yar-malik/saudi-healthcare-voice-agent/blob/main/flows.json"
click node_tools "https://github.com/yar-malik/saudi-healthcare-voice-agent/blob/main/tools.py"
click node_voho "https://github.com/yar-malik/saudi-healthcare-voice-agent/blob/main/voho.py"
click node_stt "https://github.com/yar-malik/saudi-healthcare-voice-agent/blob/main/stt.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_server,node_clips toneBlue
class node_agent,node_clinic_systems toneAmber
class node_flows,node_booking,node_triage,node_reminders,node_reference,node_voho_api toneMint
class node_tools,node_voho,node_stt toneRose
class node_caller,node_twilio,node_stt_services toneIndigo
```

## Components

### Phone interface

- [Webhook server](https://github.com/yar-malik/saudi-healthcare-voice-agent/blob/main/server.py): `server.py`
- [Audio clips](https://github.com/yar-malik/saudi-healthcare-voice-agent/blob/main/server.py): `server.py`

### Conversation runtime

- [Scenario agent](https://github.com/yar-malik/saudi-healthcare-voice-agent/blob/main/agent.py): `agent.py`

### Healthcare scenarios

- [Call scenarios](https://github.com/yar-malik/saudi-healthcare-voice-agent/blob/main/flows.json): `flows.json`
- [Booking](https://github.com/yar-malik/saudi-healthcare-voice-agent/blob/main/flows.json): `flows.json`
- [Symptom triage](https://github.com/yar-malik/saudi-healthcare-voice-agent/blob/main/flows.json): `flows.json`
- [Reminders](https://github.com/yar-malik/saudi-healthcare-voice-agent/blob/main/flows.json): `flows.json`
- [Reference workflows](https://github.com/yar-malik/saudi-healthcare-voice-agent/blob/main/flows.json): `flows.json`

### Voice and systems

- [Tool registry](https://github.com/yar-malik/saudi-healthcare-voice-agent/blob/main/tools.py): `tools.py`
- [Voho speech client](https://github.com/yar-malik/saudi-healthcare-voice-agent/blob/main/voho.py): `voho.py`
- [Speech recognition](https://github.com/yar-malik/saudi-healthcare-voice-agent/blob/main/stt.py): `stt.py`

### Other components

- **Caller**
- **Twilio phone**
- **Clinic systems**
- **Voho API**
- **STT providers**

## Connections

- Caller → Twilio phone: calls (evidence: `README.md`)
- Twilio phone → Webhook server: posts speech (evidence: `README.md`)
- Webhook server → Scenario agent: starts and replies (evidence: `server.py`)
- Scenario agent → Call scenarios: loads scenarios (evidence: `agent.py`)
- Scenario agent → Tool registry: dispatches tools (evidence: `agent.py`)
- Webhook server → Voho speech client: synthesizes replies (evidence: `server.py`)
- Voho speech client → Voho API: requests speech (evidence: `voho.py`)
- Webhook server → Audio clips: stores audio (evidence: `server.py`)
- Twilio phone → Webhook server: fetches playback (evidence: `server.py`)
- Call scenarios → Booking: defines (evidence: `README.md`)
- Call scenarios → Symptom triage: defines (evidence: `README.md`)
- Call scenarios → Reminders: defines (evidence: `README.md`)
- Call scenarios → Reference workflows: records (evidence: `README.md`)
- Tool registry → Clinic systems: can integrate (evidence: `README.md`)
- Speech recognition → STT providers: transcribes with (evidence: `stt.py`)
