# janvee1201/auditpilot architecture

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

- Interactive diagram: https://gitdiagram.com/janvee1201/auditpilot
- Repository: https://github.com/janvee1201/auditpilot

## Overview

AuditPilot is a multi-agent business-process automation product: requests are classified and routed into onboarding, procurement-to-payment, or meeting-to-task workflows, with shared pattern memory influencing error recovery. Its FastAPI API exposes workflow and operational endpoints, while a scheduled briefing synthesizes recent activity for email delivery. The React application provides the user-facing interface. The graph preserves documented workflow stages and capabilities; unsampled workflow internals are represented at their existing directories, and no frontend-to-API call is asserted because the supplied evidence does not show one.

Main entry points: [`backend/orchestrator/graph.py`](https://github.com/janvee1201/auditpilot/blob/main/backend/orchestrator/graph.py) (Master Orchestrator), [`backend/w4/agent.py`](https://github.com/janvee1201/auditpilot/blob/main/backend/w4/agent.py) (Pattern Memory), [`backend/api/main.py`](https://github.com/janvee1201/auditpilot/blob/main/backend/api/main.py) (FastAPI Application), [`backend/modules/scheduler.py`](https://github.com/janvee1201/auditpilot/blob/main/backend/modules/scheduler.py) (Briefing Scheduler)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_interface["User Interface"]
  node_frontend["Web Application<br/>[App.tsx]"]
end

subgraph group_api["API and Orchestration"]
  node_api_app["FastAPI Application<br/>[main.py]"]
  node_workflow_api["Workflow API<br/>[workflow.py]"]
  node_ops_api["Operational API"]
  node_master["Master Orchestrator<br/>[graph.py]"]
  node_intent["Intent Classification<br/>[intent_classify.py]"]
end

subgraph group_workflows["Business Workflows"]
  node_w1["W1 Onboarding"]
  node_w1_error["W1 Error Recovery<br/>[error.py]"]
  node_w2["W2 Procurement"]
  node_w2_recovery["W2 Decision Routing<br/>[orchestrator.py]"]
  node_w3_intake["Meeting Intake<br/>[intake.py]"]
  node_w3_extract["Task Extraction<br/>[extraction.py]"]
  node_w3_owner["Owner Resolution"]
  node_w3_writer["Task Writing<br/>[task_writer.py]"]
  node_w3_error["W3 Error Handling<br/>[error.py]"]
end

subgraph group_intelligence["Memory and Briefings"]
  node_w4["Pattern Memory<br/>[agent.py]"]
  node_db[("Shared SQLite<br/>[db.py]")]
  node_scheduler["Briefing Scheduler<br/>[scheduler.py]"]
  node_briefing["Briefing Generator"]
  node_email["Email Delivery<br/>[email_sender.py]"]
end

node_user(("Operator"))

node_user -->|"uses"| node_frontend
node_api_app -->|"registers"| node_workflow_api
node_api_app -->|"registers"| node_ops_api
node_workflow_api -->|"invokes"| node_master
node_master -->|"classifies"| node_intent
node_master -->|"dispatches"| node_w1
node_master -->|"dispatches"| node_w2
node_master -->|"dispatches"| node_w3_intake
node_w1 -->|"handles errors"| node_w1_error
node_w1_error -->|"requests decision"| node_w4
node_w2 -->|"routes errors"| node_w2_recovery
node_w2_recovery -->|"requests decision"| node_w4
node_w3_intake -->|"passes notes"| node_w3_extract
node_w3_extract -->|"passes tasks"| node_w3_owner
node_w3_owner -->|"passes assignments"| node_w3_writer
node_w3_error -->|"requests decision"| node_w4
node_w4 -->|"reads and updates"| node_db
node_w3_writer -->|"writes tasks"| node_db
node_api_app -->|"starts scheduler"| node_scheduler
node_scheduler -->|"generates briefing"| node_briefing
node_scheduler -->|"delivers briefing"| node_email
node_briefing -->|"reads activity"| node_db

click node_frontend "https://github.com/janvee1201/auditpilot/blob/main/frontend/src/App.tsx"
click node_api_app "https://github.com/janvee1201/auditpilot/blob/main/backend/api/main.py"
click node_workflow_api "https://github.com/janvee1201/auditpilot/blob/main/backend/api/routes/workflow.py"
click node_ops_api "https://github.com/janvee1201/auditpilot/tree/main/backend/api/routes"
click node_master "https://github.com/janvee1201/auditpilot/blob/main/backend/orchestrator/graph.py"
click node_intent "https://github.com/janvee1201/auditpilot/blob/main/backend/orchestrator/nodes/intent_classify.py"
click node_w1 "https://github.com/janvee1201/auditpilot/tree/main/backend/w1"
click node_w1_error "https://github.com/janvee1201/auditpilot/blob/main/backend/w1/nodes/error.py"
click node_w2 "https://github.com/janvee1201/auditpilot/tree/main/backend/w2"
click node_w2_recovery "https://github.com/janvee1201/auditpilot/blob/main/backend/w2/nodes/orchestrator.py"
click node_w3_intake "https://github.com/janvee1201/auditpilot/blob/main/backend/w3/nodes/intake.py"
click node_w3_extract "https://github.com/janvee1201/auditpilot/blob/main/backend/w3/nodes/extraction.py"
click node_w3_owner "https://github.com/janvee1201/auditpilot/blob/main/backend/w3/nodes/owner_resolution.py"
click node_w3_writer "https://github.com/janvee1201/auditpilot/blob/main/backend/w3/nodes/task_writer.py"
click node_w3_error "https://github.com/janvee1201/auditpilot/blob/main/backend/w3/nodes/error.py"
click node_w4 "https://github.com/janvee1201/auditpilot/blob/main/backend/w4/agent.py"
click node_db "https://github.com/janvee1201/auditpilot/blob/main/backend/shared/db.py"
click node_scheduler "https://github.com/janvee1201/auditpilot/blob/main/backend/modules/scheduler.py"
click node_briefing "https://github.com/janvee1201/auditpilot/blob/main/backend/modules/briefing_generator.py"
click node_email "https://github.com/janvee1201/auditpilot/blob/main/backend/modules/email_sender.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_frontend toneBlue
class node_api_app,node_workflow_api,node_ops_api,node_master,node_intent toneAmber
class node_w1,node_w1_error,node_w2,node_w2_recovery,node_w3_intake,node_w3_extract,node_w3_owner,node_w3_writer,node_w3_error toneMint
class node_w4,node_db,node_scheduler,node_briefing,node_email toneRose
class node_user toneIndigo
```

## Components

### User Interface

- [Web Application](https://github.com/janvee1201/auditpilot/blob/main/frontend/src/App.tsx): `frontend/src/App.tsx`

### API and Orchestration

- [FastAPI Application](https://github.com/janvee1201/auditpilot/blob/main/backend/api/main.py): `backend/api/main.py`
- [Workflow API](https://github.com/janvee1201/auditpilot/blob/main/backend/api/routes/workflow.py): `backend/api/routes/workflow.py`
- [Operational API](https://github.com/janvee1201/auditpilot/tree/main/backend/api/routes): `backend/api/routes`
- [Master Orchestrator](https://github.com/janvee1201/auditpilot/blob/main/backend/orchestrator/graph.py): `backend/orchestrator/graph.py`
- [Intent Classification](https://github.com/janvee1201/auditpilot/blob/main/backend/orchestrator/nodes/intent_classify.py): `backend/orchestrator/nodes/intent_classify.py`

### Business Workflows

- [W1 Onboarding](https://github.com/janvee1201/auditpilot/tree/main/backend/w1): `backend/w1`
- [W1 Error Recovery](https://github.com/janvee1201/auditpilot/blob/main/backend/w1/nodes/error.py): `backend/w1/nodes/error.py`
- [W2 Procurement](https://github.com/janvee1201/auditpilot/tree/main/backend/w2): `backend/w2`
- [W2 Decision Routing](https://github.com/janvee1201/auditpilot/blob/main/backend/w2/nodes/orchestrator.py): `backend/w2/nodes/orchestrator.py`
- [Meeting Intake](https://github.com/janvee1201/auditpilot/blob/main/backend/w3/nodes/intake.py): `backend/w3/nodes/intake.py`
- [Task Extraction](https://github.com/janvee1201/auditpilot/blob/main/backend/w3/nodes/extraction.py): `backend/w3/nodes/extraction.py`
- [Owner Resolution](https://github.com/janvee1201/auditpilot/blob/main/backend/w3/nodes/owner_resolution.py): `backend/w3/nodes/owner_resolution.py`
- [Task Writing](https://github.com/janvee1201/auditpilot/blob/main/backend/w3/nodes/task_writer.py): `backend/w3/nodes/task_writer.py`
- [W3 Error Handling](https://github.com/janvee1201/auditpilot/blob/main/backend/w3/nodes/error.py): `backend/w3/nodes/error.py`

### Memory and Briefings

- [Pattern Memory](https://github.com/janvee1201/auditpilot/blob/main/backend/w4/agent.py): `backend/w4/agent.py`
- [Shared SQLite](https://github.com/janvee1201/auditpilot/blob/main/backend/shared/db.py): `backend/shared/db.py`
- [Briefing Scheduler](https://github.com/janvee1201/auditpilot/blob/main/backend/modules/scheduler.py): `backend/modules/scheduler.py`
- [Briefing Generator](https://github.com/janvee1201/auditpilot/blob/main/backend/modules/briefing_generator.py): `backend/modules/briefing_generator.py`
- [Email Delivery](https://github.com/janvee1201/auditpilot/blob/main/backend/modules/email_sender.py): `backend/modules/email_sender.py`

### Other components

- **Operator**

## Connections

- Operator → Web Application: uses
- FastAPI Application → Workflow API: registers (evidence: `backend/api/main.py`)
- FastAPI Application → Operational API: registers (evidence: `backend/api/main.py`)
- Workflow API → Master Orchestrator: invokes (evidence: `backend/api/routes/workflow.py`)
- Master Orchestrator → Intent Classification: classifies (evidence: `backend/orchestrator/graph.py`)
- Master Orchestrator → W1 Onboarding: dispatches
- Master Orchestrator → W2 Procurement: dispatches
- Master Orchestrator → Meeting Intake: dispatches
- W1 Onboarding → W1 Error Recovery: handles errors (evidence: `backend/w1/nodes/error.py`)
- W1 Error Recovery → Pattern Memory: requests decision (evidence: `backend/w1/nodes/error.py`)
- W2 Procurement → W2 Decision Routing: routes errors
- W2 Decision Routing → Pattern Memory: requests decision (evidence: `backend/w2/nodes/orchestrator.py`)
- Meeting Intake → Task Extraction: passes notes
- Task Extraction → Owner Resolution: passes tasks
- Owner Resolution → Task Writing: passes assignments
- W3 Error Handling → Pattern Memory: requests decision (evidence: `backend/w3/nodes/error.py`)
- Pattern Memory → Shared SQLite: reads and updates (evidence: `backend/w4/agent.py`)
- Task Writing → Shared SQLite: writes tasks (evidence: `backend/w3/nodes/task_writer.py`)
- FastAPI Application → Briefing Scheduler: starts scheduler (evidence: `backend/api/main.py`)
- Briefing Scheduler → Briefing Generator: generates briefing (evidence: `backend/modules/scheduler.py`)
- Briefing Scheduler → Email Delivery: delivers briefing (evidence: `backend/modules/scheduler.py`)
- Briefing Generator → Shared SQLite: reads activity (evidence: `backend/modules/briefing_generator.py`)
