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

> Architecture diagram of the GitHub repository yar-malik/saudi-travel-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-travel-voice-agent
- Repository: https://github.com/yar-malik/saudi-travel-voice-agent

## Overview

This is a self-hostable Saudi Arabic travel and hospitality voice-agent example. Its phone workflow receives a Twilio call, runs a scripted scenario, uses recorded or registered tool results, synthesizes spoken replies with Voho, and returns audio for playback. The README also documents terminal examples and optional speech-recognition and hotel-system integrations. Scenario definitions identify booking, change/cancellation and concierge conversations, plus document-capture and disruption reference scenarios. Some integrations are documented rather than implemented here; edges below reflect the sampled source or explicit README statements.

Main entry points: [`server.py`](https://github.com/yar-malik/saudi-travel-voice-agent/blob/main/server.py) (Phone webhook), [`agent.py`](https://github.com/yar-malik/saudi-travel-voice-agent/blob/main/agent.py) (Conversation engine), [`flows.json`](https://github.com/yar-malik/saudi-travel-voice-agent/blob/main/flows.json) (Scenario definitions), [`tools.py`](https://github.com/yar-malik/saudi-travel-voice-agent/blob/main/tools.py) (Tool dispatch)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_phone["Phone interaction"]
  node_twilio["Twilio voice"]
  node_phone_server["Phone webhook<br/>[server.py]"]
  node_audio_clips[("Temporary audio clips<br/>[server.py]")]
end

subgraph group_conversation["Conversation engine"]
  node_flow_catalog["Scenario definitions<br/>[flows.json]"]
  node_agent["Conversation engine<br/>[agent.py]"]
  node_scenario_kinds["Booking, change, concierge<br/>[flows.json]"]
  node_reference_scenarios["Document, disruption<br/>[flows.json]"]
end

subgraph group_actions["Scenario actions"]
  node_tool_dispatch["Tool dispatch<br/>[tools.py]"]
  node_tool_registry["Tool implementations<br/>[tools.py]"]
  node_hotel_systems[("Hotel systems")]
end

subgraph group_speech["Speech services"]
  node_stt["Speech recognition<br/>[stt.py]"]
  node_stt_providers["STT providers"]
  node_voho_client["Voho speech client<br/>[voho.py]"]
  node_voho_api["Voho API"]
end

node_caller(("Caller"))

node_caller -->|"calls"| node_twilio
node_twilio -->|"posts voice"| node_phone_server
node_phone_server -->|"starts, replies"| node_agent
node_agent -->|"loads"| node_flow_catalog
node_scenario_kinds -->|"defined in"| node_flow_catalog
node_reference_scenarios -->|"recorded in"| node_flow_catalog
node_agent -->|"calls tools"| node_tool_dispatch
node_tool_dispatch -->|"dispatches to"| node_tool_registry
node_tool_registry -.->|"can integrate"| node_hotel_systems
node_twilio -->|"posts transcript"| node_phone_server
node_phone_server -->|"synthesizes replies"| node_voho_client
node_voho_client -->|"requests speech"| node_voho_api
node_phone_server -->|"stores audio"| node_audio_clips
node_twilio -->|"fetches playback"| node_phone_server
node_phone_server -.->|"optional transcription"| node_stt
node_stt -->|"selects provider"| node_stt_providers

click node_phone_server "https://github.com/yar-malik/saudi-travel-voice-agent/blob/main/server.py"
click node_audio_clips "https://github.com/yar-malik/saudi-travel-voice-agent/blob/main/server.py"
click node_flow_catalog "https://github.com/yar-malik/saudi-travel-voice-agent/blob/main/flows.json"
click node_agent "https://github.com/yar-malik/saudi-travel-voice-agent/blob/main/agent.py"
click node_scenario_kinds "https://github.com/yar-malik/saudi-travel-voice-agent/blob/main/flows.json"
click node_reference_scenarios "https://github.com/yar-malik/saudi-travel-voice-agent/blob/main/flows.json"
click node_tool_dispatch "https://github.com/yar-malik/saudi-travel-voice-agent/blob/main/tools.py"
click node_tool_registry "https://github.com/yar-malik/saudi-travel-voice-agent/blob/main/tools.py"
click node_stt "https://github.com/yar-malik/saudi-travel-voice-agent/blob/main/stt.py"
click node_voho_client "https://github.com/yar-malik/saudi-travel-voice-agent/blob/main/voho.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_twilio,node_phone_server,node_audio_clips toneBlue
class node_flow_catalog,node_agent,node_scenario_kinds,node_reference_scenarios toneAmber
class node_tool_dispatch,node_tool_registry,node_hotel_systems toneMint
class node_stt,node_stt_providers,node_voho_client,node_voho_api toneRose
class node_caller toneIndigo
```

## Components

### Phone interaction

- **Twilio voice**
- [Phone webhook](https://github.com/yar-malik/saudi-travel-voice-agent/blob/main/server.py): `server.py`
- [Temporary audio clips](https://github.com/yar-malik/saudi-travel-voice-agent/blob/main/server.py): `server.py`

### Conversation engine

- [Scenario definitions](https://github.com/yar-malik/saudi-travel-voice-agent/blob/main/flows.json): `flows.json`
- [Conversation engine](https://github.com/yar-malik/saudi-travel-voice-agent/blob/main/agent.py): `agent.py`
- [Booking, change, concierge](https://github.com/yar-malik/saudi-travel-voice-agent/blob/main/flows.json): `flows.json`
- [Document, disruption](https://github.com/yar-malik/saudi-travel-voice-agent/blob/main/flows.json): `flows.json`

### Scenario actions

- [Tool dispatch](https://github.com/yar-malik/saudi-travel-voice-agent/blob/main/tools.py): `tools.py`
- [Tool implementations](https://github.com/yar-malik/saudi-travel-voice-agent/blob/main/tools.py): `tools.py`
- **Hotel systems**

### Speech services

- [Speech recognition](https://github.com/yar-malik/saudi-travel-voice-agent/blob/main/stt.py): `stt.py`
- **STT providers**
- [Voho speech client](https://github.com/yar-malik/saudi-travel-voice-agent/blob/main/voho.py): `voho.py`
- **Voho API**

### Other components

- **Caller**

## Connections

- Caller → Twilio voice: calls (evidence: `README.md`)
- Twilio voice → Phone webhook: posts voice (evidence: `README.md`)
- Phone webhook → Conversation engine: starts, replies (evidence: `server.py`)
- Conversation engine → Scenario definitions: loads (evidence: `agent.py`)
- Booking, change, concierge → Scenario definitions: defined in (evidence: `README.md`)
- Document, disruption → Scenario definitions: recorded in (evidence: `README.md`)
- Conversation engine → Tool dispatch: calls tools (evidence: `agent.py`)
- Tool dispatch → Tool implementations: dispatches to (evidence: `tools.py`)
- Tool implementations → Hotel systems: can integrate (evidence: `README.md`)
- Twilio voice → Phone webhook: posts transcript (evidence: `server.py`)
- Phone webhook → Voho speech client: synthesizes replies (evidence: `server.py`)
- Voho speech client → Voho API: requests speech (evidence: `voho.py`)
- Phone webhook → Temporary audio clips: stores audio (evidence: `server.py`)
- Twilio voice → Phone webhook: fetches playback (evidence: `server.py`)
- Phone webhook → Speech recognition: optional transcription (evidence: `README.md`)
- Speech recognition → STT providers: selects provider (evidence: `stt.py`)
