# ruthvikgoud16/cube-round3-pod architecture

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

- Interactive diagram: https://gitdiagram.com/ruthvikgoud16/cube-round3-pod
- Repository: https://github.com/ruthvikgoud16/cube-round3-pod

## Overview

This repository integrates five commerce-stage agents into a single evidence-backed unit workflow. A case enters the orchestration API; the orchestrator applies routing, invokes Receiving, Prep, Pack, Returns and Recovery as applicable, validates and stores each evidence record, then rolls the evidence chain into workflow state and a final outcome. Agents share a contract and may run in-process or over HTTP. Receiving has a richer observation-and-policy implementation; the other sampled stage agents are organiser stubs. The README documents stage order and orchestration ownership; some internal orchestration and agent details were not sampled.

Main entry points: [`shared/utils/records.py`](https://github.com/ruthvikgoud16/cube-round3-pod/blob/main/shared/utils/records.py) (Evidence records), [`orchestration/orchestrator.py`](https://github.com/ruthvikgoud16/cube-round3-pod/blob/main/orchestration/orchestrator.py) (Workflow engine), [`orchestration/clients.py`](https://github.com/ruthvikgoud16/cube-round3-pod/blob/main/orchestration/clients.py) (Agent clients), [`agents/receiving/app.py`](https://github.com/ruthvikgoud16/cube-round3-pod/blob/main/agents/receiving/app.py) (Receiving agent)

## Diagram (Mermaid)

```mermaid
flowchart TD

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

subgraph group_control["Orchestration"]
  node_engine["Workflow engine<br/>[orchestrator.py]"]
  node_clients["Agent clients<br/>[clients.py]"]
  node_overrides["Demo overrides<br/>[demo_overrides.py]"]
  node_store[("Workflow evidence store<br/>[store.py]")]
  node_rollup["Outcome rollup<br/>[rollup.py]"]
end

subgraph group_stages["Commerce stages"]
  node_receiving["Receiving agent<br/>[app.py]"]
  node_observer["Image observer<br/>[observer.py]"]
  node_policy["Receiving policy<br/>[policy.py]"]
  node_quality["Image quality gate<br/>[quality_gate.py]"]
  node_schema_rcv["Observation schema<br/>[schema.py]"]
  node_shots["Shot selection<br/>[shots.py]"]
  node_prep["Prep agent<br/>[app.py]"]
  node_pack["Pack agent<br/>[app.py]"]
  node_returns["Returns agent<br/>[app.py]"]
  node_recovery["Recovery agent<br/>[app.py]"]
end

subgraph group_contracts["Shared contracts"]
  node_server["Agent HTTP server<br/>[server.py]"]
  node_records["Evidence records<br/>[records.py]"]
  node_validation["Contract validation<br/>[schema.py]"]
  node_hashing["Evidence hashing<br/>[hashing.py]"]
  node_sample[("Sample data<br/>[sample_data.py]")]
  node_stubs["Stub helpers<br/>[stubs.py]"]
end

node_operator(("Case initiator"))

node_operator -->|"submits case"| node_api
node_api -->|"starts workflow"| node_engine
node_engine -->|"dispatches agent"| node_clients
node_engine -->|"checks override"| node_overrides
node_engine -->|"persists state"| node_store
node_engine -->|"rolls up outcome"| node_rollup
node_clients -->|"invokes stage"| node_receiving
node_clients -->|"invokes stage"| node_prep
node_clients -->|"invokes stage"| node_pack
node_clients -->|"invokes stage"| node_returns
node_clients -->|"invokes stage"| node_recovery
node_receiving -->|"observes images"| node_observer
node_receiving -->|"evaluates checks"| node_policy
node_receiving -->|"screens frames"| node_quality
node_observer -->|"validates observation"| node_schema_rcv
node_policy -->|"uses shot rules"| node_shots
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_engine -->|"validates output"| node_validation
node_records -->|"seals records"| node_hashing
node_server -->|"checks input"| node_validation
node_server -->|"returns pending output"| node_records
node_prep -->|"reads sample row"| node_sample
node_pack -->|"reads sample data"| node_sample
node_returns -->|"reads sample data"| node_sample
node_recovery -->|"reads fee data"| node_sample
node_prep -->|"uses stub helpers"| node_stubs
node_pack -->|"uses stub helpers"| node_stubs
node_returns -->|"uses stub helpers"| node_stubs
node_recovery -->|"uses stub helpers"| node_stubs

click node_api "https://github.com/ruthvikgoud16/cube-round3-pod/blob/main/orchestration/api.py"
click node_engine "https://github.com/ruthvikgoud16/cube-round3-pod/blob/main/orchestration/orchestrator.py"
click node_clients "https://github.com/ruthvikgoud16/cube-round3-pod/blob/main/orchestration/clients.py"
click node_overrides "https://github.com/ruthvikgoud16/cube-round3-pod/blob/main/orchestration/demo_overrides.py"
click node_store "https://github.com/ruthvikgoud16/cube-round3-pod/blob/main/orchestration/store.py"
click node_rollup "https://github.com/ruthvikgoud16/cube-round3-pod/blob/main/orchestration/rollup.py"
click node_receiving "https://github.com/ruthvikgoud16/cube-round3-pod/blob/main/agents/receiving/app.py"
click node_observer "https://github.com/ruthvikgoud16/cube-round3-pod/blob/main/agents/receiving/observer.py"
click node_policy "https://github.com/ruthvikgoud16/cube-round3-pod/blob/main/agents/receiving/policy.py"
click node_quality "https://github.com/ruthvikgoud16/cube-round3-pod/blob/main/agents/receiving/quality_gate.py"
click node_schema_rcv "https://github.com/ruthvikgoud16/cube-round3-pod/blob/main/agents/receiving/schema.py"
click node_shots "https://github.com/ruthvikgoud16/cube-round3-pod/blob/main/agents/receiving/shots.py"
click node_prep "https://github.com/ruthvikgoud16/cube-round3-pod/blob/main/agents/prep/app.py"
click node_pack "https://github.com/ruthvikgoud16/cube-round3-pod/blob/main/agents/pack/app.py"
click node_returns "https://github.com/ruthvikgoud16/cube-round3-pod/blob/main/agents/returns/app.py"
click node_recovery "https://github.com/ruthvikgoud16/cube-round3-pod/blob/main/agents/recovery/app.py"
click node_server "https://github.com/ruthvikgoud16/cube-round3-pod/blob/main/shared/utils/server.py"
click node_records "https://github.com/ruthvikgoud16/cube-round3-pod/blob/main/shared/utils/records.py"
click node_validation "https://github.com/ruthvikgoud16/cube-round3-pod/blob/main/shared/utils/schema.py"
click node_hashing "https://github.com/ruthvikgoud16/cube-round3-pod/blob/main/shared/utils/hashing.py"
click node_sample "https://github.com/ruthvikgoud16/cube-round3-pod/blob/main/shared/utils/sample_data.py"
click node_stubs "https://github.com/ruthvikgoud16/cube-round3-pod/blob/main/shared/utils/stubs.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 toneBlue
class node_engine,node_clients,node_overrides,node_store,node_rollup toneAmber
class node_receiving,node_observer,node_policy,node_quality,node_schema_rcv,node_shots,node_prep,node_pack,node_returns,node_recovery toneMint
class node_server,node_records,node_validation,node_hashing,node_sample,node_stubs toneRose
class node_operator toneIndigo
```

## Components

### Workflow entry

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

### Orchestration

- [Workflow engine](https://github.com/ruthvikgoud16/cube-round3-pod/blob/main/orchestration/orchestrator.py): `orchestration/orchestrator.py`
- [Agent clients](https://github.com/ruthvikgoud16/cube-round3-pod/blob/main/orchestration/clients.py): `orchestration/clients.py`
- [Demo overrides](https://github.com/ruthvikgoud16/cube-round3-pod/blob/main/orchestration/demo_overrides.py): `orchestration/demo_overrides.py`
- [Workflow evidence store](https://github.com/ruthvikgoud16/cube-round3-pod/blob/main/orchestration/store.py): `orchestration/store.py`
- [Outcome rollup](https://github.com/ruthvikgoud16/cube-round3-pod/blob/main/orchestration/rollup.py): `orchestration/rollup.py`

### Commerce stages

- [Receiving agent](https://github.com/ruthvikgoud16/cube-round3-pod/blob/main/agents/receiving/app.py): `agents/receiving/app.py`
- [Image observer](https://github.com/ruthvikgoud16/cube-round3-pod/blob/main/agents/receiving/observer.py): `agents/receiving/observer.py`
- [Receiving policy](https://github.com/ruthvikgoud16/cube-round3-pod/blob/main/agents/receiving/policy.py): `agents/receiving/policy.py`
- [Image quality gate](https://github.com/ruthvikgoud16/cube-round3-pod/blob/main/agents/receiving/quality_gate.py): `agents/receiving/quality_gate.py`
- [Observation schema](https://github.com/ruthvikgoud16/cube-round3-pod/blob/main/agents/receiving/schema.py): `agents/receiving/schema.py`
- [Shot selection](https://github.com/ruthvikgoud16/cube-round3-pod/blob/main/agents/receiving/shots.py): `agents/receiving/shots.py`
- [Prep agent](https://github.com/ruthvikgoud16/cube-round3-pod/blob/main/agents/prep/app.py): `agents/prep/app.py`
- [Pack agent](https://github.com/ruthvikgoud16/cube-round3-pod/blob/main/agents/pack/app.py): `agents/pack/app.py`
- [Returns agent](https://github.com/ruthvikgoud16/cube-round3-pod/blob/main/agents/returns/app.py): `agents/returns/app.py`
- [Recovery agent](https://github.com/ruthvikgoud16/cube-round3-pod/blob/main/agents/recovery/app.py): `agents/recovery/app.py`

### Shared contracts

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

### Other components

- **Case initiator**

## Connections

- Case initiator → Workflow API: submits case (evidence: `README.md`)
- Workflow API → Workflow engine: starts workflow (evidence: `orchestration/api.py`)
- Workflow engine → Agent clients: dispatches agent (evidence: `orchestration/orchestrator.py`)
- Workflow engine → Demo overrides: checks override (evidence: `orchestration/orchestrator.py`)
- Workflow engine → Workflow evidence store: persists state (evidence: `orchestration/orchestrator.py`)
- Workflow engine → Outcome rollup: rolls up outcome (evidence: `orchestration/orchestrator.py`)
- Agent clients → Receiving agent: invokes stage (evidence: `README.md`)
- Agent clients → Prep agent: invokes stage (evidence: `README.md`)
- Agent clients → Pack agent: invokes stage (evidence: `README.md`)
- Agent clients → Returns agent: invokes stage (evidence: `README.md`)
- Agent clients → Recovery agent: invokes stage (evidence: `README.md`)
- Receiving agent → Image observer: observes images (evidence: `agents/receiving/app.py`)
- Receiving agent → Receiving policy: evaluates checks (evidence: `agents/receiving/app.py`)
- Receiving agent → Image quality gate: screens frames (evidence: `agents/receiving/app.py`)
- Image observer → Observation schema: validates observation (evidence: `agents/receiving/observer.py`)
- Receiving policy → Shot selection: uses shot rules (evidence: `agents/receiving/policy.py`)
- Receiving agent → Evidence records: builds evidence (evidence: `agents/receiving/app.py`)
- Prep agent → Evidence records: builds evidence (evidence: `agents/prep/app.py`)
- Pack agent → Evidence records: builds evidence (evidence: `agents/pack/app.py`)
- Returns agent → Evidence records: builds evidence (evidence: `agents/returns/app.py`)
- Recovery agent → Evidence records: builds evidence (evidence: `agents/recovery/app.py`)
- Workflow engine → Contract validation: validates output (evidence: `orchestration/orchestrator.py`)
- Evidence records → Evidence hashing: seals records (evidence: `shared/utils/records.py`)
- Agent HTTP server → Contract validation: checks input (evidence: `shared/utils/server.py`)
- Agent HTTP server → Evidence records: returns pending output (evidence: `shared/utils/server.py`)
- Prep agent → Sample data: reads sample row (evidence: `agents/prep/app.py`)
- Pack agent → Sample data: reads sample data (evidence: `agents/pack/app.py`)
- Returns agent → Sample data: reads sample data (evidence: `agents/returns/app.py`)
- Recovery agent → Sample data: reads fee data (evidence: `agents/recovery/app.py`)
- Prep agent → Stub helpers: uses stub helpers (evidence: `agents/prep/app.py`)
- Pack agent → Stub helpers: uses stub helpers (evidence: `agents/pack/app.py`)
- Returns agent → Stub helpers: uses stub helpers (evidence: `agents/returns/app.py`)
- Recovery agent → Stub helpers: uses stub helpers (evidence: `agents/recovery/app.py`)
