# saiteja-git1/voicepilot architecture

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

- Interactive diagram: https://gitdiagram.com/saiteja-git1/voicepilot
- Repository: https://github.com/saiteja-git1/voicepilot

## Overview

VoicePilot accepts spoken requests, streams audio to Gemini Live, and plays spoken responses; Gemini tool calls can dispatch desktop tasks through a screenshot/action/replanning loop. An optional local wake-word gate starts and stops voice sessions, while a read-only WebSocket reports session status to the UI. The README also describes safety gating and verification ambitions, but the sampled runtime does not establish a separate confirmation or visual-verification subsystem. Relationships below are limited to shown calls and documented behavior; unsampled implementations are represented only where the tree or README supports them.

Main entry points: [`backend/voice/session_manager.py`](https://github.com/saiteja-git1/voicepilot/blob/main/backend/voice/session_manager.py) (Session manager), [`backend/computer_use/agent.py`](https://github.com/saiteja-git1/voicepilot/blob/main/backend/computer_use/agent.py) (Computer-use agent), [`backend/main.py`](https://github.com/saiteja-git1/voicepilot/blob/main/backend/main.py) (Runtime entry), [`backend/voice/gemini_live_session.py`](https://github.com/saiteja-git1/voicepilot/blob/main/backend/voice/gemini_live_session.py) (Gemini Live)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_voice["Voice session"]
  node_audioio["PyAudio I/O<br/>[pyaudio_io.py]"]
  node_audio_contracts["Audio interfaces<br/>[interfaces.py]"]
  node_session_manager["Session manager<br/>[session_manager.py]"]
  node_voice_contracts["Voice interfaces<br/>[interfaces.py]"]
  node_gemini["Gemini Live"]
  node_voice_events["Voice events<br/>[events.py]"]
end

subgraph group_wake["Wake activation"]
  node_detector["Typed wake detector<br/>[dev_detector.py]"]
  node_wake_gate["Wake gate<br/>[gate.py]"]
  node_wake_contracts["Wake interfaces<br/>[interfaces.py]"]
  node_wake_events["Wake events<br/>[events.py]"]
end

subgraph group_desktop["Computer use"]
  node_computer_agent["Computer-use agent<br/>[agent.py]"]
  node_computer_client["Action model client<br/>[client.py]"]
  node_action_rules["Action parsing and safety<br/>[actions.py]"]
  node_executor["Desktop executor<br/>[executor.py]"]
  node_screenshot["Screen capture<br/>[screenshot.py]"]
end

subgraph group_status["Status interface"]
  node_status_server["Status WebSocket<br/>[ws_server.py]"]
  node_ui["Status page<br/>[app.js]"]
end

node_user(("Voice user"))
node_entry["Runtime entry<br/>[main.py]"]
node_config["Runtime config<br/>[config.py]"]
node_gemini_service{{"Gemini Live API"}}
node_browser(("Browser client"))
node_logging["Structured logging<br/>[logging_setup.py]"]

node_user -->|"speaks into"| node_audioio
node_entry -->|"loads"| node_config
node_entry -->|"starts"| node_session_manager
node_entry -->|"optionally starts"| node_wake_gate
node_entry -->|"starts"| node_status_server
node_session_manager -->|"streams audio"| node_audioio
node_session_manager -->|"creates sessions"| node_gemini
node_session_manager -->|"dispatches tool task"| node_computer_agent
node_session_manager -->|"handles events"| node_voice_events
node_gemini -->|"streams audio"| node_gemini_service
node_gemini -->|"emits events"| node_voice_events
node_audioio -->|"implements"| node_audio_contracts
node_gemini -->|"implements"| node_voice_contracts
node_wake_gate -->|"listens through"| node_detector
node_wake_gate -->|"starts and stops"| node_session_manager
node_detector -->|"emits"| node_wake_events
node_detector -->|"implements"| node_wake_contracts
node_computer_agent -->|"captures screen"| node_screenshot
node_computer_agent -->|"requests action"| node_computer_client
node_computer_agent -->|"parses and validates"| node_action_rules
node_computer_agent -->|"executes action"| node_executor
node_status_server -->|"observes state"| node_session_manager
node_status_server -->|"broadcasts status"| node_browser
node_browser -->|"renders status"| node_ui
node_session_manager -->|"records events"| node_logging
node_wake_gate -->|"records events"| node_logging

click node_entry "https://github.com/saiteja-git1/voicepilot/blob/main/backend/main.py"
click node_config "https://github.com/saiteja-git1/voicepilot/blob/main/backend/config.py"
click node_audioio "https://github.com/saiteja-git1/voicepilot/blob/main/backend/audio/pyaudio_io.py"
click node_audio_contracts "https://github.com/saiteja-git1/voicepilot/blob/main/backend/audio/interfaces.py"
click node_session_manager "https://github.com/saiteja-git1/voicepilot/blob/main/backend/voice/session_manager.py"
click node_voice_contracts "https://github.com/saiteja-git1/voicepilot/blob/main/backend/voice/interfaces.py"
click node_gemini "https://github.com/saiteja-git1/voicepilot/blob/main/backend/voice/gemini_live_session.py"
click node_voice_events "https://github.com/saiteja-git1/voicepilot/blob/main/backend/voice/events.py"
click node_detector "https://github.com/saiteja-git1/voicepilot/blob/main/backend/wakeword/dev_detector.py"
click node_wake_gate "https://github.com/saiteja-git1/voicepilot/blob/main/backend/wakeword/gate.py"
click node_wake_contracts "https://github.com/saiteja-git1/voicepilot/blob/main/backend/wakeword/interfaces.py"
click node_wake_events "https://github.com/saiteja-git1/voicepilot/blob/main/backend/wakeword/events.py"
click node_computer_agent "https://github.com/saiteja-git1/voicepilot/blob/main/backend/computer_use/agent.py"
click node_computer_client "https://github.com/saiteja-git1/voicepilot/blob/main/backend/computer_use/client.py"
click node_action_rules "https://github.com/saiteja-git1/voicepilot/blob/main/backend/computer_use/actions.py"
click node_executor "https://github.com/saiteja-git1/voicepilot/blob/main/backend/computer_use/executor.py"
click node_screenshot "https://github.com/saiteja-git1/voicepilot/blob/main/backend/computer_use/screenshot.py"
click node_status_server "https://github.com/saiteja-git1/voicepilot/blob/main/backend/server/ws_server.py"
click node_ui "https://github.com/saiteja-git1/voicepilot/blob/main/ui/app.js"
click node_logging "https://github.com/saiteja-git1/voicepilot/blob/main/backend/logging_setup.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_audioio,node_audio_contracts,node_session_manager,node_voice_contracts,node_gemini,node_voice_events,node_user,node_browser toneBlue
class node_detector,node_wake_gate,node_wake_contracts,node_wake_events toneAmber
class node_computer_agent,node_computer_client,node_action_rules,node_executor,node_screenshot,node_gemini_service toneMint
class node_status_server,node_ui toneRose
class node_entry,node_config,node_logging toneTeal
```

## Components

### Voice session

- [PyAudio I/O](https://github.com/saiteja-git1/voicepilot/blob/main/backend/audio/pyaudio_io.py): `backend/audio/pyaudio_io.py`
- [Audio interfaces](https://github.com/saiteja-git1/voicepilot/blob/main/backend/audio/interfaces.py): `backend/audio/interfaces.py`
- [Session manager](https://github.com/saiteja-git1/voicepilot/blob/main/backend/voice/session_manager.py): `backend/voice/session_manager.py`
- [Voice interfaces](https://github.com/saiteja-git1/voicepilot/blob/main/backend/voice/interfaces.py): `backend/voice/interfaces.py`
- [Gemini Live](https://github.com/saiteja-git1/voicepilot/blob/main/backend/voice/gemini_live_session.py): `backend/voice/gemini_live_session.py`
- [Voice events](https://github.com/saiteja-git1/voicepilot/blob/main/backend/voice/events.py): `backend/voice/events.py`

### Wake activation

- [Typed wake detector](https://github.com/saiteja-git1/voicepilot/blob/main/backend/wakeword/dev_detector.py): `backend/wakeword/dev_detector.py`
- [Wake gate](https://github.com/saiteja-git1/voicepilot/blob/main/backend/wakeword/gate.py): `backend/wakeword/gate.py`
- [Wake interfaces](https://github.com/saiteja-git1/voicepilot/blob/main/backend/wakeword/interfaces.py): `backend/wakeword/interfaces.py`
- [Wake events](https://github.com/saiteja-git1/voicepilot/blob/main/backend/wakeword/events.py): `backend/wakeword/events.py`

### Computer use

- [Computer-use agent](https://github.com/saiteja-git1/voicepilot/blob/main/backend/computer_use/agent.py): `backend/computer_use/agent.py`
- [Action model client](https://github.com/saiteja-git1/voicepilot/blob/main/backend/computer_use/client.py): `backend/computer_use/client.py`
- [Action parsing and safety](https://github.com/saiteja-git1/voicepilot/blob/main/backend/computer_use/actions.py): `backend/computer_use/actions.py`
- [Desktop executor](https://github.com/saiteja-git1/voicepilot/blob/main/backend/computer_use/executor.py): `backend/computer_use/executor.py`
- [Screen capture](https://github.com/saiteja-git1/voicepilot/blob/main/backend/computer_use/screenshot.py): `backend/computer_use/screenshot.py`

### Status interface

- [Status WebSocket](https://github.com/saiteja-git1/voicepilot/blob/main/backend/server/ws_server.py): `backend/server/ws_server.py`
- [Status page](https://github.com/saiteja-git1/voicepilot/blob/main/ui/app.js): `ui/app.js`

### Other components

- **Voice user**
- [Runtime entry](https://github.com/saiteja-git1/voicepilot/blob/main/backend/main.py): `backend/main.py`
- [Runtime config](https://github.com/saiteja-git1/voicepilot/blob/main/backend/config.py): `backend/config.py`
- **Gemini Live API**
- **Browser client**
- [Structured logging](https://github.com/saiteja-git1/voicepilot/blob/main/backend/logging_setup.py): `backend/logging_setup.py`

## Connections

- Voice user → PyAudio I/O: speaks into (evidence: `README.md`)
- Runtime entry → Runtime config: loads (evidence: `backend/main.py`)
- Runtime entry → Session manager: starts (evidence: `backend/main.py`)
- Runtime entry → Wake gate: optionally starts (evidence: `backend/main.py`)
- Runtime entry → Status WebSocket: starts (evidence: `backend/main.py`)
- Session manager → PyAudio I/O: streams audio (evidence: `backend/voice/session_manager.py`)
- Session manager → Gemini Live: creates sessions (evidence: `backend/voice/session_manager.py`)
- Session manager → Computer-use agent: dispatches tool task (evidence: `backend/voice/session_manager.py`)
- Session manager → Voice events: handles events (evidence: `backend/voice/session_manager.py`)
- Gemini Live → Gemini Live API: streams audio (evidence: `backend/voice/gemini_live_session.py`)
- Gemini Live → Voice events: emits events (evidence: `backend/voice/gemini_live_session.py`)
- PyAudio I/O → Audio interfaces: implements (evidence: `backend/audio/pyaudio_io.py`)
- Gemini Live → Voice interfaces: implements (evidence: `backend/voice/gemini_live_session.py`)
- Wake gate → Typed wake detector: listens through (evidence: `backend/wakeword/gate.py`)
- Wake gate → Session manager: starts and stops (evidence: `backend/wakeword/gate.py`)
- Typed wake detector → Wake events: emits (evidence: `backend/wakeword/dev_detector.py`)
- Typed wake detector → Wake interfaces: implements (evidence: `backend/wakeword/dev_detector.py`)
- Computer-use agent → Screen capture: captures screen (evidence: `backend/computer_use/agent.py`)
- Computer-use agent → Action model client: requests action (evidence: `backend/computer_use/agent.py`)
- Computer-use agent → Action parsing and safety: parses and validates (evidence: `backend/computer_use/agent.py`)
- Computer-use agent → Desktop executor: executes action (evidence: `backend/computer_use/agent.py`)
- Status WebSocket → Session manager: observes state (evidence: `backend/server/ws_server.py`)
- Status WebSocket → Browser client: broadcasts status (evidence: `README.md`)
- Browser client → Status page: renders status (evidence: `README.md`)
- Session manager → Structured logging: records events (evidence: `backend/voice/session_manager.py`)
- Wake gate → Structured logging: records events (evidence: `backend/wakeword/gate.py`)
