One agent in a workflow stalls midway through its task. What is the best recovery pattern?
Why A is the answer
Detect the stall, roll back or retry the step, and escalate to a person if needed
Recovery patterns include rollback and human-in-the-loop. Letting others build on bad output spreads the failure.
In detail
- Detect the stall first.
- Roll back or retry the step, then escalate if needed.
- Set a time limit for each step, so a stall is detected.
Use case
An illustrative scenario, not a real incident.
One agent stalls during a test step. The workflow detects it, retries the step once, then escalates to a person with the logs.
See it in different ways
stateDiagram-v2 [*] --> Running Running --> Stalled: no progress Stalled --> Running: retry from a checkpoint Stalled --> Escalated: retry fails Escalated --> [*]
sequenceDiagram participant W as Workflow participant A as Agent participant H as Human W->>A: Step A--xW: Stalls or fails review W->>W: Pause later steps W->>A: Retry or roll back W->>H: Escalate if it still fails
stateDiagram-v2 state "Running" as s0 state "Stalled" as s1 state "Retry step" as s2 state "Escalate" as s3 [*] --> s0 s0 --> s1: no progress s1 --> s2 s2 --> s0: recovers s2 --> s3: still stuck s3 --> [*]
Key point: Detect, recover, then escalate.
Why the other options are wrong
- B. Let the other agents continue on the partial output, and fix it in review
- Partial output spreads the fault to later steps.
- C. Delete all branches from the run and start the whole workflow again
- Deleting everything throws away good work.
- D. Leave it running until a user or a reviewer complains about it
- Waiting for complaints leaves the workflow stuck.

