When an Agent Task Fails Halfway, Resume the Missing Steps

Verify existing artifacts and reconcile uncertain writes before retrying.

Buda Team
← Back to Blog
When an Agent Task Fails Halfway, Resume the Missing Steps

The sources have been collected and the report has been written, but the final write never returned a result. Running the entire task again could generate another report or send the same message twice. Skipping the last step could leave the real work unfinished.

Recovery starts by establishing what actually happened. You can use Buda’s persistent Drive and scheduled task instructions to build a checkpoint method: each run inspects existing evidence before deciding what to do next. Your team must define the states and verification rules. A file by itself is not a transaction lock, and this approach does not guarantee that an action executes exactly once.

Identify the business work across runs

Buda Automations can initiate work on a Cron schedule, at an interval, or once. Run status, timing, and the associated session help you locate an execution. A business deliverable can span several executions.

Give each deliverable a stable identity: the object being processed, the business date or reporting window, the kind of output, and its version. A retry tomorrow for yesterday’s report still belongs to yesterday’s work. Record the new attempt time without silently changing the report’s date.

If the input changes, decide whether you are completing the original version or creating a revision. Preserve the relationship between versions. Otherwise, two files based on different inputs may be mistaken for the same result.

Keep completion evidence beside each stage

A useful checkpoint points to inputs, artifacts, validation results, and receipts for external actions. A checklist with checked boxes is insufficient.

| Stage | Save | Verify before resuming |

| --- | --- | --- |

| Read sources | Source locations, data window, readability | Whether the input is complete and has changed |

| Generate content | File location, version, input references | Open the actual artifact and inspect coverage |

| Validate content | Checks, results, unresolved questions | Whether validation covered the current version |

| Write or send externally | Destination, returned ID, explicit result | Whether the destination contains the intended result |

| Deliver | Review link and acceptance state | Whether the output was merely generated or accepted |

A manifest in the working directory can hold this information for the Agent to read each time. The manifest’s structure is a team convention. Drive persists the files; it does not automatically verify the business state represented by them.

 Reuse verified work

Distinguish not started, failed, and unknown

“Not started” means no action was initiated. It may proceed within the existing authorization. “Failed” requires checking the cause and whether retrying is appropriate.

“Unknown” is different. A request was sent, but the connection ended before a clear response arrived. The server may already have stored the record or delivered the message. Recording an unknown outcome as a failure invites duplication.

Query the destination using its supported lookup mechanism first. If the API supports idempotency keys, reuse the same key according to that API’s contract. If there is no reliable reconciliation mechanism, retain the unknown state and escalate to someone authorized to decide what happens next. A local “ready to send” marker proves no delivery; an absent local success marker proves no absence at the destination.

Resume by verifying existing work

First, load the stable business identity, original input version, checkpoint, and associated artifacts.

Second, open existing files. Confirm they are readable, complete, and based on the expected input. Filenames and modification times are not enough.

Third, reconcile external actions already attempted. Resolve unknown outcomes before deciding to repeat anything. If delivery is already verified and no input has changed, return the completion evidence.

Fourth, list the stages genuinely missing. Execute those stages only. When an upstream change invalidates downstream work, regenerate the affected portion and retain the previous version.

Finally, save the observed result and remaining questions. An execution ending does not make the business deliverable complete.

 Three outcomes, three actions

Put recovery instructions at the beginning

The next run needs to know what evidence to inspect before taking action. Add the method to the scheduled task instruction or an appropriate Skill. A starting instruction can be:

Read the checkpoint, original input version, and existing artifacts for this business date and object. Verify completion evidence at each stage. Continue only missing work or explicitly failed work that is safe and authorized to retry. For timed-out external actions or unknown outcomes, query the destination first; if the result cannot be established, stop that action and report the uncertainty. Preserve the original business date, files, and version relationships. If another execution appears to own the same work, verify ownership before changing its progress. Save actual completion states, artifact links, and unresolved issues.

For reusable procedures, search for and install a suitable Skill in Buda AI’s Marketplace, then check that it covers these recovery rules. Installing a Skill does not add idempotency guarantees to the destination system.

Handle overlapping executions explicitly

Define who owns the work and where that ownership is recorded. A shared file makes progress visible to people and Agents; its filename alone does not establish a reliable concurrent lock. Important external writes should use the destination’s supported version checks, idempotency, or other concurrency controls.

If another run is active, inspect its artifacts and state before taking over. When ownership cannot be established, preserve the current work and report the conflict. A clear pause is easier to recover from than a repeated irreversible action.

 Reconcile both sides

Check recovery in three situations

Begin with a low-risk internal task. Check whether the Agent opens and reuses a complete artifact, resumes only affected work after an explicit failure, and queries the destination before repeating an action with an unknown outcome. These are proposed acceptance conditions; retain actual inputs and outputs before calling them passed.

Reliable recurring work depends on preserving partial completion and uncertainty accurately. With that evidence available, the next run can continue from the missing step instead of starting over.