The model repeats the same invalid proposal
Detect: Normalized artifact fingerprints and error codes repeat.
Recover: Stop and escalate with the original defect evidence.
Repair specific validated defects in an agent’s work through bounded feedback, preserving accepted facts and preventing repeated unsafe actions.
Self-correction loops use observed errors to revise an output or proposed action. A parser error, failed test, missing citation, or tool-schema rejection can provide precise feedback. The loop is useful when the defect is repairable and a reliable validator can tell whether the repair succeeded.
Distinguish correction from retry. A transient network failure may justify repeating the same request; a malformed query needs a changed proposal; an unauthorized action must remain denied. Never allow correction prompts to weaken policy or invent missing evidence simply to satisfy a validator. Preserve original errors and accepted intermediate results.
A prototype can feed structured validation errors back to the model once and compare repaired output with the original. Measure introduced defects as well as successful repairs.
Production classifies errors, limits attempts, protects immutable facts, and requires every revision to pass the same checks. Commands with side effects need reconciliation before any corrected attempt.
At scale, analyze repair success by defect class and disable loops that mostly consume tokens. Frequent correction may indicate a bad schema, unclear tool contract, or inadequate base model rather than a need for more iterations.
Separates transient, repairable, policy-denied, and irrecoverable failures.
Produces concrete machine-readable defects and independently checks corrected artifacts.
Revises only the permitted fields or action arguments within the original task scope.
Retains accepted facts, previous versions, and external operation identities.
Caps attempts, cost, elapsed time, and repeated equivalent failures.
flowchart LR
A["Candidate artifact"] --> V["Independent validator"]
V --> E["Error classification"]
E --> C["Bounded correction"]
E --> R["Transient retry policy"]
E --> H["Stop or human review"]
C --> G["Regression validation"]
G --> S["Accepted artifact"]
G --> E
P["Protected facts and operation IDs"] --> CRecord the failed artifact and a specific validator result without losing original evidence.
Decide whether to retry, revise, escalate, or stop based on error semantics.
Identify editable fields and protect verified facts, permissions, and completed operations.
Request a targeted change using structured feedback and remaining budget.
Apply the original checks plus regression checks on previously accepted content.
Accept the corrected artifact or return an explicit unresolved result when progress or budget is exhausted.
Manufacturing analytics · Illustrative enterprise scenario, not a reported customer outcome.
A factory analyst asks an assistant to compare downtime across production lines using a governed analytics service.
The model sometimes references a renamed column or returns a query whose aggregation does not match the requested period.
The assistant must repair valid analytical mistakes without expanding access or issuing unrestricted database commands.
A read-only query gateway validates schema, permitted tables, and result shape; structured errors feed a bounded correction worker.
If the correction requests a restricted table, authorization denies it and the loop stops instead of trying alternative access paths.
Track repair success, repeated error classes, introduced regressions, and total cost per accepted query. Correction is a recovery mechanism, not proof of analytical correctness.
| Decision | Benefit | Cost |
|---|---|---|
| Targeted feedback | Concrete defects are often easier to fix than regenerate broadly. | Validators need precise and safe error messages. |
| Multiple attempts | Some repairable tasks can recover without human work. | Repeated revisions consume latency and may drift from the objective. |
| Protected facts | Accepted evidence survives local repairs. | Change constraints can limit legitimate broader corrections. |
Detect: Normalized artifact fingerprints and error codes repeat.
Recover: Stop and escalate with the original defect evidence.
Detect: Regression checks find altered filters or aggregation semantics.
Recover: Reject the revision and preserve the prior validated scope.
Classify transient, semantic, policy, and uncertain-effect errors.
Keep acceptance rules stable and stop when limits are reached.
Reconcile the existing operation before any new effect.