# Designing a Hierarchical Planner for Manufacturing Supply Chains

> A senior AI solutions architect’s field notes on decomposing multi-tier production planning into a planner–worker–verifier swarm, wired into ERP, inventory, and supplier systems through Model Context Protocol.
Manufacturing planning looks like a single decision from the boardroom and behaves like a distributed constraint-satisfaction problem underneath. A work order dropped into the schedule triggers material availability checks across tiers of suppliers, capacity checks against finite work centers, tooling and changeover rules, transportation lead times, quality holds, and contractual commitments that stretch months into the future. The moment any one of those edges moves — a supplier slips, a machine goes down, a customs delay appears — the whole plan has to be re-evaluated. That is not a prompt-engineering problem. It is an architecture problem, and the architecture that keeps winning in production is a hierarchical planner.
This post is the design I reach for when a planning workflow is too wide, too long-horizon, and too irreversible for a single agent or a linear chain: a planner that decomposes each objective into parallel worker tasks, a verifier that gates every commitment before it touches a system of record, and a backtrack-and-repair loop that treats disruption as the normal case. The whole thing is wired into ERP, inventory, and supplier APIs through Model Context Protocol (MCP).
## 1. Introduction: The Complexity of Multi-Tiered Supply Chain Optimization
Ask a supply chain planner what actually consumes their day and the honest answer is a graph, not a list. A single production commitment fans out into bill-of-materials explosions across multiple levels, multi-source sourcing decisions, capacity reservations on constrained work centers, and logistics feasibility checks against inbound and outbound lanes. Every node in that graph has its own lead time, its own failure mode, and its own owner in a different system.
Three structural properties make multi-tier supply chain optimization a fundamentally harder problem than e-commerce fulfillment, and each one shapes the architecture:
– **Horizon length is measured in months, not hours.** A manufacturing planner must hold a rolling plan across a 90- to 180-day window where today’s decision constrains what is possible in week twelve. Long horizons mean the plan must be revisable, not just executable — the value is in replanning, not in one perfect schedule.
– **Constraints are coupled across tiers.** A shortage at a tier-2 supplier propagates into assembly, into finished goods, into customer promise dates. Naive decomposition that optimizes each tier locally produces a globally infeasible plan, so the coordination layer has to reason about propagation, not just exceptions.
– **Blast radius is real and expensive.** Manufacturing commitments end in irreversible, externally visible side effects — purchase orders released to suppliers, capacity booked on the shop floor, dates promised to customers. A hallucinated tool call in a monolithic agent *is* the production incident: expedited freight, line-down penalties, missed revenue.
The engineering question is not *whether* to decompose this work, but how to do it without drowning the coordination layer in overhead — and how to keep every side effect gated until it is verified. That is what a planner–worker–verifier hierarchy solves.
## 2. The Hierarchical Pattern: Planner–Worker–Verifier for Logistics Logic
The pattern is borrowed from well-run engineering organizations: a lead decomposes the objective, specialists execute in parallel, and a separate quality gate reconciles the result before it ships. For manufacturing planning, the **planner agent** receives an objective — “commit to fulfilling orders X, Y, Z by their promise dates at minimum cost” — and produces a **task graph, not a script**. The graph is a DAG in which every node is a narrow, typed unit of work with explicit dependencies, and independent branches are marked for fan-out.
A typical production planning objective decomposes into:
– `explode_mrp(demand, boms)` — one worker per finished good, expanding requirements down the bill of materials in parallel. This is the widest fan-out and the most failure-prone, which is deliberate: we want material gaps to surface *early and cheaply*, before any purchase order or capacity commitment is made.
– `check_availability(item, plant, date)` — parallel workers query on-hand, on-order, in-transit, and safety-stock positions per item and location.
– `evaluate_sourcing(item, suppliers)` — workers assess multi-source options: supplier lead time, MOQ, price breaks, quality history, and compliance status.
– `reserve_capacity(work_center, operation, window)` — a deterministic allocator with a rules layer, not free-form reasoning, decides what runs where and when.
– `release_purchase_order(…)` — idempotent and gated behind a policy or human checkpoint, because it is an irreversible spend.
– `promise_dates(plan_result)` — terminal, and only ever run against the reconciled and verified output of the graph, never against a mid-flight guess.
Three contracts keep this from degenerating into chaos. First, every worker has **typed inputs and outputs**: the availability worker returns a structured `AvailabilityResult` with on-hand, on-order, ETA, and substitute candidates — not prose. Second, every task inherits a **plan ID** from the planner, so fan-out, join, backtrack, and verification events are traceable to the parent objective. Third, all durable state lives in a store, not in the planner’s context, so workers can run for seconds while the planner waits cheaply.
What distinguishes this from a generic multi-agent swarm is the **verifier**. It is a separate, typically cheaper model (often a small judge) whose only job is to check a worker’s proposed action against hard constraints before commitment: does this purchase order respect the budget ceiling? Does this capacity reservation violate a changeover rule? Does this promised date actually clear every upstream dependency? The planner decomposes; workers execute; the verifier adjudicates. Splitting adjudication out of the planner is what makes the long-horizon loop in Section 4 safe, and it is why the verifier is a first-class role rather than a line in the planner’s prompt.
The planner’s real job is **fan-in and revision**. It does not execute planning logic; it watches the graph, joins results at dependency boundaries, and — the part that matters most — it is the only agent authorized to *revise the plan* when a worker or the verifier returns a structured failure.
## 3. Integration: Bridging ERP, Inventory, and Supplier APIs via MCP
A planner can decompose all it wants; the swarm still needs a steering layer into the systems that hold the truth. In manufacturing that means three integration surfaces: **ERP** (Oracle EBS, Oracle Fusion, SAP, or Dynamics) for master data, work orders, and purchase orders, **inventory and WMS** systems for availability truth, and **supplier APIs and portals** for lead times, acknowledgements, and shipment events. Model Context Protocol is the contract that makes those surfaces typed, auditable, and model-agnostic.
We expose each system as a set of *verb-shaped* MCP tools with strict JSON Schemas and structured error semantics:
– **ERP surface:** `get_bom`, `explode_requirements`, `create_work_order`, `release_purchase_order` (idempotency-keyed), `get_open_orders`, `update_promise_date`.
– **Inventory surface:** `check_on_hand(item, plant)`, `get_on_order`, `get_in_transit`, `reserve_stock`, `release_reservation`, `get_safety_stock`.
– **Supplier surface:** `get_lead_time(item, supplier)`, `get_supplier_capacity`, `send_rfq`, `confirm_po`, `get_shipment_status`, `get_quality_history`.
Three design rules keep this layer production-safe. **Idempotency everywhere a side effect can repeat:** `release_purchase_order` and `reserve_stock` carry idempotency keys, so agentic retries and backtrack compensation can never double-spend or double-book. **Row-level access at the connector:** a worker queries inventory through a bridge constrained to the items and plants its task authorized — the model cannot widen the lookup by phrasing, because the schema has no knob that widens it. **Everything logged:** every MCP invocation from every worker is an auditable event with timestamps and the parent plan ID, so a misrouted purchase order is replayable as a sequence of typed calls, not a mystery transcript.
The payoff of doing this through MCP rather than one-off function calls is that the *schema is the asset*. The same servers run under Claude, GPT-4-class models, or open-weights deployments in your own VPC — and when the next model generation ships, you swap the model, not the plumbing. The planner reasons; the MCP layer executes; humans audit.
## 4. Logic: Managing Long-Horizon Planning with Agentic Backtrack and Repair
Long-horizon manufacturing planning is exception-dense, so the error path is not an edge case — it is the design center. We handle disruption on a ladder: deterministic rules first, **agentic backtrack and repair** where the recovery decision itself requires reasoning.
Agentic backtrack means this: when a worker or the verifier returns a *structured failure* (a machine-readable error code with context, not prose), the planner prunes the failed subtree of the task graph and generates a **revised plan** from the current state — never a full restart, and never an unexamined retry. Completed, unaffected work stays committed. Repair tasks are first-class nodes in the new plan.
Consider a supplier slip. The `evaluate_sourcing` worker returns `LEAD_TIME_SLIP` with the new date, quantity impact, and alternate suppliers. The planner does not just retry. It evaluates the repair tree: re-source to an approved alternate (which may change cost and inbound lane), expedite freight (which trades cost for time), re-sequence production to consume available inventory first, or push the affected customer promise date and notify. Each branch has a cost, a lead-time delta, and a policy gate, and the planner chooses by policy — escalating to a human checkpoint only when the branch is irreversible or exceeds a spend threshold. Meanwhile, unaffected demand branches proceed: the plan may commit partial fulfillment rather than stall the whole graph while it solves one item.
Long horizons add a second dimension a fulfillment agent never sees: **temporal backtrack**. A decision that was valid on day 1 can become invalid by day 60 as the horizon rolls forward. So the planner runs on a cadence — a nightly or event-driven replan — where the verifier re-checks still-open commitments against fresh data and flags drifted tasks for repair. The difference between naive retry and this is that the plan *changes*: the system stops promising the old date and starts managing the new one. Capacity contention exercises the same machinery: when a work center is over-committed, the planner backtracks on the *scheduling* subtree, re-sequences operations, and re-verifies changeover feasibility before anything is dispatched to the floor.
Three guardrails keep backtrack from becoming a cost runaway: a **bounded revision budget** (a plan may backtrack at most N times before a human owns it), **structured errors with machine-readable codes** so the planner branches on semantics rather than parsing text, and **full replayability** — every prune, compensation, and revision is an audited event under the parent plan ID.
## 5. ROI: Reducing Supply-Chain Admin Time by 60% with Agent Swarms
The business case is not “AI does planning.” It is that a planner–worker–verifier swarm quietly absorbs the enormous administrative tax that lives around planning: the manual cross-system lookups, the status-chasing, the exception triage, and the copy-paste reconciliation between ERP, spreadsheets, and supplier portals. In deployments of this architecture, **supply-chain administrative time drops by roughly 60%** across the planning and expediting roles it covers — measured on the team’s own ticketing and time tracking, not vendor benchmarks.
Where the hours actually come back:
– **Manual data gathering collapses.** What used to be an analyst pulling availability from ERP, lead times from a supplier portal, and in-transit status from a TMS now resolves as parallel typed MCP calls joined into one verified result. The 15–30 minute “where are the parts?” loop becomes a background event.
– **Exception triage gets triaged before a human sees it.** Workers monitor supplier feeds and inventory continuously; the verifier filters noise, and the planner only escalates branches that are genuinely irreversible or above policy. Planners stop being human message queues.
– **Replanning runs more often, at lower marginal cost.** The expensive part of replanning was always human attention, not computation. With the graph holding state and the verifier adjudicating, the swarm can replan nightly instead of weekly — catching slippage while it is still cheap to correct.
– **Onboarding and documentation overhead falls.** Because every action is a typed tool call under a plan ID, the audit trail is generated as a side effect of doing the work. SOX-style reviews stop being archaeology.
The strategic point is that the savings are not a headcount story — they are a *latency* story. Faster replanning means fewer expedited freights, fewer line-down minutes, and fewer broken promises, all of which dwarf the administrative savings on the P&L.
—
## 6. Implementation: A Hierarchical Logistics Agent for Manufacturing Automation
Here is the concrete build, the way we ship it in an OnlineCloud engagement.
**Layer 1 — Objective intake.** A demand or disruption event arrives (new forecast, expedited order, supplier acknowledgement, machine-down signal). The planner normalizes it into a planning objective with a horizon, a cost ceiling, and a set of hard constraints.
**Layer 2 — Plan generation.** The planner emits the task graph described in Section 2, tagged with a plan ID and a revision budget. Nothing touches a system of record yet.
**Layer 3 — Parallel execution.** Worker agents fan out across the MCP surfaces: MRP explosion, availability, sourcing, capacity, logistics feasibility. Each returns a typed result; state is durable, so the planner waits cheaply and latency scales with the widest branch, not with item count.
**Layer 4 — Verification gate.** The verifier checks every proposed commitment against hard constraints — budget, changeover, lead-time, compliance — and returns pass/fail with machine-readable reasons. Only verified actions proceed; irreversible ones pause at a human checkpoint.
**Layer 5 — Commit and observe.** Verified actions release purchase orders, book capacity, and update promise dates through idempotent, audited MCP tools. Monitoring workers then watch supplier and shop-floor events and feed disruptions back into Layer 1.
**Layer 6 — Backtrack and repair.** On any structured failure or temporal drift, the planner prunes the affected subtree, generates repair nodes, re-verifies, and re-commits — all under the same plan ID, with a bounded revision budget that hands control to a human when the plan is genuinely stuck.
The stack is deliberately boring where it should be: deterministic rules for capacity and cost math, a small judge for verification, and the strongest model reserved for decomposition and adjudication, where a bad decision poisons everything downstream. The planner reasons; the MCP layer executes; the verifier gates; humans audit. Shipped in vertical slices over 6–10 weeks, each slice landing against a real eval rather than a demo.
—
### Ready to wire a hierarchical planner into your manufacturing stack?
OnlineCloud is a US-based engineering studio specializing in agentic AI and Model Context Protocol — MCP-native planner–worker–verifier swarms that plug into your ERP, inventory systems, and supplier APIs with typed tools, audit trails, and human checkpoints where they matter. Senior engineers only, no offshore handoffs, evaluated and observable systems shipped to production in 6–10 weeks, not quarters. [Contact the OnlineCloud team](https://www.onlinecloud.dev/) or email **contact@onlinecloud.dev** for a free initial consultation — we respond within 24 hours.