# ahmedkrimi/multi-agents-paper-trail architecture

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

- Interactive diagram: https://gitdiagram.com/ahmedkrimi/multi-agents-paper-trail
- Repository: https://github.com/ahmedkrimi/multi-agents-paper-trail

## Overview

Beaver’s Choice is a multi-agent paper inventory and quoting system. A customer request enters the orchestrator, which coordinates extraction, catalog matching and stock/delivery checks, discount calculation, sale execution, restocking, and financial reporting; it then uses the shared order state to compose a response. The graph includes the catalog, embedding matcher, typed state, and SQLite-backed business helpers. Several service details come from README documentation and the source index; unsampled implementation links are omitted where their caller is not shown.

Main entry points: [`src/supply_chain_agents/order_services.py`](https://github.com/ahmedkrimi/multi-agents-paper-trail/blob/main/src/supply_chain_agents/order_services.py) (Order services), [`src/supply_chain_agents/agents.py`](https://github.com/ahmedkrimi/multi-agents-paper-trail/blob/main/src/supply_chain_agents/agents.py) (Orchestrator), [`src/supply_chain_agents/workflow_state.py`](https://github.com/ahmedkrimi/multi-agents-paper-trail/blob/main/src/supply_chain_agents/workflow_state.py) (Workflow state), [`src/supply_chain_agents/main.py`](https://github.com/ahmedkrimi/multi-agents-paper-trail/blob/main/src/supply_chain_agents/main.py) (Scenario runner)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_coordination["Workflow coordination"]
  node_runner["Scenario runner<br/>[main.py]"]
  node_orchestrator["Orchestrator<br/>[agents.py]"]
end

subgraph group_agents["Order agents"]
  node_order_agent["Order processor<br/>[agents.py]"]
  node_inventory_agent["Inventory manager<br/>[agents.py]"]
  node_quote_agent["Quote manager<br/>[agents.py]"]
  node_sales_agent["Sales manager<br/>[agents.py]"]
end

subgraph group_business["Business services"]
  node_order_services["Order services<br/>[order_services.py]"]
  node_matcher["Embedding matcher<br/>[embeddings.py]"]
  node_helpers["Database and finance helpers<br/>[utils.py]"]
end

subgraph group_foundation["Shared data and state"]
  node_catalog["Paper catalog<br/>[inventory.py]"]
  node_configuration["Runtime configuration<br/>[config.py]"]
  node_workflow_state["Workflow state<br/>[workflow_state.py]"]
  node_models["Typed order models<br/>[models.py]"]
  node_sqlite[("SQLite database<br/>[config.py]")]
end

node_customer(("Customer"))

node_customer -->|"submits request"| node_orchestrator
node_runner -->|"runs workflow"| node_orchestrator
node_orchestrator -->|"dispatches extraction"| node_order_agent
node_orchestrator -->|"dispatches checks"| node_inventory_agent
node_orchestrator -->|"dispatches quoting"| node_quote_agent
node_orchestrator -->|"dispatches sales"| node_sales_agent
node_orchestrator -->|"shares state"| node_workflow_state
node_order_agent -->|"calls extraction"| node_order_services
node_inventory_agent -->|"calls inventory tools"| node_order_services
node_quote_agent -->|"calls discount tool"| node_order_services
node_sales_agent -->|"calls sales tools"| node_order_services
node_order_services -->|"embeds catalog matches"| node_matcher
node_order_services -->|"uses business helpers"| node_helpers
node_order_services -->|"updates order state"| node_workflow_state
node_order_services -->|"reads and records transactions"| node_sqlite
node_helpers -->|"queries ledger"| node_sqlite
node_configuration -->|"builds catalog data"| node_catalog
node_configuration -->|"creates engine"| node_sqlite
node_workflow_state -->|"holds typed items"| node_models
node_runner -->|"initializes state"| node_workflow_state
node_runner -->|"loads runtime settings"| node_configuration

click node_runner "https://github.com/ahmedkrimi/multi-agents-paper-trail/blob/main/src/supply_chain_agents/main.py"
click node_orchestrator "https://github.com/ahmedkrimi/multi-agents-paper-trail/blob/main/src/supply_chain_agents/agents.py"
click node_order_agent "https://github.com/ahmedkrimi/multi-agents-paper-trail/blob/main/src/supply_chain_agents/agents.py"
click node_inventory_agent "https://github.com/ahmedkrimi/multi-agents-paper-trail/blob/main/src/supply_chain_agents/agents.py"
click node_quote_agent "https://github.com/ahmedkrimi/multi-agents-paper-trail/blob/main/src/supply_chain_agents/agents.py"
click node_sales_agent "https://github.com/ahmedkrimi/multi-agents-paper-trail/blob/main/src/supply_chain_agents/agents.py"
click node_order_services "https://github.com/ahmedkrimi/multi-agents-paper-trail/blob/main/src/supply_chain_agents/order_services.py"
click node_matcher "https://github.com/ahmedkrimi/multi-agents-paper-trail/blob/main/src/supply_chain_agents/embeddings.py"
click node_helpers "https://github.com/ahmedkrimi/multi-agents-paper-trail/blob/main/src/supply_chain_agents/utils.py"
click node_catalog "https://github.com/ahmedkrimi/multi-agents-paper-trail/blob/main/src/supply_chain_agents/inventory.py"
click node_configuration "https://github.com/ahmedkrimi/multi-agents-paper-trail/blob/main/src/supply_chain_agents/config.py"
click node_workflow_state "https://github.com/ahmedkrimi/multi-agents-paper-trail/blob/main/src/supply_chain_agents/workflow_state.py"
click node_models "https://github.com/ahmedkrimi/multi-agents-paper-trail/blob/main/src/supply_chain_agents/models.py"
click node_sqlite "https://github.com/ahmedkrimi/multi-agents-paper-trail/blob/main/src/supply_chain_agents/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_runner,node_orchestrator toneBlue
class node_order_agent,node_inventory_agent,node_quote_agent,node_sales_agent toneAmber
class node_order_services,node_matcher,node_helpers toneMint
class node_catalog,node_configuration,node_workflow_state,node_models,node_sqlite toneRose
class node_customer toneIndigo
```

## Components

### Workflow coordination

- [Scenario runner](https://github.com/ahmedkrimi/multi-agents-paper-trail/blob/main/src/supply_chain_agents/main.py): `src/supply_chain_agents/main.py`
- [Orchestrator](https://github.com/ahmedkrimi/multi-agents-paper-trail/blob/main/src/supply_chain_agents/agents.py): `src/supply_chain_agents/agents.py`

### Order agents

- [Order processor](https://github.com/ahmedkrimi/multi-agents-paper-trail/blob/main/src/supply_chain_agents/agents.py): `src/supply_chain_agents/agents.py`
- [Inventory manager](https://github.com/ahmedkrimi/multi-agents-paper-trail/blob/main/src/supply_chain_agents/agents.py): `src/supply_chain_agents/agents.py`
- [Quote manager](https://github.com/ahmedkrimi/multi-agents-paper-trail/blob/main/src/supply_chain_agents/agents.py): `src/supply_chain_agents/agents.py`
- [Sales manager](https://github.com/ahmedkrimi/multi-agents-paper-trail/blob/main/src/supply_chain_agents/agents.py): `src/supply_chain_agents/agents.py`

### Business services

- [Order services](https://github.com/ahmedkrimi/multi-agents-paper-trail/blob/main/src/supply_chain_agents/order_services.py): `src/supply_chain_agents/order_services.py`
- [Embedding matcher](https://github.com/ahmedkrimi/multi-agents-paper-trail/blob/main/src/supply_chain_agents/embeddings.py): `src/supply_chain_agents/embeddings.py`
- [Database and finance helpers](https://github.com/ahmedkrimi/multi-agents-paper-trail/blob/main/src/supply_chain_agents/utils.py): `src/supply_chain_agents/utils.py`

### Shared data and state

- [Paper catalog](https://github.com/ahmedkrimi/multi-agents-paper-trail/blob/main/src/supply_chain_agents/inventory.py): `src/supply_chain_agents/inventory.py`
- [Runtime configuration](https://github.com/ahmedkrimi/multi-agents-paper-trail/blob/main/src/supply_chain_agents/config.py): `src/supply_chain_agents/config.py`
- [Workflow state](https://github.com/ahmedkrimi/multi-agents-paper-trail/blob/main/src/supply_chain_agents/workflow_state.py): `src/supply_chain_agents/workflow_state.py`
- [Typed order models](https://github.com/ahmedkrimi/multi-agents-paper-trail/blob/main/src/supply_chain_agents/models.py): `src/supply_chain_agents/models.py`
- [SQLite database](https://github.com/ahmedkrimi/multi-agents-paper-trail/blob/main/src/supply_chain_agents/config.py): `src/supply_chain_agents/config.py`

### Other components

- **Customer**

## Connections

- Customer → Orchestrator: submits request (evidence: `README.md`)
- Scenario runner → Orchestrator: runs workflow (evidence: `src/supply_chain_agents/main.py`)
- Orchestrator → Order processor: dispatches extraction (evidence: `src/supply_chain_agents/agents.py`)
- Orchestrator → Inventory manager: dispatches checks (evidence: `src/supply_chain_agents/agents.py`)
- Orchestrator → Quote manager: dispatches quoting (evidence: `src/supply_chain_agents/agents.py`)
- Orchestrator → Sales manager: dispatches sales (evidence: `src/supply_chain_agents/agents.py`)
- Orchestrator → Workflow state: shares state (evidence: `README.md`)
- Order processor → Order services: calls extraction (evidence: `src/supply_chain_agents/agents.py`)
- Inventory manager → Order services: calls inventory tools (evidence: `src/supply_chain_agents/agents.py`)
- Quote manager → Order services: calls discount tool (evidence: `src/supply_chain_agents/agents.py`)
- Sales manager → Order services: calls sales tools (evidence: `src/supply_chain_agents/agents.py`)
- Order services → Embedding matcher: embeds catalog matches (evidence: `src/supply_chain_agents/order_services.py`)
- Order services → Database and finance helpers: uses business helpers (evidence: `src/supply_chain_agents/order_services.py`)
- Order services → Workflow state: updates order state (evidence: `README.md`)
- Order services → SQLite database: reads and records transactions (evidence: `README.md`)
- Database and finance helpers → SQLite database: queries ledger (evidence: `README.md`)
- Runtime configuration → Paper catalog: builds catalog data (evidence: `src/supply_chain_agents/config.py`)
- Runtime configuration → SQLite database: creates engine (evidence: `src/supply_chain_agents/config.py`)
- Workflow state → Typed order models: holds typed items (evidence: `src/supply_chain_agents/workflow_state.py`)
- Scenario runner → Workflow state: initializes state (evidence: `src/supply_chain_agents/main.py`)
- Scenario runner → Runtime configuration: loads runtime settings (evidence: `src/supply_chain_agents/main.py`)
