Standing Order Agent / Workflow module
Workflow module

The state machine that makes the agent safe to resume.

Order Orchestration is the only module that coordinates preferences, products, rules, Intelligence, Browser Control, and the retailer. Every consequential transition is persisted before the next effect.

14explicit states
1snapshot hash
1cart ownership ledger
0blind retries
State machine

One durable order cycle

Order orchestration state machine
Order orchestration state machine
The main prototype path ends at awaiting review and manual handoff. Future checkout states are shown so the approval and ambiguity boundaries are designed early.
Responsibilities

The sole coordinator of side effects

Plan

Freeze the product, preference, rule, and schedule versions used to construct the desired cart.

Reconcile

Compare desired items with the live cart, classify ownership, and apply only verified differences.

Review

Select an allowed slot, re-read the checkout summary, evaluate rules, and freeze a user-visible snapshot.

Resume

Persist every state transition and wait state so a worker restart or user delay does not lose context.

Guard

Validate approval, snapshot, amount, slot, address, mode, consent, and recent authentication before any future checkout.

Verify

Declare confirmation only when retailer evidence contains the expected account, order reference, and delivery details.

Review snapshot

Approval is bound to exact facts

ReviewSnapshot {
  items[]
  substitutions[]
  quantities[]
  itemPrices[]
  fees
  discounts
  authorizationTotal
  deliveryAddressFingerprint
  deliverySlotRef
  ruleSetVersion
  preferenceVersion
  cartFingerprint
  retailerSessionFingerprint
  createdAt
  expiresAt
}

Invalidation rules

Canonicalize and hash the snapshot. Any material product, quantity, substitution, price, fee, total, address, slot, policy version, or retailer account change creates a new snapshot and invalidates prior approval.

  • Approval includes an approved maximum
  • Approval has a short expiration
  • Approval actor and authentication are recorded
  • Snapshot hash must match at checkout time
Cart ownership

Never assume the cart is empty

ClassificationMeaningBehavior
Agent-ownedAdded by this order cycle and ledger entry matchesMay reconcile quantity within current plan
Pre-existingPresent before the runPreserve and show separately unless user chooses otherwise
ChangedUser or retailer modified an agent-owned lineDo not overwrite silently; re-plan or review
UnknownOwnership cannot be provenNeeds review before mutation