# varadganjoo/realtime-voice-and-vision-assistant architecture

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

- Interactive diagram: https://gitdiagram.com/varadganjoo/realtime-voice-and-vision-assistant
- Repository: https://github.com/varadganjoo/realtime-voice-and-vision-assistant

## Overview

This Windows voice assistant turns microphone speech into routed requests, invokes tools for system control and information tasks, formulates a response, and speaks it back. Its main runtime is concentrated in voice.py; safety.py centralizes tool dispatch, approval for sensitive actions, and isolated generated-code execution, while tts.py handles interruptible audio output. The README documents major capabilities beyond the sampled excerpts, so those branches are included with README evidence; unsampled implementation details are not expanded.

Main entry points: [`safety.py`](https://github.com/varadganjoo/realtime-voice-and-vision-assistant/blob/main/safety.py) (Tool dispatch), [`voice.py`](https://github.com/varadganjoo/realtime-voice-and-vision-assistant/blob/main/voice.py) (Query processing), [`tts.py`](https://github.com/varadganjoo/realtime-voice-and-vision-assistant/blob/main/tts.py) (Speech playback)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_interaction["Voice interaction"]
  node_voice_input["Speech input<br/>[voice.py]"]
  node_transcription["Transcription<br/>[voice.py]"]
  node_gui["Microphone GUI<br/>[voice.py]"]
end

subgraph group_assistant["Assistant logic"]
  node_query_processing["Query processing<br/>[voice.py]"]
  node_tool_routing["Tool routing<br/>[voice.py]"]
  node_response_generation["Answer generation<br/>[voice.py]"]
end

subgraph group_tools["Tools and actions"]
  node_tool_dispatch["Tool dispatch<br/>[safety.py]"]
  node_approval["Approval gate<br/>[safety.py]"]
  node_code_runner["Code execution<br/>[safety.py]"]
  node_system_control["System control<br/>[voice.py]"]
  node_weather["Weather lookup<br/>[voice.py]"]
  node_web_search["Web search<br/>[voice.py]"]
  node_visual_capture["Screen and webcam<br/>[voice.py]"]
  node_external_services["External services"]
end

subgraph group_output["Response output"]
  node_speech_output["Speech playback<br/>[tts.py]"]
end

node_user(("User"))

node_user -->|"speaks to"| node_voice_input
node_voice_input -->|"records speech"| node_transcription
node_transcription -->|"starts processing"| node_query_processing
node_gui -->|"controls microphone"| node_voice_input
node_query_processing -->|"routes query"| node_tool_routing
node_tool_routing -->|"dispatches tools"| node_tool_dispatch
node_tool_dispatch -->|"checks sensitive actions"| node_approval
node_tool_dispatch -->|"runs generated code"| node_code_runner
node_tool_dispatch -->|"invokes controls"| node_system_control
node_tool_dispatch -->|"invokes lookup"| node_weather
node_tool_dispatch -->|"invokes search"| node_web_search
node_tool_dispatch -->|"invokes capture"| node_visual_capture
node_weather -->|"requests weather data"| node_external_services
node_web_search -->|"searches web"| node_external_services
node_visual_capture -->|"uses AI analysis"| node_external_services
node_tool_dispatch -->|"provides tool results"| node_response_generation
node_query_processing -->|"prepares answer"| node_response_generation
node_response_generation -->|"speaks response"| node_speech_output
node_speech_output -->|"plays audio"| node_user

click node_voice_input "https://github.com/varadganjoo/realtime-voice-and-vision-assistant/blob/main/voice.py"
click node_transcription "https://github.com/varadganjoo/realtime-voice-and-vision-assistant/blob/main/voice.py"
click node_gui "https://github.com/varadganjoo/realtime-voice-and-vision-assistant/blob/main/voice.py"
click node_query_processing "https://github.com/varadganjoo/realtime-voice-and-vision-assistant/blob/main/voice.py"
click node_tool_routing "https://github.com/varadganjoo/realtime-voice-and-vision-assistant/blob/main/voice.py"
click node_response_generation "https://github.com/varadganjoo/realtime-voice-and-vision-assistant/blob/main/voice.py"
click node_tool_dispatch "https://github.com/varadganjoo/realtime-voice-and-vision-assistant/blob/main/safety.py"
click node_approval "https://github.com/varadganjoo/realtime-voice-and-vision-assistant/blob/main/safety.py"
click node_code_runner "https://github.com/varadganjoo/realtime-voice-and-vision-assistant/blob/main/safety.py"
click node_system_control "https://github.com/varadganjoo/realtime-voice-and-vision-assistant/blob/main/voice.py"
click node_weather "https://github.com/varadganjoo/realtime-voice-and-vision-assistant/blob/main/voice.py"
click node_web_search "https://github.com/varadganjoo/realtime-voice-and-vision-assistant/blob/main/voice.py"
click node_visual_capture "https://github.com/varadganjoo/realtime-voice-and-vision-assistant/blob/main/voice.py"
click node_speech_output "https://github.com/varadganjoo/realtime-voice-and-vision-assistant/blob/main/tts.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_voice_input,node_transcription,node_gui,node_user toneBlue
class node_query_processing,node_tool_routing,node_response_generation toneAmber
class node_tool_dispatch,node_approval,node_code_runner,node_system_control,node_weather,node_web_search,node_visual_capture,node_external_services toneMint
class node_speech_output toneRose
```

## Components

### Voice interaction

- [Speech input](https://github.com/varadganjoo/realtime-voice-and-vision-assistant/blob/main/voice.py): `voice.py`
- [Transcription](https://github.com/varadganjoo/realtime-voice-and-vision-assistant/blob/main/voice.py): `voice.py`
- [Microphone GUI](https://github.com/varadganjoo/realtime-voice-and-vision-assistant/blob/main/voice.py): `voice.py`

### Assistant logic

- [Query processing](https://github.com/varadganjoo/realtime-voice-and-vision-assistant/blob/main/voice.py): `voice.py`
- [Tool routing](https://github.com/varadganjoo/realtime-voice-and-vision-assistant/blob/main/voice.py): `voice.py`
- [Answer generation](https://github.com/varadganjoo/realtime-voice-and-vision-assistant/blob/main/voice.py): `voice.py`

### Tools and actions

- [Tool dispatch](https://github.com/varadganjoo/realtime-voice-and-vision-assistant/blob/main/safety.py): `safety.py`
- [Approval gate](https://github.com/varadganjoo/realtime-voice-and-vision-assistant/blob/main/safety.py): `safety.py`
- [Code execution](https://github.com/varadganjoo/realtime-voice-and-vision-assistant/blob/main/safety.py): `safety.py`
- [System control](https://github.com/varadganjoo/realtime-voice-and-vision-assistant/blob/main/voice.py): `voice.py`
- [Weather lookup](https://github.com/varadganjoo/realtime-voice-and-vision-assistant/blob/main/voice.py): `voice.py`
- [Web search](https://github.com/varadganjoo/realtime-voice-and-vision-assistant/blob/main/voice.py): `voice.py`
- [Screen and webcam](https://github.com/varadganjoo/realtime-voice-and-vision-assistant/blob/main/voice.py): `voice.py`
- **External services**

### Response output

- [Speech playback](https://github.com/varadganjoo/realtime-voice-and-vision-assistant/blob/main/tts.py): `tts.py`

### Other components

- **User**

## Connections

- User → Speech input: speaks to (evidence: `README.md`)
- Speech input → Transcription: records speech (evidence: `README.md`)
- Transcription → Query processing: starts processing (evidence: `voice.py`)
- Microphone GUI → Speech input: controls microphone (evidence: `README.md`)
- Query processing → Tool routing: routes query (evidence: `README.md`)
- Tool routing → Tool dispatch: dispatches tools (evidence: `README.md`)
- Tool dispatch → Approval gate: checks sensitive actions (evidence: `README.md`)
- Tool dispatch → Code execution: runs generated code (evidence: `README.md`)
- Tool dispatch → System control: invokes controls (evidence: `README.md`)
- Tool dispatch → Weather lookup: invokes lookup (evidence: `README.md`)
- Tool dispatch → Web search: invokes search (evidence: `README.md`)
- Tool dispatch → Screen and webcam: invokes capture (evidence: `README.md`)
- Weather lookup → External services: requests weather data (evidence: `voice.py`)
- Web search → External services: searches web (evidence: `README.md`)
- Screen and webcam → External services: uses AI analysis (evidence: `README.md`)
- Tool dispatch → Answer generation: provides tool results (evidence: `README.md`)
- Query processing → Answer generation: prepares answer (evidence: `README.md`)
- Answer generation → Speech playback: speaks response (evidence: `voice.py`)
- Speech playback → User: plays audio (evidence: `README.md`)
