Northwind ERP Decision Skill
Core Workflow
- Read the prompt, payload memo, and answer template first. The template is the contract: preserve its top-level keys, field names, enums, sorting rules, and rounding precision.
- Use the public ERP API for live records. Do not inspect environment source files or cached internal data.
- Resolve only the population requested by the memo:
- If the memo lists explicit order IDs or supplier IDs, use only those IDs, even when an API wave/query returns additional records.
- If the memo asks for an entire wave, include every order/line in that wave.
- If the memo defines an incident window, filter incidents by
open_date inclusively.
- Join records from the relevant endpoints, compute the requested classifications and summaries, then return one JSON object only.
- Sort every list exactly as the template states. Sort IDs lexicographically unless a different ordering is specified.
API Usage
Use the task-provided base URL when present. In this benchmark setup, the local shared API is normally:
http://127.0.0.1:8100
Bypass proxies for localhost calls:
curl --noproxy '*' -sS "$BASE/orders?wave=WAVE_ID"
curl --noproxy '*' -sS "$BASE/products/SKU"
curl --noproxy '*' -sS "$BASE/inventory?warehouse_id=WH_WEST&sku=SKU"
Public endpoints exposed by the service:
/products, /products/<sku>
/customers, /customers/<customer_id>
/warehouses
/inventory?warehouse_id=&sku=
/purchase_orders?supplier_id=&sku=&status=
/orders?wave=&required_date=&customer_id=, /orders/<order_id>
/shipping/quote?warehouse_id=&destination_zip=&weight_lb=&speed=
/incidents?start=&end=&supplier_id=&sku=&incident_type=&status=
/suppliers
/boms, /boms/<bom_id>
Join patterns:
- Orders need customers, products, inventory, and usually shipping quotes.
- Allocation tasks need orders by wave, customers, products, and all warehouses' inventory for each SKU.
- Kit tasks need BOMs, products, target-warehouse inventory, other-warehouse inventory, and purchase orders.
- Supplier-quality tasks need incidents plus supplier master data; procurement holds also need purchase orders.
Shared Business Rules
Inventory math
Use protected-stock availability, not raw on-hand:
effective_available = on_hand - reserved - quarantined - product.safety_stock
Never treat reserved, quarantined, or safety-stock/buffer units as freely available.
For transferable surplus, use only positive effective availability from a non-target warehouse. Do not move protected stock.
Customer exceptions
Map customer status/risk with this precedence:
account_status == "blocked": hard account block.
account_status == "review_required": account review.
- Active account with
risk_flag == "fraud_watch": fraud watch.
- Active account with
risk_flag == "credit_watch": credit watch when the target enum supports it; otherwise use the closest account-review/customer-risk enum allowed by the template.
- Otherwise no customer exception.
Blocked accounts outrank credit-watch risk. Account-level exceptions usually apply to every line in the order.
Product exceptions
Inactive products prevent automatic release for the affected SKU/line. Product inactivity is separate from stock shortage; if both occur, preserve both facts when the output has separate inactive and shortage fields.
Dates and rounding
- Incident date filters use
open_date and are inclusive of both start and end.
- Calendar duration is
(close_date or analysis_date) - open_date in days, not inclusive-count days.
- Round currency to 2 decimals, durations to 2 decimals, and percentages to the precision specified in the request/template.
- For money totals, compute from unrounded components when possible, then round the final displayed value.
Task Patterns
Expedite dispatch queue
Inputs identify an expedite wave and often a specific list of order IDs. Include only memo-listed orders when that list exists.
Per order:
- Fetch the order, customer, all line products, requested-warehouse inventory for each line SKU, and a shipping quote.
- Compute each line's effective availability at the order warehouse.
shortage_skus: active line SKUs where effective availability is less than line quantity.
inactive_skus: inactive line SKUs.
low_stock_skus: active SKUs with small positive effective availability even if the line can still be covered. In observed tasks, low stock is positive effective availability below 10 units.
inventory_status:
inactive_and_shortage if there is at least one inactive SKU and at least one shortage.
inactive_sku if inactive exists without shortage.
shortage if shortage exists without inactive.
low_stock if no shortage/inactive but low stock exists.
ready otherwise.
customer_exception follows the customer mapping and the template enum.
- Decision precedence:
- Hard account/risk hold:
reject_hold, next action hold_credit_or_fraud.
- Account review:
manual_review, next action send_account_review.
- Product-only inactive exception:
manual_review, next action escalate_product_master.
- Stock shortage:
backorder, next action create_backorder.
- Low stock only:
delayed_release, next action delay_and_monitor.
- Otherwise:
ship_now, next action release_to_pick.
Shipping quote:
- Total shipment weight is
sum(line.quantity * product.weight_lb).
- Call
/shipping/quote with order warehouse_id, destination_zip, total weight, and order shipping_speed.
- Return
zone_distance, service_days, and total_cost_usd from the quote, rounded to 2 decimals.
Summary fields usually count decisions, sum shipping costs, and list blocked/manual/backorder/inactive orders sorted ascending.
Mixed-warehouse allocation
Use every order in the requested wave. Return one line action per order line, sorted by order_id, then line_id.
For each line:
requested_effective_available is the effective availability at the order's requested warehouse.
- If the customer has an account/risk exception, set
action: "manual_review" for all lines in that order, zero all quantities, and use the account/risk reason.
- Else if the product is inactive, set
manual_review for that line only with primary_reason: "inactive_product".
- Else if requested effective availability covers the full line, set
ship, ship_quantity = line.quantity.
- Else if one alternate warehouse can cover the uncovered quantity from positive effective availability, set
transfer.
ship_quantity = max(requested_effective_available, 0).
transfer_quantity = line.quantity - ship_quantity.
- Choose one source warehouse deterministically from eligible sources, preferring larger effective surplus, then stable warehouse ordering.
- Else set
backorder, ship_quantity = 0, and backorder_quantity = line.quantity.
transfer_requests mirrors transfer lines. blocked_orders includes only account/customer-risk stopped orders, not product-only manual-review lines.
Order rollup:
ready_to_ship: all lines ship.
needs_transfer: transfer lines exist, with no manual review or backorder.
has_backorder: backorder exists, with no manual review.
manual_review: all lines are held by account/customer review.
mixed_actions: product-only manual review or a mixture that does not fit the prior categories.
Kit replenishment
Use memo target builds, not stale BOM target dates, for build quantity/date. Fetch each BOM to get kit name, warehouse, and components.
Component planning:
- For each SKU,
total_required = sum(quantity_per_kit * target_build_quantity) across all requested BOMs.
target_effective_available uses the shared effective-availability formula at the planning warehouse.
- If target effective availability is at or above
product.overstock_threshold, exclude as target_overstock.
- Else if no gap remains, exclude as
stocked_no_gap.
- Eligible timely POs are same-SKU, same-target-warehouse POs with status
open or confirmed and ETA on or before the relevant build need date. Cancelled and received POs do not cover future needs.
- If timely PO quantity covers the gap, use final action
timely_po_covered, list supporting PO IDs, and put the covered gap units into the summary's timely-PO coverage total.
- Otherwise, consume positive effective surplus from other warehouses as transfers without dipping into protected stock.
- Any remaining gap becomes a purchase requisition from
product.supplier_id at product.unit_cost.
Transfer requests are sorted by SKU, then quantity descending, then source warehouse. Purchase requisitions are sorted by SKU. extended_cost = quantity * unit_cost, rounded to 2 decimals.
Final action guide:
no_action_stocked: stocked with no gap.
overstock_excluded: target already meets/exceeds overstock threshold.
timely_po_covered: eligible same-warehouse PO coverage closes the gap.
transfer_only: transfers close the remaining gap.
purchase_required: any purchase requisition quantity remains.
Supplier incident scorecard
Use incidents whose open_date falls in the requested inclusive window. Group only suppliers with at least one filtered incident.
Per supplier:
- Join supplier name and
quality_status.
- Count incidents, RMA incidents, WORK_ORDER incidents, open incidents, and severe incidents where severity is
high or critical.
incident_percentage = supplier_incident_count / total_filtered_incidents * 100.
total_resolution_cost is the sum of filtered incident costs.
avg_duration_days averages calendar durations, using analysis date for open incidents.
- Apply the request's recommendation policy in its stated precedence order. Do not reorder policy clauses by intuition.
Typical recommendation policy:
ESCALATE_SUPPLIER: quality hold with enough incidents, any critical RMA, or high RMA/cost combination.
PROCESS_REVIEW: WORK_ORDER incidents meet the threshold and exceed RMA count.
WATCHLIST: supplier is watch/hold, incident count/cost/severity threshold is met.
MONITOR: no higher-precedence rule applies.
top_escalation_suppliers includes only escalation-code suppliers and uses the template's tie-breakers. Highest-cost/share supplier fields are single supplier IDs selected after grouping.
Procurement quality hold review
Use only memo-listed supplier IDs and the memo's inclusive incident window.
Per supplier:
- Join supplier master data.
- Count recent incidents, recent RMAs, high/critical incidents, and open incidents.
affected_skus: sorted unique SKUs from recent incidents.
sample_incident_ids: sorted incident IDs, capped at 5 when the template requests a sample.
- Decision pattern:
quality_hold suppliers freeze new replenishment.
watch suppliers with multiple high/critical recent incidents require buyer review.
- Otherwise monitor only.
- For freeze or buyer-review decisions, list sorted open/confirmed PO IDs for the supplier. Ignore cancelled and received POs. When many POs qualify, keep the first five sorted IDs to match observed sample-style hold outputs.
- For monitor-only suppliers,
held_po_ids is empty and the supplier ID belongs in release_supplier_ids.
Top-level held_po_ids is the sorted unique union of held supplier PO IDs. Summary counts must reconcile with the supplier rows.
Output Field Checklist
Expedite queue outputs commonly contain:
wave_id
records[]: order_id, inventory_status, customer_exception, final_decision, next_action, shortage_skus, inactive_skus, low_stock_skus, shipping_quote
summary: order count, decision counts, shipping total, blocked/manual/backorder/inactive order ID lists
Allocation outputs commonly contain:
wave_id
line_actions[]: line identity, requested warehouse, requested effective availability, action, quantities, transfer source, primary reason
transfer_requests[]
blocked_orders[]
order_rollup[]
summary
Kit replenishment outputs commonly contain:
task_id, plan_date
kit_targets[]
component_plan[]
transfer_requests[]
purchase_requisitions[]
excluded_components[]
summary
Supplier scorecard outputs commonly contain:
analysis_window
summary
supplier_scorecard[]
top_escalation_suppliers[]
highest_cost_supplier_id
highest_share_supplier_id
Procurement hold outputs commonly contain:
analysis_window
supplier_decisions[]
held_po_ids[]
release_supplier_ids[]
summary
Common Pitfalls
- Do not use raw
on_hand as availability. Always subtract reserved, quarantined, and product safety stock.
- Do not include extra API records just because a wave query returns them. Respect memo-listed IDs.
- Do not let account-review orders proceed to transfer/backorder actions; account/customer exceptions usually dominate stock decisions.
- Do not put product-only inactive lines in
blocked_orders; those are line-level product reviews.
- Do not count cancelled or received POs as timely coverage or held replenishment.
- Do not use BOM
target_date when the memo supplies build dates.
- Do not calculate shipping with a unit weight; quote the full order weight.
- Do not use inclusive day counts for incident duration; use date subtraction.
- Do not emit explanatory text outside the JSON answer.
1---2name: task-group-007-fewshot-attempt-033description: Use for Northwind Components ERP decision tasks that require JSON answers built from task memos/templates plus the shared ERP API, including expedite dispatch, transfer allocation, kit replenishment, supplier incident scorecards, and procurement quality holds.4---56# Northwind ERP Decision Skill78## Core Workflow9101. Read the prompt, payload memo, and answer template first. The template is the contract: preserve its top-level keys, field names, enums, sorting rules, and rounding precision.112. Use the public ERP API for live records. Do not inspect environment source files or cached internal data.123. Resolve only the population requested by the memo:13 - If the memo lists explicit order IDs or supplier IDs, use only those IDs, even when an API wave/query returns additional records.14 - If the memo asks for an entire wave, include every order/line in that wave.15 - If the memo defines an incident window, filter incidents by `open_date` inclusively.164. Join records from the relevant endpoints, compute the requested classifications and summaries, then return one JSON object only.175. Sort every list exactly as the template states. Sort IDs lexicographically unless a different ordering is specified.1819## API Usage2021Use the task-provided base URL when present. In this benchmark setup, the local shared API is normally:2223```text24http://127.0.0.1:810025```2627Bypass proxies for localhost calls:2829```bash30curl --noproxy '*' -sS "$BASE/orders?wave=WAVE_ID"31curl --noproxy '*' -sS "$BASE/products/SKU"32curl --noproxy '*' -sS "$BASE/inventory?warehouse_id=WH_WEST&sku=SKU"33```3435Public endpoints exposed by the service:3637- `/products`, `/products/<sku>`38- `/customers`, `/customers/<customer_id>`39- `/warehouses`40- `/inventory?warehouse_id=&sku=`41- `/purchase_orders?supplier_id=&sku=&status=`42- `/orders?wave=&required_date=&customer_id=`, `/orders/<order_id>`43- `/shipping/quote?warehouse_id=&destination_zip=&weight_lb=&speed=`44- `/incidents?start=&end=&supplier_id=&sku=&incident_type=&status=`45- `/suppliers`46- `/boms`, `/boms/<bom_id>`4748Join patterns:4950- Orders need customers, products, inventory, and usually shipping quotes.51- Allocation tasks need orders by wave, customers, products, and all warehouses' inventory for each SKU.52- Kit tasks need BOMs, products, target-warehouse inventory, other-warehouse inventory, and purchase orders.53- Supplier-quality tasks need incidents plus supplier master data; procurement holds also need purchase orders.5455## Shared Business Rules5657### Inventory math5859Use protected-stock availability, not raw on-hand:6061```text62effective_available = on_hand - reserved - quarantined - product.safety_stock63```6465Never treat reserved, quarantined, or safety-stock/buffer units as freely available.6667For transferable surplus, use only positive effective availability from a non-target warehouse. Do not move protected stock.6869### Customer exceptions7071Map customer status/risk with this precedence:72731. `account_status == "blocked"`: hard account block.742. `account_status == "review_required"`: account review.753. Active account with `risk_flag == "fraud_watch"`: fraud watch.764. Active account with `risk_flag == "credit_watch"`: credit watch when the target enum supports it; otherwise use the closest account-review/customer-risk enum allowed by the template.775. Otherwise no customer exception.7879Blocked accounts outrank credit-watch risk. Account-level exceptions usually apply to every line in the order.8081### Product exceptions8283Inactive products prevent automatic release for the affected SKU/line. Product inactivity is separate from stock shortage; if both occur, preserve both facts when the output has separate inactive and shortage fields.8485### Dates and rounding8687- Incident date filters use `open_date` and are inclusive of both start and end.88- Calendar duration is `(close_date or analysis_date) - open_date` in days, not inclusive-count days.89- Round currency to 2 decimals, durations to 2 decimals, and percentages to the precision specified in the request/template.90- For money totals, compute from unrounded components when possible, then round the final displayed value.9192## Task Patterns9394### Expedite dispatch queue9596Inputs identify an expedite wave and often a specific list of order IDs. Include only memo-listed orders when that list exists.9798Per order:99100- Fetch the order, customer, all line products, requested-warehouse inventory for each line SKU, and a shipping quote.101- Compute each line's effective availability at the order warehouse.102- `shortage_skus`: active line SKUs where effective availability is less than line quantity.103- `inactive_skus`: inactive line SKUs.104- `low_stock_skus`: active SKUs with small positive effective availability even if the line can still be covered. In observed tasks, low stock is positive effective availability below 10 units.105- `inventory_status`:106 - `inactive_and_shortage` if there is at least one inactive SKU and at least one shortage.107 - `inactive_sku` if inactive exists without shortage.108 - `shortage` if shortage exists without inactive.109 - `low_stock` if no shortage/inactive but low stock exists.110 - `ready` otherwise.111- `customer_exception` follows the customer mapping and the template enum.112- Decision precedence:113 - Hard account/risk hold: `reject_hold`, next action `hold_credit_or_fraud`.114 - Account review: `manual_review`, next action `send_account_review`.115 - Product-only inactive exception: `manual_review`, next action `escalate_product_master`.116 - Stock shortage: `backorder`, next action `create_backorder`.117 - Low stock only: `delayed_release`, next action `delay_and_monitor`.118 - Otherwise: `ship_now`, next action `release_to_pick`.119120Shipping quote:121122- Total shipment weight is `sum(line.quantity * product.weight_lb)`.123- Call `/shipping/quote` with order `warehouse_id`, `destination_zip`, total weight, and order `shipping_speed`.124- Return `zone_distance`, `service_days`, and `total_cost_usd` from the quote, rounded to 2 decimals.125126Summary fields usually count decisions, sum shipping costs, and list blocked/manual/backorder/inactive orders sorted ascending.127128### Mixed-warehouse allocation129130Use every order in the requested wave. Return one line action per order line, sorted by `order_id`, then `line_id`.131132For each line:133134- `requested_effective_available` is the effective availability at the order's requested warehouse.135- If the customer has an account/risk exception, set `action: "manual_review"` for all lines in that order, zero all quantities, and use the account/risk reason.136- Else if the product is inactive, set `manual_review` for that line only with `primary_reason: "inactive_product"`.137- Else if requested effective availability covers the full line, set `ship`, `ship_quantity = line.quantity`.138- Else if one alternate warehouse can cover the uncovered quantity from positive effective availability, set `transfer`.139 - `ship_quantity = max(requested_effective_available, 0)`.140 - `transfer_quantity = line.quantity - ship_quantity`.141 - Choose one source warehouse deterministically from eligible sources, preferring larger effective surplus, then stable warehouse ordering.142- Else set `backorder`, `ship_quantity = 0`, and `backorder_quantity = line.quantity`.143144`transfer_requests` mirrors transfer lines. `blocked_orders` includes only account/customer-risk stopped orders, not product-only manual-review lines.145146Order rollup:147148- `ready_to_ship`: all lines ship.149- `needs_transfer`: transfer lines exist, with no manual review or backorder.150- `has_backorder`: backorder exists, with no manual review.151- `manual_review`: all lines are held by account/customer review.152- `mixed_actions`: product-only manual review or a mixture that does not fit the prior categories.153154### Kit replenishment155156Use memo target builds, not stale BOM target dates, for build quantity/date. Fetch each BOM to get kit name, warehouse, and components.157158Component planning:159160- For each SKU, `total_required = sum(quantity_per_kit * target_build_quantity)` across all requested BOMs.161- `target_effective_available` uses the shared effective-availability formula at the planning warehouse.162- If target effective availability is at or above `product.overstock_threshold`, exclude as `target_overstock`.163- Else if no gap remains, exclude as `stocked_no_gap`.164- Eligible timely POs are same-SKU, same-target-warehouse POs with status `open` or `confirmed` and ETA on or before the relevant build need date. Cancelled and received POs do not cover future needs.165- If timely PO quantity covers the gap, use final action `timely_po_covered`, list supporting PO IDs, and put the covered gap units into the summary's timely-PO coverage total.166- Otherwise, consume positive effective surplus from other warehouses as transfers without dipping into protected stock.167- Any remaining gap becomes a purchase requisition from `product.supplier_id` at `product.unit_cost`.168169Transfer requests are sorted by SKU, then quantity descending, then source warehouse. Purchase requisitions are sorted by SKU. `extended_cost = quantity * unit_cost`, rounded to 2 decimals.170171Final action guide:172173- `no_action_stocked`: stocked with no gap.174- `overstock_excluded`: target already meets/exceeds overstock threshold.175- `timely_po_covered`: eligible same-warehouse PO coverage closes the gap.176- `transfer_only`: transfers close the remaining gap.177- `purchase_required`: any purchase requisition quantity remains.178179### Supplier incident scorecard180181Use incidents whose `open_date` falls in the requested inclusive window. Group only suppliers with at least one filtered incident.182183Per supplier:184185- Join supplier name and `quality_status`.186- Count incidents, RMA incidents, WORK_ORDER incidents, open incidents, and severe incidents where severity is `high` or `critical`.187- `incident_percentage = supplier_incident_count / total_filtered_incidents * 100`.188- `total_resolution_cost` is the sum of filtered incident costs.189- `avg_duration_days` averages calendar durations, using analysis date for open incidents.190- Apply the request's recommendation policy in its stated precedence order. Do not reorder policy clauses by intuition.191192Typical recommendation policy:193194- `ESCALATE_SUPPLIER`: quality hold with enough incidents, any critical RMA, or high RMA/cost combination.195- `PROCESS_REVIEW`: WORK_ORDER incidents meet the threshold and exceed RMA count.196- `WATCHLIST`: supplier is watch/hold, incident count/cost/severity threshold is met.197- `MONITOR`: no higher-precedence rule applies.198199`top_escalation_suppliers` includes only escalation-code suppliers and uses the template's tie-breakers. Highest-cost/share supplier fields are single supplier IDs selected after grouping.200201### Procurement quality hold review202203Use only memo-listed supplier IDs and the memo's inclusive incident window.204205Per supplier:206207- Join supplier master data.208- Count recent incidents, recent RMAs, high/critical incidents, and open incidents.209- `affected_skus`: sorted unique SKUs from recent incidents.210- `sample_incident_ids`: sorted incident IDs, capped at 5 when the template requests a sample.211- Decision pattern:212 - `quality_hold` suppliers freeze new replenishment.213 - `watch` suppliers with multiple high/critical recent incidents require buyer review.214 - Otherwise monitor only.215- For freeze or buyer-review decisions, list sorted open/confirmed PO IDs for the supplier. Ignore cancelled and received POs. When many POs qualify, keep the first five sorted IDs to match observed sample-style hold outputs.216- For monitor-only suppliers, `held_po_ids` is empty and the supplier ID belongs in `release_supplier_ids`.217218Top-level `held_po_ids` is the sorted unique union of held supplier PO IDs. Summary counts must reconcile with the supplier rows.219220## Output Field Checklist221222Expedite queue outputs commonly contain:223224- `wave_id`225- `records[]`: `order_id`, `inventory_status`, `customer_exception`, `final_decision`, `next_action`, `shortage_skus`, `inactive_skus`, `low_stock_skus`, `shipping_quote`226- `summary`: order count, decision counts, shipping total, blocked/manual/backorder/inactive order ID lists227228Allocation outputs commonly contain:229230- `wave_id`231- `line_actions[]`: line identity, requested warehouse, requested effective availability, action, quantities, transfer source, primary reason232- `transfer_requests[]`233- `blocked_orders[]`234- `order_rollup[]`235- `summary`236237Kit replenishment outputs commonly contain:238239- `task_id`, `plan_date`240- `kit_targets[]`241- `component_plan[]`242- `transfer_requests[]`243- `purchase_requisitions[]`244- `excluded_components[]`245- `summary`246247Supplier scorecard outputs commonly contain:248249- `analysis_window`250- `summary`251- `supplier_scorecard[]`252- `top_escalation_suppliers[]`253- `highest_cost_supplier_id`254- `highest_share_supplier_id`255256Procurement hold outputs commonly contain:257258- `analysis_window`259- `supplier_decisions[]`260- `held_po_ids[]`261- `release_supplier_ids[]`262- `summary`263264## Common Pitfalls265266- Do not use raw `on_hand` as availability. Always subtract reserved, quarantined, and product safety stock.267- Do not include extra API records just because a wave query returns them. Respect memo-listed IDs.268- Do not let account-review orders proceed to transfer/backorder actions; account/customer exceptions usually dominate stock decisions.269- Do not put product-only inactive lines in `blocked_orders`; those are line-level product reviews.270- Do not count cancelled or received POs as timely coverage or held replenishment.271- Do not use BOM `target_date` when the memo supplies build dates.272- Do not calculate shipping with a unit weight; quote the full order weight.273- Do not use inclusive day counts for incident duration; use date subtraction.274- Do not emit explanatory text outside the JSON answer.