Skip to content

Prompt-backed scenario · M1Updated

Inventory restock AI agent: a prompt-backed reference workflow

In brief

An inventory restock AI agent can classify a stock update against a per-SKU reorder threshold, create a purchase-order draft only for critical best-sellers, preserve restock history, and suppress repeat alerts for six hours unless urgency increases. This page turns those prompt rules into a reviewable contract; it does not claim that the backend was generated or deployed.

Corpus M1 · contract map

Trace one stock event through urgency, action, and suppression rules.

Review before build
  1. 01 · Input

    Typed request + state

    • sku
    • current_quantity
    • warehouse_location
    • reorder_threshold
    • is_best_seller
  2. 02 · Decide

    Prompt-owned rules

    • Classify urgency from quantity
    • Gate the purchase-order action
    • Preserve restock history
    • Suppress duplicate alerts
  3. 03 · Return

    Inspectable contract

    • urgency
    • purchase_order_draft
    • procurement_notification
    • history_event
    • alert_action
PromptApproved contract
A stock update and per-SKU state pass through five inventory decisions before producing an inspectable action contract and boundary-test evidence.

Corpus M1

The exact acceptance-corpus prompt

Corpus M1

Inventory Restock Agent

#2567 · source prompt
Build a backend agent that manages inventory restock alerts for a small e-commerce store. Requirements: 1. Receive a stock update event (SKU, current quantity, warehouse location) 2. Auto-classify urgency based on quantity vs. a per-SKU reorder threshold (critical: below 20% of threshold, low: below threshold, ok: above threshold) 3. If urgency is critical AND the SKU is marked as a best-seller, auto-create a purchase order draft and notify the procurement team immediately 4. Track each SKU's restock event history (event type, quantity at time of event, timestamp) 5. Suppress duplicate alerts for the same SKU within a 6-hour window unless urgency escalates to a higher level than the last alert

This is a prompt-backed reference scenario, not a customer result, verified generated artifact, deployed service, or live endpoint. The source is the public generation acceptance corpus in issue #2567. At the 2026-08-08 checkpoint recorded there, the Medium scenarios had not been proven end to end.

Contract surface

Input and state fields

Stock update event

The three fields named by the incoming-event requirement.

sku
Identifies the inventory item.
current_quantity
Quantity at this event.
warehouse_location
Warehouse attached to the update.

Per-SKU business state

State required to evaluate the prompt without hiding a rule in prose.

reorder_threshold
Threshold used for urgency classification.
is_best_seller
Controls the critical purchase-order action.
last_alert_at
Starts the six-hour duplicate window.
last_alert_urgency
Allows an escalation to override suppression.
restock_event_history
Stores event type, quantity, and timestamp.

Fields are shown because the rule depends on them. Names are a reviewable contract draft, not a claim about a generated schema.

Decision logic

Business decisions to approve

  1. 01

    Classify urgency from quantity

    Critical is below 20% of the per-SKU reorder threshold; low is below the threshold; ok is above it.

  2. 02

    Gate the purchase-order action

    Only when urgency is critical and the SKU is a best-seller should the backend draft a purchase order and notify procurement.

  3. 03

    Preserve restock history

    Every history record keeps the event type, quantity at the time of the event, and timestamp.

  4. 04

    Suppress duplicate alerts

    A repeat alert for the same SKU inside six hours is suppressed unless urgency is higher than the last alert.

Response shape

Reviewable output contract

urgency
critical, low, or ok after the threshold rule is approved.
purchase_order_draft
Present only for a critical best-seller.
procurement_notification
Matches the same critical best-seller gate.
history_event
Event type, quantity at the event, and timestamp.
alert_action
send or suppress, with the rule that made the decision.

An approved specification should expose these decisions as typed response fields or traceable side-effect records. Generation must not infer a missing rule after approval.

Behavior checks

Positive, negative, and boundary probes

  1. 01

    Critical + best-seller

    Draft the purchase order and notify procurement.

    Positive case for the conjunctive action gate.

  2. 02

    Critical + not a best-seller

    Create neither the draft nor the procurement notice.

    Negative case proves that critical urgency alone is insufficient.

  3. 03

    Same SKU inside six hours, same or lower urgency

    Suppress the duplicate alert and still record the event.

    Exercises the time window without losing the required history.

  4. 04

    Same SKU inside six hours, higher urgency

    Release the alert because urgency escalated.

    Positive case for the suppression override.

  5. 05

    Same SKU at or after six hours

    The previous alert no longer suppresses the new one.

    Checks the outside edge of the stated within-six-hours window.

Approval gate

Questions the prompt leaves open

Exact equality at 20% and at the reorder threshold is not defined by the prompt; the approved specification must classify both values explicitly.

The prompt does not define how warehouse location affects per-SKU alert identity; the approved specification must state whether suppression is global or per warehouse.

This is where a spec-first workflow earns trust: unresolved boundaries remain visible until a human approves them. Read the seven-step implementation guide or see how the same review boundary fits an agency handoff.

Continue reading

Bring a client workflow.

Create a workspace, spec the requirement and expected API shape, and take the artifact through validation.

Get started