Recovering an agent after a crash is not the same as safely repeating everything it was doing. A tool may have changed the outside world before the harness persisted its result. Restarting that call without knowing what happened can duplicate a deploy, message, or payment.
Pi Durable makes this boundary explicit: persist tool intent, track execution as a checkpointed task, and automatically replay an interrupted tool only when it declares replay safe. Otherwise, tell the model it was interrupted and include the output saved so far. The policy is from Pi Durable; the business-safety interpretation below is wiki synthesis.
Three different guarantees
- Submission deduplication: retrying the same client
requestIdfinds the original submission. This prevents duplicate intake into the harness. - Task recovery: persisted checkpoints let a replacement process recover unfinished work, with replay policy deciding what may run again.
- Business-effect idempotency: an external service treats repeated attempts at the same logical operation as one effect. This must be provided by the service or designed in the application.
The first two do not imply the third. A deduplicated “charge this card” request can still contain a tool interrupted after the provider accepted the charge but before the local result was committed.
The ambiguous-outcome window
Consider a payment:
- Persist the intent to charge.
- Send the charge to the provider.
- The provider accepts it.
- The process dies before recording the receipt.
The durable task knows what it intended, but its stored state alone cannot establish whether step 3 happened. A local transaction cannot atomically include an unrelated remote provider.
A stable idempotency key can let a retry recover the same operation rather than create a new one, if the provider’s contract actually guarantees that behavior. Otherwise, query or reconcile the existing operation before deciding what to do. Marking a non-idempotent operation replay-safe merely makes unsafe repetition automatic.
Replay-safe is a contract, not a label of convenience
A read-only search is often safe to repeat, even if the returned data changes between attempts. A write can be replay-safe only when its semantics support repetition of the same logical action, for example through a stable key and a suitable destination contract.
An unsafe-to-replay tool does not automatically become safe because the model is informed of the interruption. The model can request another attempt. Enforce retry, authorization, and idempotency boundaries in the tool or business service, not just its description.
The same issue applies to approval hooks: a persisted answer can be reused; an answer received but not yet persisted can be lost. Design correlation IDs and pending-approval recovery rather than assuming a memo makes the external interaction exactly-once.
Cancellation and compensation
Pi Durable’s ownership tree propagates cancellation through owned tasks and gives tasks cleanup handlers. Its payment example charges multiple cards concurrently and compensates with refunds if another charge fails.
Compensation is not rollback. A refund is a new operation that can be delayed, fail, or have its own ambiguous outcome. Cancelling the local task does not undo a remote effect by itself. A production workflow needs recorded business-operation IDs, observable compensation status, and a reconciliation path for incomplete cleanup.
Foreground and background ownership also matter: an ordinary conversation abort need not stop background work. The UI must make clear what continues after cancellation.
How to evaluate a durable agent
Use failure injection, not only happy-path tests:
- Kill the process before dispatch, during execution, and after the remote effect but before local completion.
- Retry the same submission and verify that intake is deduplicated.
- Check that replay-safe tools reuse stable operation identifiers.
- Check that unsafe interruptions surface as unresolved outcomes, not silent retries.
- Fail the compensation itself and verify that reconciliation remains possible.
This is the side-effect boundary of Agent State and Resumability, Human-in-the-Loop as a Tool Call, and Cloud Agent Infrastructure. Persisted history is essential, but safety also depends on the contracts of the services the tools call.
Source
- Pi Durable: replay policy, checkpoints, submission IDs, task memos, ownership, and the illustrative payment/compensation example. The external-effects caveats are engineering interpretation, not a claim of a demonstrated bug in the package.