MedChain

Hospital Supply Chain Coordination

OpenEnv India 2026 Hackathon ยท Finals ยท Professional Tasks: World Modeling (Enterprise)

The Job

It's 2 AM. You're the central pharmacy coordinator for a three-ward hospital.

๐Ÿฅ

ICU

Needs packed red blood cells for a patient going into surgery in 4 hours.

๐Ÿšจ

ER

Reporting a mass-casualty event. Requesting 3ร— normal blood and epinephrine โ€” needs evidence-based validation before allocation.

๐Ÿจ

General Ward

Requesting antibiotics. Clinical evidence and usage history needed to determine the right allocation level.

What We're Simulating โ€” MedChain

3
Wards with distinct clinical profiles

Usage history and reputation carry across rounds. Evidence-grounded allocations improve trust over time.

21
MCP tools across 5 enterprise silos

Each system has its own constraints, latency, and failure mode.

8
Rounds per episode (2 sim days each)

Decisions in round 3 directly shape what round 4 looks like.

Scripted Ward Actors

Each ward has tracked SKUs, usage history, and clinical context. Deterministic from seed โ€” byte-identical rewards across runs. No LLM judge anywhere.

Why It's Hard to Reason About

๐Ÿ”€

Multi-source reconciliation

ERP stale โˆ’1 round. WMS live ยฑ5% noise. Models pick one and act on it.

๐Ÿ“ˆ

Ambiguous demand signals

ER spikes can be genuine MCI events or estimation error. Census and acuity evidence is required to allocate correctly.

๐Ÿ”

Multi-step governance

request_evidence โ†’ escalate โ†’ cite in rationale โ€” models start the loop and don't finish it.

โณ

Async temporal planning

Supplier quotes take 1 round to resolve. Request at round 5 for a round-6 need โ†’ you created the stockout.

๐Ÿšง

Finance gate sequencing

POs >$10k need pre-approval before submission. Models submit optimistically and wonder why it bounced.

Tools Available to the Agent

๐Ÿ“Š ERP Oracle

Stale by 1 round

get_inventoryget_pipeline

๐Ÿ“ฆ WMS

Live ยฑ5% noise

scan_inventory

๐Ÿญ Supplier

Async, next round

request_quoteget_quote

๐Ÿ’ฐ Finance SAP

Gate for PO >$10k

get_budgetrequest_approval

๐Ÿ’ฌ Messaging

Free-form

send_to_ward

Coordination

get_round_briefingview_requestsread_inboxsubmit_allocation_planadvance_round

Audit & Governance

request_evidenceescalate_to_clinical_review

Procurement

submit_pofile_justificationquarantine_lot

A Full Round: MCI Surge in the ER

Round 5, heavy difficulty. Inbox arrives with a mass-casualty alert. ER is requesting 3ร— blood products and epinephrine.

read_inbox()
  โ†’ MCI alert: 23 trauma patients admitted overnight
  โ†’ Supplier disruption: BLOOD-RBC lead time extended by 1 round

view_requests()
  โ†’ ward_er:      BLOOD-RBC x38, BLOOD-PLT x18, EPI-1MG x60
  โ†’ ward_icu:     BLOOD-RBC x12, BLOOD-FFP x8   (routine)
  โ†’ ward_general: ANTIBIO-01 x130, IV-SAL-500 x90

erp_oracle_get_inventory()    โ†’ BLOOD-RBC: 18 units  (as of yesterday)
wms_scan_inventory()          โ†’ BLOOD-RBC: 14 units  (live โ€” overnight consumption)
erp_oracle_get_pipeline()     โ†’ 20 units arriving next round  (pre-ordered round 4)

finance_sap_get_budget()      โ†’ $42,300 remaining  |  ER blood order est. $14,800

request_evidence("ward_er", "BLOOD-RBC")
  โ†’ census: 23 trauma admissions  |  acuity: critical  |  active MCI protocol: YES
  โ†’ consumption last 12h: 11 units already used

finance_sap_request_approval(amount=14800, justification="MCI protocol active,
  23 trauma patients, 11 units consumed overnight, pipeline delayed by disruption")
  โ†’ ticket: FIN-0047  (pending)

supplier_portal_request_quote("MEDLINE", "BLOOD-RBC", qty=40, priority="urgent")

submit_allocation_plan(
  plan: ER gets 14 units now + priority on incoming pipeline
  rationale: "MCI confirmed via census and acuity data. 14 units covers
  next 24h at observed consumption rate. Pipeline 20 units arriving round 6."
)

submit_po(supplier="MEDLINE", sku="BLOOD-RBC", qty=40, approval_ref="FIN-0047")

advance_round()

Inventory reconciliation

ERP said 18, WMS said 14 โ€” overnight consumption. Pipeline awareness prevented over-ordering.

Finance gate handled

Budget checked, approval filed before PO. Quote requested for next round restocking.

Evidence-grounded rationale

Census + acuity cited directly. audit_score credits citation, not just retrieval.

Architecture & Workflow

Episode shape

8 rounds ร— ~15 tool calls ยท Context reset after each advance_round

Determinism

Fixed seed + scripted actors โ†’ byte-identical rewards. No LLM judge.

How Rewards Are Given

Fully deterministic โ€” computed from SimState

25%
network service level
18%
critical service level (ICU + ER blood)
18%
allocation accuracy
12%
event response (MCI ยท recall ยท cold-chain)
7%
budget efficiency
5%
audit score โ€” evidence cited in rationale
5%
approval workflow (finance gates)
โˆ’15%
justification penalty (cap)
Shaping bonuses: correct escalation +0.05 ยท read_inbox +0.01 ยท first enterprise system use +0.005 ยท frivolous escalation โˆ’0.03

Improving the Agent with GRPO

Model

Qwen3.5-2B ยท 4-bit NF4 + LoRA (r=16) ยท T4 via Google Colab

Why GRPO?

Prompting describes the workflow. Only RL teaches the model to value actions whose consequences arrive 2 rounds later.

Setup

G=4 ยท B=8 โ†’ 32 live episodes/step
No static dataset โ€” trains on real environment

~0.41
Rubber-stamp baseline
~0.47
Discount-General heuristic
~0.35
Trained Qwen3.5-2B (23 steps)
~0.70
Frontier model, full loop

Reward mean 0.13 โ†’ 0.35 over 23 steps. Compute-budget limited โ€” clear headroom. Next: per-turn reward signals ยท async episode execution ยท full Tier-1 tool surface.

Thank You

MedChain โ€” OpenEnv India 2026, Finals

Built with OpenEnv ยท HuggingFace TRL (GRPO) ยท Qwen3.5-2B