Persist state after every meaningful step (messages, plan, tool results, pending actions) in a database, and design the loop so it can resume from the last checkpoint.
Make steps idempotent (stable call IDs, idempotency keys) so replaying after a crash does not repeat side effects; long-running agents can run on a workflow engine (such as Temporal) or a job queue with retries.
Store enough to reconstruct the context and verify progress, and support cancellation and timeouts.
Loading…