1:1 mentoring with Big Tech AI engineers
Q17Premium

An action failed halfway through a 5-step workflow. What happens to the first 3 steps?

Tradeoffs & Scenarios

ReliabilityIdempotencyProductionArchitecture

Asked at Stripe · Amazon · Salesforce

How to Answer

“The first three steps already happened — that’s the entire problem. An agent that takes real actions is a distributed transaction with a language model as the coordinator, and there is no rollback for ‘the money moved’.

So I design for it three ways. Every write tool takes an idempotency key, so a retry after a timeout can’t charge anyone twice. Every step’s result is checkpointed, so a resume starts at step 4 instead of replaying step 1. And every irreversible step has a compensating action written before it ships — refund for charge, cancellation for booking — because undo has to be something you built, not something you hope for.

Then I order the workflow so the irreversible steps land last wherever I can. If steps one to three are reads and step four sends the email, a failure at four costs nothing at all.”

The deep dive — diagrams, tradeoff tables, and the follow-up trap

Loading…