# jeevanreddy29/cube-round3-pod architecture

> Architecture diagram of the GitHub repository jeevanreddy29/cube-round3-pod, 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/jeevanreddy29/cube-round3-pod
- Repository: https://github.com/jeevanreddy29/cube-round3-pod

## Overview

This repository integrates five commerce-stage agents into a single evidence-backed workflow. A client submits a case through the workflow API or runner; the orchestrator routes applicable stages, supplies prior evidence, validates and records outputs, handles retries and overrides, then derives workflow status and a final commerce outcome. Agents can run in-process or over HTTP. The graph preserves each distinct stage rather than implying agents call one another. Source excerpts are incomplete, so only documented or indexed relationships are shown.

Main entry points: [`orchestration/orchestrator.py`](https://github.com/jeevanreddy29/cube-round3-pod/blob/main/orchestration/orchestrator.py) (Workflow orchestrator), [`orchestration/clients.py`](https://github.com/jeevanreddy29/cube-round3-pod/blob/main/orchestration/clients.py) (Agent clients), [`agents/receiving/app.py`](https://github.com/jeevanreddy29/cube-round3-pod/blob/main/agents/receiving/app.py) (Receiving), [`agents/prep/app.py`](https://github.com/jeevanreddy29/cube-round3-pod/blob/main/agents/prep/app.py) (Prep)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_entry["Workflow entry"]
  node_api["Workflow API<br/>[api.py]"]
  node_runner["Workflow runner<br/>[run.py]"]
end

subgraph group_engine["Orchestration"]
  node_orchestrator["Workflow orchestrator<br/>[orchestrator.py]"]
  node_clients["Agent clients<br/>[clients.py]"]
  node_rollup["Outcome rollup<br/>[rollup.py]"]
end

subgraph group_agents["Commerce stages"]
  node_receiving["Receiving<br/>[app.py]"]
  node_prep["Prep<br/>[app.py]"]
  node_pack["Pack<br/>[app.py]"]
  node_returns["Returns<br/>[app.py]"]
  node_recovery["Recovery<br/>[app.py]"]
end

subgraph group_contracts["Evidence contracts"]
  node_sampledata[("Sample data<br/>[sample_data.py]")]
  node_stubs["Stub helpers<br/>[stubs.py]"]
  node_records["Evidence records<br/>[records.py]"]
  node_schema["Schema validation<br/>[schema.py]"]
  node_server["Agent HTTP server<br/>[server.py]"]
end

subgraph group_state["Workflow state"]
  node_store[("State and evidence store<br/>[store.py]")]
  node_workflowstate["Workflow state"]
  node_evidence["Evidence records"]
  node_final["Final outcome"]
end

node_operator(("Workflow caller"))

node_operator -->|"submits case"| node_api
node_operator -->|"runs case"| node_runner
node_api -->|"starts workflow"| node_orchestrator
node_runner -->|"runs workflow"| node_orchestrator
node_api -->|"loads and saves"| node_store
node_orchestrator -->|"dispatches stages"| node_clients
node_clients -->|"invokes agent"| node_receiving
node_clients -->|"invokes agent"| node_prep
node_clients -->|"invokes agent"| node_pack
node_clients -->|"invokes agent"| node_returns
node_clients -->|"invokes agent"| node_recovery
node_orchestrator -->|"validates output"| node_schema
node_orchestrator -->|"reads and writes"| node_store
node_orchestrator -->|"derives outcome"| node_rollup
node_orchestrator -->|"updates state"| node_workflowstate
node_orchestrator -->|"records evidence"| node_evidence
node_orchestrator -->|"derives outcome"| node_final
node_receiving -->|"builds evidence"| node_records
node_prep -->|"builds evidence"| node_records
node_pack -->|"builds evidence"| node_records
node_returns -->|"builds evidence"| node_records
node_recovery -->|"builds evidence"| node_records
node_receiving -->|"reads sample rows"| node_sampledata
node_prep -->|"reads sample rows"| node_sampledata
node_pack -->|"reads sample rows"| node_sampledata
node_recovery -->|"reads fee lines"| node_sampledata
node_receiving -->|"uses stub helpers"| node_stubs
node_prep -->|"uses stub helpers"| node_stubs
node_pack -->|"uses stub helpers"| node_stubs
node_recovery -->|"uses stub helpers"| node_stubs
node_receiving -->|"exposes endpoints"| node_server
node_prep -->|"exposes endpoints"| node_server
node_pack -->|"exposes endpoints"| node_server
node_returns -->|"exposes endpoints"| node_server
node_recovery -->|"exposes endpoints"| node_server

click node_api "https://github.com/jeevanreddy29/cube-round3-pod/blob/main/orchestration/api.py"
click node_runner "https://github.com/jeevanreddy29/cube-round3-pod/blob/main/orchestration/run.py"
click node_orchestrator "https://github.com/jeevanreddy29/cube-round3-pod/blob/main/orchestration/orchestrator.py"
click node_clients "https://github.com/jeevanreddy29/cube-round3-pod/blob/main/orchestration/clients.py"
click node_rollup "https://github.com/jeevanreddy29/cube-round3-pod/blob/main/orchestration/rollup.py"
click node_receiving "https://github.com/jeevanreddy29/cube-round3-pod/blob/main/agents/receiving/app.py"
click node_prep "https://github.com/jeevanreddy29/cube-round3-pod/blob/main/agents/prep/app.py"
click node_pack "https://github.com/jeevanreddy29/cube-round3-pod/blob/main/agents/pack/app.py"
click node_returns "https://github.com/jeevanreddy29/cube-round3-pod/blob/main/agents/returns/app.py"
click node_recovery "https://github.com/jeevanreddy29/cube-round3-pod/blob/main/agents/recovery/app.py"
click node_sampledata "https://github.com/jeevanreddy29/cube-round3-pod/blob/main/shared/utils/sample_data.py"
click node_stubs "https://github.com/jeevanreddy29/cube-round3-pod/blob/main/shared/utils/stubs.py"
click node_records "https://github.com/jeevanreddy29/cube-round3-pod/blob/main/shared/utils/records.py"
click node_schema "https://github.com/jeevanreddy29/cube-round3-pod/blob/main/shared/utils/schema.py"
click node_server "https://github.com/jeevanreddy29/cube-round3-pod/blob/main/shared/utils/server.py"
click node_store "https://github.com/jeevanreddy29/cube-round3-pod/blob/main/orchestration/store.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_api,node_runner toneBlue
class node_orchestrator,node_clients,node_rollup toneAmber
class node_receiving,node_prep,node_pack,node_returns,node_recovery toneMint
class node_sampledata,node_stubs,node_records,node_schema,node_server toneRose
class node_store,node_workflowstate,node_evidence,node_final,node_operator toneIndigo
```

## Components

### Workflow entry

- [Workflow API](https://github.com/jeevanreddy29/cube-round3-pod/blob/main/orchestration/api.py): `orchestration/api.py`
- [Workflow runner](https://github.com/jeevanreddy29/cube-round3-pod/blob/main/orchestration/run.py): `orchestration/run.py`

### Orchestration

- [Workflow orchestrator](https://github.com/jeevanreddy29/cube-round3-pod/blob/main/orchestration/orchestrator.py): `orchestration/orchestrator.py`
- [Agent clients](https://github.com/jeevanreddy29/cube-round3-pod/blob/main/orchestration/clients.py): `orchestration/clients.py`
- [Outcome rollup](https://github.com/jeevanreddy29/cube-round3-pod/blob/main/orchestration/rollup.py): `orchestration/rollup.py`

### Commerce stages

- [Receiving](https://github.com/jeevanreddy29/cube-round3-pod/blob/main/agents/receiving/app.py): `agents/receiving/app.py`
- [Prep](https://github.com/jeevanreddy29/cube-round3-pod/blob/main/agents/prep/app.py): `agents/prep/app.py`
- [Pack](https://github.com/jeevanreddy29/cube-round3-pod/blob/main/agents/pack/app.py): `agents/pack/app.py`
- [Returns](https://github.com/jeevanreddy29/cube-round3-pod/blob/main/agents/returns/app.py): `agents/returns/app.py`
- [Recovery](https://github.com/jeevanreddy29/cube-round3-pod/blob/main/agents/recovery/app.py): `agents/recovery/app.py`

### Evidence contracts

- [Sample data](https://github.com/jeevanreddy29/cube-round3-pod/blob/main/shared/utils/sample_data.py): `shared/utils/sample_data.py`
- [Stub helpers](https://github.com/jeevanreddy29/cube-round3-pod/blob/main/shared/utils/stubs.py): `shared/utils/stubs.py`
- [Evidence records](https://github.com/jeevanreddy29/cube-round3-pod/blob/main/shared/utils/records.py): `shared/utils/records.py`
- [Schema validation](https://github.com/jeevanreddy29/cube-round3-pod/blob/main/shared/utils/schema.py): `shared/utils/schema.py`
- [Agent HTTP server](https://github.com/jeevanreddy29/cube-round3-pod/blob/main/shared/utils/server.py): `shared/utils/server.py`

### Workflow state

- [State and evidence store](https://github.com/jeevanreddy29/cube-round3-pod/blob/main/orchestration/store.py): `orchestration/store.py`
- **Workflow state**
- **Evidence records**
- **Final outcome**

### Other components

- **Workflow caller**

## Connections

- Workflow caller → Workflow API: submits case (evidence: `README.md`)
- Workflow caller → Workflow runner: runs case (evidence: `README.md`)
- Workflow API → Workflow orchestrator: starts workflow (evidence: `orchestration/api.py`)
- Workflow runner → Workflow orchestrator: runs workflow (evidence: `orchestration/run.py`)
- Workflow API → State and evidence store: loads and saves (evidence: `orchestration/api.py`)
- Workflow orchestrator → Agent clients: dispatches stages (evidence: `orchestration/orchestrator.py`)
- Agent clients → Receiving: invokes agent (evidence: `README.md`)
- Agent clients → Prep: invokes agent (evidence: `README.md`)
- Agent clients → Pack: invokes agent (evidence: `README.md`)
- Agent clients → Returns: invokes agent (evidence: `README.md`)
- Agent clients → Recovery: invokes agent (evidence: `README.md`)
- Workflow orchestrator → Schema validation: validates output (evidence: `orchestration/orchestrator.py`)
- Workflow orchestrator → State and evidence store: reads and writes (evidence: `orchestration/orchestrator.py`)
- Workflow orchestrator → Outcome rollup: derives outcome (evidence: `orchestration/orchestrator.py`)
- Workflow orchestrator → Workflow state: updates state (evidence: `README.md`)
- Workflow orchestrator → Evidence records: records evidence (evidence: `README.md`)
- Workflow orchestrator → Final outcome: derives outcome (evidence: `README.md`)
- Receiving → Evidence records: builds evidence (evidence: `agents/receiving/app.py`)
- Prep → Evidence records: builds evidence (evidence: `agents/prep/app.py`)
- Pack → Evidence records: builds evidence (evidence: `agents/pack/app.py`)
- Returns → Evidence records: builds evidence (evidence: `agents/returns/app.py`)
- Recovery → Evidence records: builds evidence (evidence: `agents/recovery/app.py`)
- Receiving → Sample data: reads sample rows (evidence: `agents/receiving/app.py`)
- Prep → Sample data: reads sample rows (evidence: `agents/prep/app.py`)
- Pack → Sample data: reads sample rows (evidence: `agents/pack/app.py`)
- Recovery → Sample data: reads fee lines (evidence: `agents/recovery/app.py`)
- Receiving → Stub helpers: uses stub helpers (evidence: `agents/receiving/app.py`)
- Prep → Stub helpers: uses stub helpers (evidence: `agents/prep/app.py`)
- Pack → Stub helpers: uses stub helpers (evidence: `agents/pack/app.py`)
- Recovery → Stub helpers: uses stub helpers (evidence: `agents/recovery/app.py`)
- Receiving → Agent HTTP server: exposes endpoints (evidence: `agents/receiving/app.py`)
- Prep → Agent HTTP server: exposes endpoints (evidence: `agents/prep/app.py`)
- Pack → Agent HTTP server: exposes endpoints (evidence: `agents/pack/app.py`)
- Returns → Agent HTTP server: exposes endpoints (evidence: `agents/returns/app.py`)
- Recovery → Agent HTTP server: exposes endpoints (evidence: `agents/recovery/app.py`)
