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

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

## Overview

This repository is a scripted Saudi logistics voice-agent example: scenario definitions drive a conversation, tool calls replay recorded outcomes or invoke registered implementations, and Voho supplies speech. The terminal examples are the documented quick-start path; an included Flask/Twilio server provides a phone-webhook path. The README also documents optional speech-recognition choices and reference scenarios. The examples and flow data were not excerpted, so their internal behavior and detailed scenario-to-tool mappings are not inferred here.

Main entry points: [`server.py`](https://github.com/yar-malik/saudi-logistics-voice-agent/blob/main/server.py) (Phone server), [`agent.py`](https://github.com/yar-malik/saudi-logistics-voice-agent/blob/main/agent.py) (Conversation engine), [`stt.py`](https://github.com/yar-malik/saudi-logistics-voice-agent/blob/main/stt.py) (Speech recognition options), [`voho.py`](https://github.com/yar-malik/saudi-logistics-voice-agent/blob/main/voho.py) (Voho speech client)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_conversation["Conversation workflow"]
  node_agent["Conversation engine<br/>[agent.py]"]
end

subgraph group_logistics["Logistics scenarios"]
  node_flows["Scenario catalog<br/>[flows.json]"]
end

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

subgraph group_channels["Run channels"]
  node_python_example["Python example<br/>[main.py]"]
  node_node_example["Node example<br/>[index.mjs]"]
  node_phone_server["Phone server<br/>[server.py]"]
end

node_caller(("Caller"))
node_twilio["Twilio phone"]
node_voho_api["Voho Speech API"]
node_openai["OpenAI Whisper"]
node_custom_stt["Custom recognizer"]

node_python_example -->|"requests speech"| node_voho_api
node_node_example -->|"requests speech"| node_voho_api
node_caller -->|"calls"| node_phone_server
node_twilio -->|"posts webhook"| node_phone_server
node_phone_server -->|"starts and replies"| node_agent
node_agent -->|"loads scenarios"| node_flows
node_agent -->|"runs tools"| node_tool_runtime
node_phone_server -->|"lists stubbed tools"| node_tool_runtime
node_phone_server -->|"synthesizes replies"| node_speech_client
node_speech_client -->|"requests speech"| node_voho_api
node_phone_server -->|"returns TwiML audio"| node_twilio
node_stt -->|"transcribes audio"| node_openai
node_stt -->|"posts audio"| node_custom_stt

click node_python_example "https://github.com/yar-malik/saudi-logistics-voice-agent/blob/main/examples/python/main.py"
click node_node_example "https://github.com/yar-malik/saudi-logistics-voice-agent/blob/main/examples/node/index.mjs"
click node_phone_server "https://github.com/yar-malik/saudi-logistics-voice-agent/blob/main/server.py"
click node_agent "https://github.com/yar-malik/saudi-logistics-voice-agent/blob/main/agent.py"
click node_flows "https://github.com/yar-malik/saudi-logistics-voice-agent/blob/main/flows.json"
click node_tool_runtime "https://github.com/yar-malik/saudi-logistics-voice-agent/blob/main/tools.py"
click node_speech_client "https://github.com/yar-malik/saudi-logistics-voice-agent/blob/main/voho.py"
click node_stt "https://github.com/yar-malik/saudi-logistics-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_agent toneBlue
class node_flows toneAmber
class node_tool_runtime,node_speech_client,node_stt,node_voho_api toneMint
class node_python_example,node_node_example,node_phone_server toneRose
class node_caller,node_twilio,node_openai,node_custom_stt toneIndigo
```

## Components

### Conversation workflow

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

### Logistics scenarios

- [Scenario catalog](https://github.com/yar-malik/saudi-logistics-voice-agent/blob/main/flows.json): `flows.json`

### Voice and tools

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

### Run channels

- [Python example](https://github.com/yar-malik/saudi-logistics-voice-agent/blob/main/examples/python/main.py): `examples/python/main.py`
- [Node example](https://github.com/yar-malik/saudi-logistics-voice-agent/blob/main/examples/node/index.mjs): `examples/node/index.mjs`
- [Phone server](https://github.com/yar-malik/saudi-logistics-voice-agent/blob/main/server.py): `server.py`

### Other components

- **Caller**
- **Twilio phone**
- **Voho Speech API**
- **OpenAI Whisper**
- **Custom recognizer**

## Connections

- Python example → Voho Speech API: requests speech (evidence: `README.md`)
- Node example → Voho Speech API: requests speech (evidence: `README.md`)
- Caller → Phone server: calls (evidence: `README.md`)
- Twilio phone → Phone server: posts webhook (evidence: `server.py`)
- Phone server → Conversation engine: starts and replies (evidence: `server.py`)
- Conversation engine → Scenario catalog: loads scenarios (evidence: `agent.py`)
- Conversation engine → Tool registry: runs tools (evidence: `agent.py`)
- Phone server → Tool registry: lists stubbed tools (evidence: `server.py`)
- Phone server → Voho speech client: synthesizes replies (evidence: `server.py`)
- Voho speech client → Voho Speech API: requests speech (evidence: `voho.py`)
- Phone server → Twilio phone: returns TwiML audio (evidence: `server.py`)
- Speech recognition options → OpenAI Whisper: transcribes audio (evidence: `stt.py`)
- Speech recognition options → Custom recognizer: posts audio (evidence: `stt.py`)
