# vijdaancoding/rescue-ai architecture

> Architecture diagram of the GitHub repository vijdaancoding/rescue-ai, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-04-15). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/vijdaancoding/rescue-ai
- Repository: https://github.com/vijdaancoding/rescue-ai

## Overview

1. **Repository shape**
   - This is a small Python application packaged under `core/`.
   - The top-level architecture is centered around a runtime entrypoint, an agent layer, a room/server layer, and a few supporting modules for tasks, text-to-speech, and shared data models.

2. **Primary entrypoint**
   - `core/run.py` is the likely bootstrap path for the application.
   - It is the place where the program probably wires together the agent, room server, task logic, and any runtime configuration.

3. **Agent layer**
   - `core/agent.py` appears to define the general agent behavior and orchestration logic.
   - `core/rescue_agent.py` likely specializes that generic agent into the domain-specific “rescue” behavior, acting as the main business logic implementation.

4. **Room/server subsystem**
   - `core/room/server.py` suggests a server component that manages a “room” abstraction, likely coordinating participants, events, or sessions.
   - This is a separate boundary from the agent logic, implying the agent interacts with a session/state host rather than owning all state directly.

5. **Task subsystem**
   - `core/tasks.py` is likely where discrete work units, job definitions, or workflow steps are defined.
   - In the architecture diagram, this should sit between the agent decision-making layer and the operational actions it triggers.

6. **Speech/output integration**
   - `core/tts.py` provides text-to-speech functionality.
   - This is an external capability boundary: the core logic likely emits text, and this module converts or routes it into spoken/audio output.

7. **Shared data contracts**
   - `core/utils/models.py` is the shared model layer.
   - It likely defines the data structures used across the agent, tasks, and room/server modules, helping keep boundaries clean and reducing coupling.

8. **Dependency direction**
   - The expected flow is: `run.py` boots the system, the agent/rescue agent drives behavior, tasks structure work, the room server manages interaction/state, and TTS handles audio output.
   - Shared models are used horizontally by multiple subsystems rather than being owned by any one of them.

9. **Package and runtime boundary**
   - `pyproject.toml` and `uv.lock` indicate a modern Python package managed with `uv`.
   - That means the repo is self-contained at the application/package level rather than split into separate services.

10. **What to show in an architecture diagram**
   - Show one central application runtime with four meaningful boundaries: agent logic, room/server coordination, task/workflow execution, and TTS/output.
   - Place `utils/models.py` as the contract layer connecting them.
   - Avoid drawing a browser/frontend or database unless you confirm them elsewhere; the visible repo structure does not imply either one.

11. **Overall interpretation**
   - This repository looks like a domain-specific agent system for “rescue” scenarios, with interaction/session management and voice output support.
   - The architecture is modular and service-like inside a single Python codebase, with clear separation between orchestration, state/session handling, and external output integration.

Main entry points: [`core/run.py`](https://github.com/vijdaancoding/rescue-ai/blob/main/core/run.py) (Runtime), [`core/rescue_agent.py`](https://github.com/vijdaancoding/rescue-ai/blob/main/core/rescue_agent.py) (Rescue agent), [`core/utils/models.py`](https://github.com/vijdaancoding/rescue-ai/blob/main/core/utils/models.py) (Models), [`core/room/server.py`](https://github.com/vijdaancoding/rescue-ai/blob/main/core/room/server.py) (Room server)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_core["Core package"]
  node_run["Runtime<br/>bootstrap<br/>[run.py]"]
  node_agent["Agent<br/>orchestrator<br/>[agent.py]"]
  node_rescue_agent["Rescue agent<br/>domain agent<br/>[rescue_agent.py]"]
  node_room_server["Room server<br/>session host<br/>[server.py]"]
  node_tasks["Tasks<br/>workflow<br/>[tasks.py]"]
  node_tts["TTS<br/>output adapter<br/>[tts.py]"]
  node_models["Models<br/>shared contracts<br/>[models.py]"]
end

node_run -->|"starts"| node_agent
node_run -->|"selects"| node_rescue_agent
node_run -->|"hosts"| node_room_server
node_run -->|"loads"| node_tasks
node_run -->|"configures"| node_tts
node_run -->|"shares"| node_models
node_agent -->|"specializes"| node_rescue_agent
node_rescue_agent -->|"drives"| node_tasks
node_rescue_agent -->|"coordinates"| node_room_server
node_rescue_agent -->|"speaks"| node_tts
node_rescue_agent -->|"uses"| node_models
node_tasks -->|"schemas"| node_models
node_room_server -->|"validates"| node_models
node_tts -->|"formats"| node_models

click node_run "https://github.com/vijdaancoding/rescue-ai/blob/main/core/run.py"
click node_agent "https://github.com/vijdaancoding/rescue-ai/blob/main/core/agent.py"
click node_rescue_agent "https://github.com/vijdaancoding/rescue-ai/blob/main/core/rescue_agent.py"
click node_room_server "https://github.com/vijdaancoding/rescue-ai/blob/main/core/room/server.py"
click node_tasks "https://github.com/vijdaancoding/rescue-ai/blob/main/core/tasks.py"
click node_tts "https://github.com/vijdaancoding/rescue-ai/blob/main/core/tts.py"
click node_models "https://github.com/vijdaancoding/rescue-ai/blob/main/core/utils/models.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_run,node_agent,node_rescue_agent,node_room_server,node_tasks,node_tts,node_models toneBlue
```

## Components

### Core package

Application code under core/

- [Runtime](https://github.com/vijdaancoding/rescue-ai/blob/main/core/run.py): bootstrap · Application entrypoint and wiring · `core/run.py`
- [Agent](https://github.com/vijdaancoding/rescue-ai/blob/main/core/agent.py): orchestrator · General agent behavior and coordination · `core/agent.py`
- [Rescue agent](https://github.com/vijdaancoding/rescue-ai/blob/main/core/rescue_agent.py): domain agent · Domain-specific rescue behavior · `core/rescue_agent.py`
- [Room server](https://github.com/vijdaancoding/rescue-ai/blob/main/core/room/server.py): session host · Room/session coordination and state hosting · `core/room/server.py`
- [Tasks](https://github.com/vijdaancoding/rescue-ai/blob/main/core/tasks.py): workflow · Discrete work units and action steps · `core/tasks.py`
- [TTS](https://github.com/vijdaancoding/rescue-ai/blob/main/core/tts.py): output adapter · Text-to-speech integration boundary · `core/tts.py`
- [Models](https://github.com/vijdaancoding/rescue-ai/blob/main/core/utils/models.py): shared contracts · Shared data structures used across modules · `core/utils/models.py`

## Connections

- Runtime → Agent: starts · Bootstraps the agent layer
- Runtime → Rescue agent: selects · Wires the domain-specific implementation
- Runtime → Room server: hosts · Starts or connects the room/session boundary
- Runtime → Tasks: loads · Makes task logic available at startup
- Runtime → TTS: configures · Sets up speech output integration
- Runtime → Models: shares · Uses common data contracts during wiring
- Agent → Rescue agent: specializes · General behavior is extended by rescue logic
- Rescue agent → Tasks: drives · Plans or triggers task execution
- Rescue agent → Room server: coordinates · Acts within the room/session host
- Rescue agent → TTS: speaks · Emits text for spoken output
- Rescue agent → Models: uses · Consumes shared domain models
- Tasks → Models: schemas · Task definitions rely on shared contracts
- Room server → Models: validates · Uses shared models for session data
- TTS → Models: formats · May use shared models for output payloads
