# mrshiva0107/resilient-supply-chain_ai-agent architecture

> Architecture diagram of the GitHub repository mrshiva0107/resilient-supply-chain_ai-agent, 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/mrshiva0107/resilient-supply-chain_ai-agent
- Repository: https://github.com/mrshiva0107/resilient-supply-chain_ai-agent

## Overview

The Resilient Supply Chain Platform is a dashboard and API for assessing a disrupted multi-echelon network, generating and approving recovery plans, simulating execution, and benchmarking alternatives. The principal workflow runs from planner review through agent analysis and optimization to approval and simulated execution; audit and KPI benchmarking are supporting branches. The README documents capabilities whose implementation was not sampled, so those components are represented at their exact tree paths. Dashed links mark frontend-to-backend wiring not established by the excerpts.

Main entry points: [`backend/app/agents/coordinator.py`](https://github.com/mrshiva0107/resilient-supply-chain_ai-agent/blob/main/backend/app/agents/coordinator.py) (Recovery Coordinator), [`backend/app/evaluation/benchmark_runner.py`](https://github.com/mrshiva0107/resilient-supply-chain_ai-agent/blob/main/backend/app/evaluation/benchmark_runner.py) (Benchmark Runner), [`backend/app/api/plans.py`](https://github.com/mrshiva0107/resilient-supply-chain_ai-agent/blob/main/backend/app/api/plans.py) (Plan API), [`backend/app/main.py`](https://github.com/mrshiva0107/resilient-supply-chain_ai-agent/blob/main/backend/app/main.py) (FastAPI Application)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_experience["Planner Experience"]
  node_dashboard["Recovery Dashboard<br/>[page.tsx]"]
  node_topology["Network Topology<br/>[TopologyView.tsx]"]
  node_agent_ui["Agent Review<br/>[AgentsView.tsx]"]
  node_plan_ui["Plan Approval<br/>[PlanView.tsx]"]
  node_execution_ui["Execution View<br/>[ExecutionView.tsx]"]
  node_benchmark_ui["Benchmark View<br/>[BenchmarksView.tsx]"]
end

subgraph group_api["API and Governance"]
  node_api_app["FastAPI Application<br/>[main.py]"]
  node_scenario_api["Scenario API<br/>[scenarios.py]"]
  node_plan_api["Plan API<br/>[plans.py]"]
  node_execution_api["Execution API<br/>[execution.py]"]
  node_auth_api["Authentication API<br/>[auth.py]"]
  node_auth_security["JWT and Password Security<br/>[auth.py]"]
  node_database[("Relational Database<br/>[database.py]")]
  node_audit_api["Audit API<br/>[audit.py]"]
end

subgraph group_planning["Recovery Planning"]
  node_coordinator["Recovery Coordinator<br/>[coordinator.py]"]
  node_demand_agent["Demand Agent<br/>[demand_agent.py]"]
  node_inventory_agent["Inventory Agent<br/>[inventory_agent.py]"]
  node_supplier_agent["Supplier Risk Agent"]
  node_logistics_agent["Logistics Agent<br/>[logistics_agent.py]"]
  node_optimizer["CP-SAT Optimizer<br/>[solver.py]"]
  node_plan_validator["Independent Validator<br/>[validator.py]"]
  node_plan_records["Versioned Plans<br/>[plan.py]"]
end

subgraph group_operations["Operations and Evaluation"]
  node_simulation["Daily Simulation<br/>[engine.py]"]
  node_execution_runner["Action Execution<br/>[executor.py]"]
  node_benchmark_runner["Benchmark Runner"]
  node_kpi["Industrial KPIs<br/>[kpi.py]"]
  node_baseline_rop["Reorder-Point Baseline<br/>[reorder_point.py]"]
  node_baseline_opt["Optimization Baseline"]
end

subgraph group_domain["Supply Network Data"]
  node_scenario_data["Scenario Generator<br/>[generator.py]"]
  node_data_validator["Network Data Validator<br/>[validator.py]"]
  node_network_models["Supply Network Models<br/>[supply_chain.py]"]
  node_scenario_models["Scenario Snapshots<br/>[scenario.py]"]
end

node_planner(("Planner"))

node_planner -->|"reviews"| node_dashboard
node_dashboard -.->|"inspects"| node_topology
node_dashboard -.->|"opens"| node_agent_ui
node_planner -->|"reruns agents"| node_agent_ui
node_planner -->|"requests plan"| node_plan_ui
node_planner -->|"approves plan"| node_plan_ui
node_planner -->|"starts simulation"| node_execution_ui
node_planner -->|"runs benchmarks"| node_benchmark_ui
node_api_app -->|"mounts routes"| node_scenario_api
node_api_app -->|"mounts routes"| node_plan_api
node_auth_api -->|"authenticates"| node_auth_security
node_auth_api -->|"uses sessions"| node_database
node_auth_api -.->|"uses user model"| node_plan_records
node_scenario_data -->|"creates network entities"| node_network_models
node_scenario_data -->|"creates scenario"| node_scenario_models
node_api_app -->|"seeds scenario"| node_scenario_data
node_coordinator -->|"runs"| node_demand_agent
node_coordinator -->|"runs"| node_inventory_agent
node_coordinator -->|"runs"| node_supplier_agent
node_coordinator -->|"runs"| node_logistics_agent
node_coordinator -->|"optimizes candidates"| node_optimizer
node_coordinator -->|"validates solution"| node_plan_validator
node_optimizer -->|"produces actions"| node_plan_records
node_plan_api -->|"generates plan"| node_coordinator
node_plan_api -.->|"stores approvals and plans"| node_plan_records
node_execution_api -.->|"dispatches actions"| node_execution_runner
node_execution_runner -->|"executes approved actions"| node_simulation
node_benchmark_runner -->|"evaluates"| node_baseline_rop
node_benchmark_runner -->|"evaluates"| node_baseline_opt
node_benchmark_runner -->|"evaluates agent plan"| node_coordinator
node_benchmark_runner -->|"simulates plans"| node_simulation
node_benchmark_runner -->|"measures outcomes"| node_kpi
node_data_validator -->|"validates entities"| node_network_models
node_scenario_api -.->|"persists scenarios"| node_database
node_plan_ui -.->|"requests planning"| node_plan_api
node_agent_ui -.->|"uses scenario snapshot"| node_scenario_api
node_execution_ui -.->|"requests execution"| node_execution_api
node_benchmark_ui -.->|"requests comparison"| node_benchmark_runner

click node_dashboard "https://github.com/mrshiva0107/resilient-supply-chain_ai-agent/blob/main/frontend/src/app/page.tsx"
click node_topology "https://github.com/mrshiva0107/resilient-supply-chain_ai-agent/blob/main/frontend/src/components/TopologyView.tsx"
click node_agent_ui "https://github.com/mrshiva0107/resilient-supply-chain_ai-agent/blob/main/frontend/src/components/AgentsView.tsx"
click node_plan_ui "https://github.com/mrshiva0107/resilient-supply-chain_ai-agent/blob/main/frontend/src/components/PlanView.tsx"
click node_execution_ui "https://github.com/mrshiva0107/resilient-supply-chain_ai-agent/blob/main/frontend/src/components/ExecutionView.tsx"
click node_benchmark_ui "https://github.com/mrshiva0107/resilient-supply-chain_ai-agent/blob/main/frontend/src/components/BenchmarksView.tsx"
click node_api_app "https://github.com/mrshiva0107/resilient-supply-chain_ai-agent/blob/main/backend/app/main.py"
click node_scenario_api "https://github.com/mrshiva0107/resilient-supply-chain_ai-agent/blob/main/backend/app/api/scenarios.py"
click node_plan_api "https://github.com/mrshiva0107/resilient-supply-chain_ai-agent/blob/main/backend/app/api/plans.py"
click node_execution_api "https://github.com/mrshiva0107/resilient-supply-chain_ai-agent/blob/main/backend/app/api/execution.py"
click node_auth_api "https://github.com/mrshiva0107/resilient-supply-chain_ai-agent/blob/main/backend/app/api/auth.py"
click node_auth_security "https://github.com/mrshiva0107/resilient-supply-chain_ai-agent/blob/main/backend/app/security/auth.py"
click node_database "https://github.com/mrshiva0107/resilient-supply-chain_ai-agent/blob/main/backend/app/database.py"
click node_coordinator "https://github.com/mrshiva0107/resilient-supply-chain_ai-agent/blob/main/backend/app/agents/coordinator.py"
click node_demand_agent "https://github.com/mrshiva0107/resilient-supply-chain_ai-agent/blob/main/backend/app/agents/demand_agent.py"
click node_inventory_agent "https://github.com/mrshiva0107/resilient-supply-chain_ai-agent/blob/main/backend/app/agents/inventory_agent.py"
click node_supplier_agent "https://github.com/mrshiva0107/resilient-supply-chain_ai-agent/blob/main/backend/app/agents/supplier_risk_agent.py"
click node_logistics_agent "https://github.com/mrshiva0107/resilient-supply-chain_ai-agent/blob/main/backend/app/agents/logistics_agent.py"
click node_optimizer "https://github.com/mrshiva0107/resilient-supply-chain_ai-agent/blob/main/backend/app/optimization/solver.py"
click node_plan_validator "https://github.com/mrshiva0107/resilient-supply-chain_ai-agent/blob/main/backend/app/optimization/validator.py"
click node_plan_records "https://github.com/mrshiva0107/resilient-supply-chain_ai-agent/blob/main/backend/app/models/plan.py"
click node_simulation "https://github.com/mrshiva0107/resilient-supply-chain_ai-agent/blob/main/backend/app/simulation/engine.py"
click node_execution_runner "https://github.com/mrshiva0107/resilient-supply-chain_ai-agent/blob/main/backend/app/simulation/executor.py"
click node_benchmark_runner "https://github.com/mrshiva0107/resilient-supply-chain_ai-agent/blob/main/backend/app/evaluation/benchmark_runner.py"
click node_kpi "https://github.com/mrshiva0107/resilient-supply-chain_ai-agent/blob/main/backend/app/evaluation/kpi.py"
click node_baseline_rop "https://github.com/mrshiva0107/resilient-supply-chain_ai-agent/blob/main/backend/app/baselines/reorder_point.py"
click node_baseline_opt "https://github.com/mrshiva0107/resilient-supply-chain_ai-agent/blob/main/backend/app/baselines/optimization_only.py"
click node_scenario_data "https://github.com/mrshiva0107/resilient-supply-chain_ai-agent/blob/main/backend/app/data/generator.py"
click node_data_validator "https://github.com/mrshiva0107/resilient-supply-chain_ai-agent/blob/main/backend/app/data/validator.py"
click node_network_models "https://github.com/mrshiva0107/resilient-supply-chain_ai-agent/blob/main/backend/app/models/supply_chain.py"
click node_scenario_models "https://github.com/mrshiva0107/resilient-supply-chain_ai-agent/blob/main/backend/app/models/scenario.py"
click node_audit_api "https://github.com/mrshiva0107/resilient-supply-chain_ai-agent/blob/main/backend/app/api/audit.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_dashboard,node_topology,node_agent_ui,node_plan_ui,node_execution_ui,node_benchmark_ui toneBlue
class node_api_app,node_scenario_api,node_plan_api,node_execution_api,node_auth_api,node_auth_security,node_database,node_audit_api toneAmber
class node_coordinator,node_demand_agent,node_inventory_agent,node_supplier_agent,node_logistics_agent,node_optimizer,node_plan_validator,node_plan_records toneMint
class node_simulation,node_execution_runner,node_benchmark_runner,node_kpi,node_baseline_rop,node_baseline_opt toneRose
class node_scenario_data,node_data_validator,node_network_models,node_scenario_models,node_planner toneIndigo
```

## Components

### Planner Experience

- [Recovery Dashboard](https://github.com/mrshiva0107/resilient-supply-chain_ai-agent/blob/main/frontend/src/app/page.tsx): `frontend/src/app/page.tsx`
- [Network Topology](https://github.com/mrshiva0107/resilient-supply-chain_ai-agent/blob/main/frontend/src/components/TopologyView.tsx): `frontend/src/components/TopologyView.tsx`
- [Agent Review](https://github.com/mrshiva0107/resilient-supply-chain_ai-agent/blob/main/frontend/src/components/AgentsView.tsx): `frontend/src/components/AgentsView.tsx`
- [Plan Approval](https://github.com/mrshiva0107/resilient-supply-chain_ai-agent/blob/main/frontend/src/components/PlanView.tsx): `frontend/src/components/PlanView.tsx`
- [Execution View](https://github.com/mrshiva0107/resilient-supply-chain_ai-agent/blob/main/frontend/src/components/ExecutionView.tsx): `frontend/src/components/ExecutionView.tsx`
- [Benchmark View](https://github.com/mrshiva0107/resilient-supply-chain_ai-agent/blob/main/frontend/src/components/BenchmarksView.tsx): `frontend/src/components/BenchmarksView.tsx`

### API and Governance

- [FastAPI Application](https://github.com/mrshiva0107/resilient-supply-chain_ai-agent/blob/main/backend/app/main.py): `backend/app/main.py`
- [Scenario API](https://github.com/mrshiva0107/resilient-supply-chain_ai-agent/blob/main/backend/app/api/scenarios.py): `backend/app/api/scenarios.py`
- [Plan API](https://github.com/mrshiva0107/resilient-supply-chain_ai-agent/blob/main/backend/app/api/plans.py): `backend/app/api/plans.py`
- [Execution API](https://github.com/mrshiva0107/resilient-supply-chain_ai-agent/blob/main/backend/app/api/execution.py): `backend/app/api/execution.py`
- [Authentication API](https://github.com/mrshiva0107/resilient-supply-chain_ai-agent/blob/main/backend/app/api/auth.py): `backend/app/api/auth.py`
- [JWT and Password Security](https://github.com/mrshiva0107/resilient-supply-chain_ai-agent/blob/main/backend/app/security/auth.py): `backend/app/security/auth.py`
- [Relational Database](https://github.com/mrshiva0107/resilient-supply-chain_ai-agent/blob/main/backend/app/database.py): `backend/app/database.py`
- [Audit API](https://github.com/mrshiva0107/resilient-supply-chain_ai-agent/blob/main/backend/app/api/audit.py): `backend/app/api/audit.py`

### Recovery Planning

- [Recovery Coordinator](https://github.com/mrshiva0107/resilient-supply-chain_ai-agent/blob/main/backend/app/agents/coordinator.py): `backend/app/agents/coordinator.py`
- [Demand Agent](https://github.com/mrshiva0107/resilient-supply-chain_ai-agent/blob/main/backend/app/agents/demand_agent.py): `backend/app/agents/demand_agent.py`
- [Inventory Agent](https://github.com/mrshiva0107/resilient-supply-chain_ai-agent/blob/main/backend/app/agents/inventory_agent.py): `backend/app/agents/inventory_agent.py`
- [Supplier Risk Agent](https://github.com/mrshiva0107/resilient-supply-chain_ai-agent/blob/main/backend/app/agents/supplier_risk_agent.py): `backend/app/agents/supplier_risk_agent.py`
- [Logistics Agent](https://github.com/mrshiva0107/resilient-supply-chain_ai-agent/blob/main/backend/app/agents/logistics_agent.py): `backend/app/agents/logistics_agent.py`
- [CP-SAT Optimizer](https://github.com/mrshiva0107/resilient-supply-chain_ai-agent/blob/main/backend/app/optimization/solver.py): `backend/app/optimization/solver.py`
- [Independent Validator](https://github.com/mrshiva0107/resilient-supply-chain_ai-agent/blob/main/backend/app/optimization/validator.py): `backend/app/optimization/validator.py`
- [Versioned Plans](https://github.com/mrshiva0107/resilient-supply-chain_ai-agent/blob/main/backend/app/models/plan.py): `backend/app/models/plan.py`

### Operations and Evaluation

- [Daily Simulation](https://github.com/mrshiva0107/resilient-supply-chain_ai-agent/blob/main/backend/app/simulation/engine.py): `backend/app/simulation/engine.py`
- [Action Execution](https://github.com/mrshiva0107/resilient-supply-chain_ai-agent/blob/main/backend/app/simulation/executor.py): `backend/app/simulation/executor.py`
- [Benchmark Runner](https://github.com/mrshiva0107/resilient-supply-chain_ai-agent/blob/main/backend/app/evaluation/benchmark_runner.py): `backend/app/evaluation/benchmark_runner.py`
- [Industrial KPIs](https://github.com/mrshiva0107/resilient-supply-chain_ai-agent/blob/main/backend/app/evaluation/kpi.py): `backend/app/evaluation/kpi.py`
- [Reorder-Point Baseline](https://github.com/mrshiva0107/resilient-supply-chain_ai-agent/blob/main/backend/app/baselines/reorder_point.py): `backend/app/baselines/reorder_point.py`
- [Optimization Baseline](https://github.com/mrshiva0107/resilient-supply-chain_ai-agent/blob/main/backend/app/baselines/optimization_only.py): `backend/app/baselines/optimization_only.py`

### Supply Network Data

- [Scenario Generator](https://github.com/mrshiva0107/resilient-supply-chain_ai-agent/blob/main/backend/app/data/generator.py): `backend/app/data/generator.py`
- [Network Data Validator](https://github.com/mrshiva0107/resilient-supply-chain_ai-agent/blob/main/backend/app/data/validator.py): `backend/app/data/validator.py`
- [Supply Network Models](https://github.com/mrshiva0107/resilient-supply-chain_ai-agent/blob/main/backend/app/models/supply_chain.py): `backend/app/models/supply_chain.py`
- [Scenario Snapshots](https://github.com/mrshiva0107/resilient-supply-chain_ai-agent/blob/main/backend/app/models/scenario.py): `backend/app/models/scenario.py`

### Other components

- **Planner**

## Connections

- Planner → Recovery Dashboard: reviews (evidence: `README.md`)
- Recovery Dashboard → Network Topology: inspects
- Recovery Dashboard → Agent Review: opens
- Planner → Agent Review: reruns agents (evidence: `README.md`)
- Planner → Plan Approval: requests plan (evidence: `README.md`)
- Planner → Plan Approval: approves plan (evidence: `README.md`)
- Planner → Execution View: starts simulation (evidence: `README.md`)
- Planner → Benchmark View: runs benchmarks (evidence: `README.md`)
- FastAPI Application → Scenario API: mounts routes (evidence: `backend/app/main.py`)
- FastAPI Application → Plan API: mounts routes (evidence: `backend/app/main.py`)
- Authentication API → JWT and Password Security: authenticates (evidence: `backend/app/api/auth.py`)
- Authentication API → Relational Database: uses sessions (evidence: `backend/app/api/auth.py`)
- Authentication API → Versioned Plans: uses user model
- Scenario Generator → Supply Network Models: creates network entities (evidence: `backend/app/data/generator.py`)
- Scenario Generator → Scenario Snapshots: creates scenario (evidence: `backend/app/data/generator.py`)
- FastAPI Application → Scenario Generator: seeds scenario (evidence: `backend/app/main.py`)
- Recovery Coordinator → Demand Agent: runs (evidence: `backend/app/agents/coordinator.py`)
- Recovery Coordinator → Inventory Agent: runs (evidence: `backend/app/agents/coordinator.py`)
- Recovery Coordinator → Supplier Risk Agent: runs (evidence: `backend/app/agents/coordinator.py`)
- Recovery Coordinator → Logistics Agent: runs (evidence: `backend/app/agents/coordinator.py`)
- Recovery Coordinator → CP-SAT Optimizer: optimizes candidates (evidence: `backend/app/agents/coordinator.py`)
- Recovery Coordinator → Independent Validator: validates solution (evidence: `backend/app/agents/coordinator.py`)
- CP-SAT Optimizer → Versioned Plans: produces actions (evidence: `backend/app/optimization/solver.py`)
- Plan API → Recovery Coordinator: generates plan (evidence: `README.md`)
- Plan API → Versioned Plans: stores approvals and plans
- Execution API → Action Execution: dispatches actions
- Action Execution → Daily Simulation: executes approved actions (evidence: `README.md`)
- Benchmark Runner → Reorder-Point Baseline: evaluates (evidence: `backend/app/evaluation/benchmark_runner.py`)
- Benchmark Runner → Optimization Baseline: evaluates (evidence: `backend/app/evaluation/benchmark_runner.py`)
- Benchmark Runner → Recovery Coordinator: evaluates agent plan (evidence: `backend/app/evaluation/benchmark_runner.py`)
- Benchmark Runner → Daily Simulation: simulates plans (evidence: `backend/app/evaluation/benchmark_runner.py`)
- Benchmark Runner → Industrial KPIs: measures outcomes (evidence: `backend/app/evaluation/benchmark_runner.py`)
- Network Data Validator → Supply Network Models: validates entities (evidence: `backend/app/data/validator.py`)
- Scenario API → Relational Database: persists scenarios
- Plan Approval → Plan API: requests planning
- Agent Review → Scenario API: uses scenario snapshot
- Execution View → Execution API: requests execution
- Benchmark View → Benchmark Runner: requests comparison
