Self-Correction

Self-correction is an AI UX pattern where an agent detects its own error—failed tool call, failing test, or inconsistent plan—and retries or revises with a visible explanation. Users see the fix instead of a silent wrong final state.

Share

Interactive demo

Logs
Waiting for input...

Overview

The design problem

How might we design self-correction so people can trust and act on AI output?

Use this pattern

When this pattern fits

  • Essential for autonomous AI agents, coding assistants, and automated workflow tools where self-recovery from errors improves reliability and user trust.

Avoid this pattern

When to skip or lighten it

  • One-shot answers where retries would surprise the user with extra cost.
  • Domains where automatic retries can amplify damage (notify and stop instead).
  • Creative tasks where “wrong” is subjective and user taste should drive edits.

States

State model coming soon

Key UX elements

Key UX elements coming soon

Anti-patterns to avoid

  • Endless retry loops with no budget or user cancel.

  • Corrections that hide the original failure evidence.

  • Claiming success after a partial fix that still fails checks.

  • Burning tokens on retries without showing cost impact.

How products use it

ProductImplementation
CursorAgent retries after command failures with updated plans.
GitHub CopilotIterative fix suggestions when prior code fails.
AutoGPT-style agentsLoop on errors with revised steps in the task log.
LangChain agentsTool error handling and re-planning in traces.

Implementation

Copy this prompt to generate a production-ready implementation in Cursor, Claude Code, Lovable, or any AI coding agent.

Generate a production-ready implementation of the "Self-Correction" AI interface design pattern.

Pattern Definition:

Frequently asked questions

What is self-correction in agent UX?

Self-correction is when the agent notices a failure or inconsistency and attempts a fix, while showing the error and the revised step to the user.

How is it different from a repair contract?

Self-correction is initiated by the agent. A repair contract is initiated by the user with explicit keep/change constraints.

How many retries are safe?

Cap retries with a budget and escalate to the user after repeated failure. Show the count and stop reason.

What should the UI show during correction?

The failed step, the hypothesized cause, and the next attempt. Collapsed traces are fine if expand reveals detail.

Weekly AI UX in your inbox

Weekly AI interface UX notes and resources on Substack, no spam, unsubscribe anytime.

Subscribe on Substack