Run recovery

When a run fails partway, shows what finished, what broke and why, and lets you retry from that step, skip it, or change the input.

Loading preview…

Install

  1. 1

    Run this command in your Tailwind CSS project. It adds components/ai/run-recovery-inline.tsx and installs its dependencies.

    $ npx shadcn@latest add https://gradientdeck.com/ai-components/r/run-recovery-inline.json

Usage & API

Example

run-recovery-inline.tsx
import { RunRecovery } from "@/components/ai/run-recovery-inline"

<RunRecovery
  title="…"
  state={state}
  steps={[]}
  onRetry={() => {}}
  onCancelQueue={() => {}}
  onRetryWith={() => {}}
  onSkip={() => {}}
  onStop={() => {}}
/>

Props RunRecovery

PropType & descriptionRequired
titlestringRequired
stateRunStateRequired
stepsRunStep[]Required
failureStepFailure | nullOptional
inputInputField[]The failed step's input, editable before a retry.Optional
waitLeftnumberSeconds the service asked us to wait. 0 means go ahead.Optional
waitTotalnumberOptional
queuedbooleanA retry is queued for when the wait ends.Optional
elapsedstringOptional
onRetry(now: boolean) => voidRequired
onCancelQueue() => voidRequired
onRetryWith(input: InputField[]) => voidRequired
onSkip() => voidRequired
onStop() => voidRequired
onResume() => voidOptional
onRunAgain() => voidOptional

Dependencies

  • React
  • Tailwind CSS
  • motion
  • lucide-react
Implementation notes

The card titles the run and badges the state. Done steps show a check and can expand their detail. The running step shows a progress bar. A skipped step is struck through. The failed step prints the summary, the explanation, and a Technical detail disclosure with the raw text in a scroller. Retry this step is the primary button. Edit input and retry opens a form of the keys you passed, with Cancel and Retry with these, the latter disabled until a value changed and every field is valid. Skip and continue and Stop sit beside them. A wait from the service shows an hourglass, the seconds left, and, if a retry is queued, Cancel. Once the person stops the run, Resume appears. Once it finishes, Run again appears.

Choosing a layout

Use the inline card when the person is still in the conversation and the failure is one step with a short explanation. Use the resume page when the run has enough steps that picking a checkpoint, reading the error and editing the input need a full page, with the other steps still visible.

Editing a tool call before the first attempt is edit before run. A decision that has not been answered yet is the decision inbox. Recovery is for a run that already started and did not finish. A thread of comments on a finished run is the agent thread, which does not offer skip or retry-from-here.

Does Skip and continue delete the failed step's work?

Skip marks that step skipped and asks you to carry on. The card does not roll back earlier steps. Their results stay listed. Stop is the control that halts the run, and the preview's note says what had already been written.

Can a retry change the input, or only repeat it?

Both. Retry this step repeats the step. Edit input and retry, on the card, and the editor on the resume page, send the replacement values. Numbers have to fall inside min and max, and an empty text field is rejected.