Interactive engineering lab

Saga intermediate state: what an agent reads and what it commits

Saga intermediate state: what an agent reads and what it commits. Move the read, the step time and the saga window to see decisions on undone values.

By Sandeep Belgavi · Published 2026-11-30

Synthetic fixtures computed locally. No model or production service is contacted.

Experiment workspace

Decision trace

    The question this experiment answers

    When a reorder agent reads stock that an in-flight order saga has reserved, can it commit a supplier purchase order on a value the saga later undoes? Set the copies on hand, the reservation, when the saga reserves and resolves, whether it compensates or completes, when the agent reads, how long its step takes, its reorder rule, and what the stock read tool returns. The model replays the timeline and reports the decision, the values the agent saw and the final state.

    Change one assumption at a time

    Start from a preset and change a single control. In the raw-read preset, switch the outcome to Completes and watch the same purchase order become correct. Switch the read mode to Pending flag and the agent defers until minute 40. Switch to Version check and raise the step duration from 5 to 25 minutes to see a commit rejected. Shorten the saga window by moving the resolve minute close to the reserve minute and watch the sweep count fall.

    Expected outcomes

    Raw read, saga compensates: reorder at minute 25 on an availability of 1 that ends at 3, so the decision rests on an undone value, and 30 of the 60 read minutes do the same. Raw read, saga completes: the same reorder is correct. Pending flag: the agent defers and decides at minute 45, no reorder when the saga compensates. Version check with a 5-minute step: still decides on the undone value. Version check with a 25-minute step: 1 commit rejected and no reorder at minute 70. One-minute saga window: 1 of 60 read minutes. These match the companion Python model.

    Read the metrics and the trace

    The metrics show the decision, the availability the agent read, the availability after the saga, whether the decision rests on an undone value and how many commits the version check rejected. The sweep counts, over read minutes 0 to 59, how many reads lead to a decision on an undone value; it grows with the saga window. The table lists the reads, rejected commits, the decision and the saga resolution in time order. The trace explains each step, starting with the full setup.

    What to take back to a real system

    Return pending reservations separately from committed ones in agent read tools, put the policy for pending state in code, and require the commit to carry the version it read. Measure two durations in production: how long sagas hold intermediate state and how long agent steps take between read and commit.

    Limits

    A single stock row, one saga and one agent, whole-minute times and one re-read after a rejected commit. It does not model several sagas on the same row, partial compensation, read replicas with lag, or the purchase-order service's own checks. All values are synthetic Belgavi's Book Store data, and no service or model is contacted.

    Views are my own and do not represent any employer, past or present.