PolicyForge v0.7.0 policy workbench for agent-run supply chains
Supply chain · governance · Monte Carlo

Govern the rule, not the plan

As AI agents take over replenishment, allocation, expediting and supplier switching, the supply chain manager's job shifts from making plans to governing policies: decision rules, plus a mandate that says what the agent may decide alone. PolicyForge is a workbench for that job.

About PolicyForge

A planning system optimises one plan for one expected future. A policy is different: it reacts to whatever future happens. So it has to be judged across many futures, and its robustness, stability and governance count as much as its average cost.

Governing a policy means five things:

PolicyForge follows that sequence:

The PolicyForge flow Six stages in order: intent, compile, validate, stress-test, approve and deploy, monitor. Intent, compile, validate, stress-test and approve are built; monitoring comes next. 1 · INTENTplain languagebuilt 2 · COMPILELLM → typed DSL onlybuilt 3 · VALIDATEschema, ids, constitutionbuilt 4 · STRESS-TESTsimulator: builtevaluation: built 5 · APPROVEversioned registrybuilt 6 · MONITORassumption driftbuilt

The core flow. Box outlines show progress: green is built, amber is partly built or next, blue-grey is planned.

Design principles

What works today (v0.7.0)

PolicyForge is in early development. Its first screen, the Network Studio, is live. The rest is a Python library and an API you run from the command line; the tutorial walks you through it.

The Network Studio built

Policies are tested on a model of the supply network, so that model has to be easy to build and keep up to date. The Studio does it visually:

Open the Studio. On this site it edits, checks fields, and opens and saves YAML or JSON files without any server. For reference checks, health, the quick test, CSV files, versions and scenarios, run the API locally and open http://127.0.0.1:8000/app/.

A browser test rebuilds FoodNet from scratch in the Studio, through the tables, the map and the diagram, and checks that the engine loads exactly the shipped network.

Monitoring built

A deployed policy keeps being checked against the world it runs in. A live stream runs the network week by week with the deployed policies. Its true scenario is hidden from the monitors and can be changed during a run: for example, Supplier C quietly losing capacity from week 20. Four kinds of monitor watch what an operations team would see:

Thresholds are calibrated on the stress test's own futures, so a quiet world raises a false alarm in at most 5 % of runs.

Alerts go to an escalation inbox, ranked by severity × 1/reversibility × financial exposure, and each alert explains its own score. One call re-runs the stress test on the network as observed (C's capacity as it is now) and returns a new verdict, without touching the approval record.

python -m examples.monitor_demo runs it end to end: the alert comes in week 20, tops the inbox, and the re-test still approves. Even a smaller Supplier C is a better backup than none.

The policy language built

Six rule types: base stock (in units or days of cover), (s, S), allocation (fair share, priority or proportional, with reservations), expedite triggers (projected stockout or low coverage, with a cost cap), sourcing switches (with persistence, a minimum dwell and switch-back), and composites of these. Each rule comes with its mandate, assumptions, the constitution it is tested against, and its provenance. Schemas are exported, and the DSL reference is generated from them.

The registry and API built

Networks, constitutions and policies are stored as versions, and any two versions can be compared field by field.

A policy moves from draft through tested, approved and deployed to retired. Approval is refused unless the latest evaluation of that exact version, against the current constitution and network, says approve, and the refusal says why. Deploying gives the agent one active mandate.

Agents read it at GET /agents/{agent_id}/mandate: limits, escalation rules, prohibitions, the rule, and its expiry. An expired mandate is reported as expired.

Every change goes into a hash-chained audit log: the database refuses edits, and GET /audit/verify finds any made around it. When a network or constitution changes, the policies tested on the old one are flagged for re-test.

The compiler built

Plain language in, a validated policy out. Claude (Opus 5.5 by default) answers only in JSON constrained to the policy schema, and never writes code.

Its answer then goes through three checks:

Errors go back to the model for at most two retries. Warnings, such as cover shorter than the lead time or an expedite cap that could exceed the monthly budget, go to the person signing off.

Each compiled policy comes with:

20 recorded intents run offline, and python -m examples.compile_intent shows the result.

The simulator built

It runs weekly over a supplier → plant → DC → market network, vectorised over replications. It models stochastic lead times per order, supplier capacity and fill rates, finite plant capacity, shelf life and spoilage, backorders or lost sales, information delay and noisy signals, and the mandate's limits (blocked or flagged). 1,000 replications × 104 weeks take about 6 seconds. It conserves stock exactly, and it matches the textbook fill rate of a base-stock system to within 0.03 percentage points.

FoodNet and the scenario library built

A fictional food manufacturer: 3 suppliers, 2 plants, 3 DCs, 6 markets and 10 SKUs (2 chilled). Eight stress scenarios: a quiet baseline, a demand surge, a promotion spike, a supplier outage, lead-time creep, a plant capacity loss, a correlated shock, and noisy, delayed signals.

Evaluation and verdict built

A candidate is compared on the same futures with three baselines: the incumbent, a naive rule, and rolling optimisation: a linear program solved with HiGHS every four weeks, the way a planning system works.

Every metric gets a distribution (mean, P5, P50, P95 and CVaR) and regret against the best policy in each future: service by class, category and market; cost in eight categories; resilience after a shock; bullwhip and order nervousness; escalations; and CO₂.

A constitution table gives the share of futures breaching each hard limit. The verdict (approve, approve with conditions, or reject) states every reason from the numbers. An example report evaluates the tutorial's sourcing switch.

Roadmap

The build goes phase by phase, and each phase starts only when the previous one passes its acceptance tests.

PhaseWhat it deliversAccepted whenStatus
P1 Domain and dataThe DSL, mandate, assumptions, constitution; FoodNet; schemasModels round-trip; bad bounds rejected; schema docs generateddone
P2 SimulatorVectorised engine, an executor per rule, 8 scenarios, common random numbersConservation; exact reproducibility; 1,000 × 104 under 30 s; analytical fill rate within ±1 ppdone
P3 Baselines and evaluationIncumbent, naive and rolling-optimisation baselines (Pyomo with HiGHS); full metrics; robustness verdict; reportBullwhip ratio above 1 under delay; the optimiser solves; reports for the default suitedone
P4 LLM compilerProvider interface, offline mock, compiler with retries, validator, back-translation20 golden intents compile; out-of-vocabulary references rejecteddone
P5 Registry and APILifecycle, approval gate, hash-chained audit log, agent mandate endpoint, diffsNo approval without a passing evaluation; tampering detecteddone
P5b Network StudioBuild and maintain networks visually: a diagram, a world map, tables, an inspector generated from the schema, live checks, a quick test, YAML/CSV import and export, versions with diffs, and a scenario builderFoodNet rebuilt from scratch in the Studio equals the shipped one; errors shown on the right element; versions flag policies for re-testdone
P6 MonitoringLive stream, input, assumption and performance drift monitors, escalation inboxAssumption drift alerts within 4 weeks of injected driftdone
P7 FrontendConstitution, Author, Stress test, Registry and Monitor screens, around the Network StudioThe full demo runs in the browsernext
P8 HardeningDocker, Makefile, user guide, architecture, limitationsRuns on a clean machine; coverage ≥ 80 %planned

Proposed additions

Read more

All data is synthetic. No real company is described.