# aima0749/runway architecture

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

- Interactive diagram: https://gitdiagram.com/aima0749/runway
- Repository: https://github.com/aima0749/runway

## Overview

Runway Radar is a small-business cash-flow forecasting assistant. Users ask questions in the chat UI; the agent selects tools, which return forecast, invoice, and decision-support results that the assistant explains and checks. The forecasting domain includes scenario data, invoice-payment features and delay modeling, cash simulation, and decision analysis; parsing and invoice saving support chat workflows. The source index identifies additional evaluation and scripted-scenario modules, but their runtime links are not established by the excerpts, so uncertain connections are omitted.

Main entry points: [`src/tools.py`](https://github.com/aima0749/runway/blob/main/src/tools.py) (Agent tools), [`app/components/chat_ui.py`](https://github.com/aima0749/runway/blob/main/app/components/chat_ui.py) (Chat interface), [`src/simulate.py`](https://github.com/aima0749/runway/blob/main/src/simulate.py) (Cash simulation), [`src/agent.py`](https://github.com/aima0749/runway/blob/main/src/agent.py) (AI agent)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_chat["Chat assistant"]
  node_chatui["Chat interface<br/>[chat_ui.py]"]
  node_agent["AI agent<br/>[agent.py]"]
  node_offline["Offline assistant<br/>[offline.py]"]
  node_guardrail["Answer guardrail<br/>[guardrail.py]"]
end

subgraph group_forecast["Forecast engine"]
  node_data["Dataset loading<br/>[data.py]"]
  node_schemas["Domain schemas<br/>[schemas.py]"]
  node_features["Invoice features<br/>[features.py]"]
  node_delay["Payment delay model<br/>[delay_model.py]"]
  node_simulate["Cash simulation<br/>[simulate.py]"]
  node_config["Runtime configuration<br/>[config.py]"]
end

subgraph group_business["Business workflows"]
  node_parser["Invoice text parser<br/>[parser.py]"]
  node_tools["Agent tools<br/>[tools.py]"]
  node_decisions["Decision analysis<br/>[decisions.py]"]
  node_messages["Reminder messages<br/>[messages.py]"]
end

subgraph group_scenarios["Scenarios and evaluation"]
  node_generator["Synthetic data generator<br/>[generator.py]"]
  node_ayesha["Ayesha scenario<br/>[scenario_ayesha.py]"]
  node_evaluate["Forecast evaluation<br/>[evaluate.py]"]
  node_evalagent["Agent evaluation<br/>[eval_agent.py]"]
end

node_user(("Business user"))

node_user -->|"asks"| node_chatui
node_chatui -->|"asks offline"| node_offline
node_chatui -->|"gets LLM"| node_agent
node_chatui -->|"saves invoice"| node_tools
node_agent -->|"dispatches tools"| node_tools
node_tools -->|"runs what-if"| node_decisions
node_tools -.->|"parses invoice text"| node_parser
node_tools -.->|"drafts reminders"| node_messages
node_tools -.->|"loads dataset"| node_data
node_tools -.->|"builds forecast inputs"| node_features
node_features -.->|"fits payment model"| node_delay
node_delay -.->|"supplies payment samples"| node_simulate
node_simulate -->|"returns simulation result"| node_schemas
node_data -->|"uses dataset types"| node_schemas
node_generator -->|"uses data settings"| node_config
node_ayesha -.->|"builds model"| node_delay
node_ayesha -.->|"projects cash"| node_simulate
node_evaluate -.->|"evaluates forecasts"| node_simulate
node_evalagent -.->|"evaluates agent"| node_agent
node_offline -.->|"checks answers"| node_guardrail

click node_chatui "https://github.com/aima0749/runway/blob/main/app/components/chat_ui.py"
click node_agent "https://github.com/aima0749/runway/blob/main/src/agent.py"
click node_offline "https://github.com/aima0749/runway/blob/main/src/offline.py"
click node_guardrail "https://github.com/aima0749/runway/blob/main/src/guardrail.py"
click node_parser "https://github.com/aima0749/runway/blob/main/src/parser.py"
click node_tools "https://github.com/aima0749/runway/blob/main/src/tools.py"
click node_decisions "https://github.com/aima0749/runway/blob/main/src/decisions.py"
click node_messages "https://github.com/aima0749/runway/blob/main/src/messages.py"
click node_data "https://github.com/aima0749/runway/blob/main/src/data.py"
click node_schemas "https://github.com/aima0749/runway/blob/main/src/schemas.py"
click node_features "https://github.com/aima0749/runway/blob/main/src/features.py"
click node_delay "https://github.com/aima0749/runway/blob/main/src/delay_model.py"
click node_simulate "https://github.com/aima0749/runway/blob/main/src/simulate.py"
click node_generator "https://github.com/aima0749/runway/blob/main/src/generator.py"
click node_ayesha "https://github.com/aima0749/runway/blob/main/src/scenario_ayesha.py"
click node_evaluate "https://github.com/aima0749/runway/blob/main/src/evaluate.py"
click node_evalagent "https://github.com/aima0749/runway/blob/main/src/eval_agent.py"
click node_config "https://github.com/aima0749/runway/blob/main/config.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_chatui,node_agent,node_offline,node_guardrail,node_user toneBlue
class node_data,node_schemas,node_features,node_delay,node_simulate,node_config toneAmber
class node_parser,node_tools,node_decisions,node_messages toneMint
class node_generator,node_ayesha,node_evaluate,node_evalagent toneRose
```

## Components

### Chat assistant

- [Chat interface](https://github.com/aima0749/runway/blob/main/app/components/chat_ui.py): `app/components/chat_ui.py`
- [AI agent](https://github.com/aima0749/runway/blob/main/src/agent.py): `src/agent.py`
- [Offline assistant](https://github.com/aima0749/runway/blob/main/src/offline.py): `src/offline.py`
- [Answer guardrail](https://github.com/aima0749/runway/blob/main/src/guardrail.py): `src/guardrail.py`

### Forecast engine

- [Dataset loading](https://github.com/aima0749/runway/blob/main/src/data.py): `src/data.py`
- [Domain schemas](https://github.com/aima0749/runway/blob/main/src/schemas.py): `src/schemas.py`
- [Invoice features](https://github.com/aima0749/runway/blob/main/src/features.py): `src/features.py`
- [Payment delay model](https://github.com/aima0749/runway/blob/main/src/delay_model.py): `src/delay_model.py`
- [Cash simulation](https://github.com/aima0749/runway/blob/main/src/simulate.py): `src/simulate.py`
- [Runtime configuration](https://github.com/aima0749/runway/blob/main/config.py): `config.py`

### Business workflows

- [Invoice text parser](https://github.com/aima0749/runway/blob/main/src/parser.py): `src/parser.py`
- [Agent tools](https://github.com/aima0749/runway/blob/main/src/tools.py): `src/tools.py`
- [Decision analysis](https://github.com/aima0749/runway/blob/main/src/decisions.py): `src/decisions.py`
- [Reminder messages](https://github.com/aima0749/runway/blob/main/src/messages.py): `src/messages.py`

### Scenarios and evaluation

- [Synthetic data generator](https://github.com/aima0749/runway/blob/main/src/generator.py): `src/generator.py`
- [Ayesha scenario](https://github.com/aima0749/runway/blob/main/src/scenario_ayesha.py): `src/scenario_ayesha.py`
- [Forecast evaluation](https://github.com/aima0749/runway/blob/main/src/evaluate.py): `src/evaluate.py`
- [Agent evaluation](https://github.com/aima0749/runway/blob/main/src/eval_agent.py): `src/eval_agent.py`

### Other components

- **Business user**

## Connections

- Business user → Chat interface: asks (evidence: `app/components/chat_ui.py`)
- Chat interface → Offline assistant: asks offline (evidence: `app/components/chat_ui.py`)
- Chat interface → AI agent: gets LLM (evidence: `app/components/chat_ui.py`)
- Chat interface → Agent tools: saves invoice (evidence: `app/components/chat_ui.py`)
- AI agent → Agent tools: dispatches tools (evidence: `src/agent.py`)
- Agent tools → Decision analysis: runs what-if (evidence: `src/tools.py`)
- Agent tools → Invoice text parser: parses invoice text (evidence: `src/tools.py`)
- Agent tools → Reminder messages: drafts reminders (evidence: `src/tools.py`)
- Agent tools → Dataset loading: loads dataset
- Agent tools → Invoice features: builds forecast inputs (evidence: `src/tools.py`)
- Invoice features → Payment delay model: fits payment model (evidence: `src/delay_model.py`)
- Payment delay model → Cash simulation: supplies payment samples
- Cash simulation → Domain schemas: returns simulation result (evidence: `src/simulate.py`)
- Dataset loading → Domain schemas: uses dataset types (evidence: `src/data.py`)
- Synthetic data generator → Runtime configuration: uses data settings (evidence: `src/generator.py`)
- Ayesha scenario → Payment delay model: builds model (evidence: `src/scenario_ayesha.py`)
- Ayesha scenario → Cash simulation: projects cash (evidence: `src/scenario_ayesha.py`)
- Forecast evaluation → Cash simulation: evaluates forecasts (evidence: `src/evaluate.py`)
- Agent evaluation → AI agent: evaluates agent (evidence: `src/eval_agent.py`)
- Offline assistant → Answer guardrail: checks answers (evidence: `src/offline.py`)
