Loading...
Reversible Actions & Compensation (Agent Saga)(Saga)
A pattern for making agent side effects safe to undo. Structure the trajectory as a saga: every forward action (book a flight, charge a card, create a record) is paired with a compensating action that reverses its business effect, and every tool is made idempotent with an idempotency key so a retry or a rollback produces the same end state instead of duplicating work. When a step fails partway through, the agent runs the compensations for the already-completed steps in reverse order rather than leaving the system half-applied. There is no automatic ACID rollback across services, so compensations are explicitly designed as the logical inverse of each action. Distinct from `durable-execution`: that persists and replays a run so it can continue to completion after a crash, whereas this defines how to semantically undo committed side effects when completion is no longer the right outcome.
Loading technique guide…
Reversible Actions & Compensation (Agent Saga)(Saga)
A pattern for making agent side effects safe to undo. Structure the trajectory as a saga: every forward action (book a flight, charge a card, create a record) is paired with a compensating action that reverses its business effect, and every tool is made idempotent with an idempotency key so a retry or a rollback produces the same end state instead of duplicating work. When a step fails partway through, the agent runs the compensations for the already-completed steps in reverse order rather than leaving the system half-applied. There is no automatic ACID rollback across services, so compensations are explicitly designed as the logical inverse of each action. Distinct from `durable-execution`: that persists and replays a run so it can continue to completion after a crash, whereas this defines how to semantically undo committed side effects when completion is no longer the right outcome.
Loading technique guide…