Skip to content
Preptima
hardDesignScenarioSeniorStaff

Design a platform that runs agent tasks for hours and pauses for a human to approve risky steps.

Use durable execution. Persist every model output and tool result as a step in a log, so a run resumes on any worker by replaying recorded results instead of asking the model again. An approval wait suspends the run with no thread held, and every tool is idempotent on a run-and-step key.

6 min readUpdated 2026-10-10

Answer

Short answer

Treat each run as durable execution, not as a process that happens to live a long time. Write every model output and every tool result to a step log before moving on, so any worker can resume the run by replaying what was recorded. A human-in-the-loop approval then becomes a stored state with an expiry, not a thread waiting on a person. Make every tool idempotent on a key derived from the run and step.

Was this answer helpful?

Likely follow-ups

  • You deploy a new prompt while two hundred runs are suspended. Which version does each one resume on?
  • The approver wants to edit the amount rather than approve or reject. How does that enter the run?
  • A run has been going for six hours and its transcript no longer fits the context window. What do you carry forward?
  • How would you test that a run survives a worker being killed at every possible step?

Related questions