AI Agents, Evergreen

How to Design Effective Feedback Loops for AI Agents

Cartoon robot agent watching its draft being graded on a scoreboard while a human holds a checklist, with a loop arrow circling back.

An agent that never checks its own work will repeat the same mistake until its budget runs out. The difference between that agent and one that gets better as it works is the quality of its feedback — and ai agent feedback loops are the mechanism that carries it. This article explains what a feedback loop is inside an agent system, the four loop types worth knowing, how to design one around signal, cadence and authority, and how to measure whether the loop is helping or quietly making things worse.

What a feedback loop is in an agent system

An agent runs a loop: it reasons about the situation, takes an action through a tool, observes the result, and repeats until the goal is met or it decides to stop. That loop already contains feedback — the tool result is an observation the model reads on its next turn. But the raw loop is not a designed feedback loop. A designed loop adds an explicit evaluation step: something judges the draft, the tool result or the plan, and the judgement changes what happens next. The shape is always the same — act, observe, evaluate, adjust — and the evaluation is what makes round two different from round one.

The reason a loop matters is that a language model cannot see its own mistakes. It works from training and context; nothing in that process tells it whether the tool call it just made worked, whether the file it wrote is valid, or whether the answer it produced matches the facts. Feedback is the only way the system learns what happened.

Every feedback loop needs three things to be worth building: a signal that says something true about the work, a way to feed that signal back into the agent’s next step, and a stopping rule. A loop with no reliable signal is just extra model calls. A loop with a good signal but no path back into the agent is a dashboard, not a loop. And a loop with no stopping rule will run until the budget does.

The four loop types and when to use each

Cartoon robot at a crossroads of four looping paths: a mirror, a conveyor belt of toolboxes, a human checkpoint gate, and an evaluation scoreboard.

Feedback loops in production agents come in many forms; this guide organises them into four types, and the first design decision is which one the task actually needs.

Self-evaluation loops. In Anthropic’s evaluator-optimizer workflow, one model call generates a response while another call evaluates it against explicit criteria and returns feedback, and the two repeat until the criteria are met or a cap is hit. Anthropic’s guidance is that this pattern fits when evaluation criteria are clear and iterative refinement provides measurable value — literary translation and complex multi-round search are its examples. The important detail is the separation: the evaluator judges and does not rewrite, and ordinary code owns the loop, carrying drafts and feedback between the two calls and deciding when to stop.

Tool-result feedback. This is the loop the agent already runs: a tool returns a result, an error or an empty response, and the model reads it as its next observation. The design work here is in the tool, not the model: a tool that returns a typed error with a reason the model can act on gives the agent feedback it can use, and an empty result or a reported failure is still an observation the agent can reason about — what is lost is only a failure that is never surfaced to the agent at all. Start with tool-result handling, and let your own system’s observed failures and costs decide how much further to invest.

Human-in-the-loop feedback. Some decisions should not be made by a loop at all. LangChain’s human-in-the-loop middleware pauses the agent before a tool call runs so a person can review it. The reviewer approves the call as proposed, edits its arguments, rejects it with feedback explaining why, or answers in place of the tool. The graph state is saved, so the run can pause safely and resume later. Use this loop for actions that are hard to undo — sending a message to a customer, deleting a record, moving money — where a wrong automatic retry is worse than a wait.

Evaluation-driven and reward loops. The slowest loop runs outside the agent entirely: a task set, a set of graders, and a comparison of before and after. Results from normal and adversarial runs feed back into policy and defences — OpenAI’s governed-agents cookbook describes exactly this with GuardrailEval, where evaluation results tune the guardrails. Reward signals work the same way over a longer horizon: human feedback and reward models steer the agent’s behaviour across many runs rather than fixing one draft. This loop is how you know whether the other three are working.

The loop structure is small enough to sketch in a few lines. The sketch below shows the evaluator-optimizer shape with code owning the loop; it is pseudocode, not a runnable program.

# Pseudocode sketch — the loop structure, not a runnable program
draft = generate(task, criteria)              # first draft
for round_number in range(1, max_rounds + 1):
    verdict = evaluate(task, criteria, draft) # scores plus written feedback
    if verdict.all_criteria_met:
        break
    draft = generate(task, criteria, draft, verdict.feedback)

Designing a loop: signal, cadence, and authority

Three decisions determine whether a loop helps: what signal it evaluates, how often it runs, and what it is allowed to change.

Signal. The signal is the whole game. A loop is only as good as the evidence its evaluator sees, and the strongest warning in the research is about loops with no external evidence at all. Huang and colleagues tested intrinsic self-correction — a model reviewing its own reasoning with no external feedback — and found that accuracy did not improve and often degraded: invited to reconsider, models revised correct answers into incorrect ones. Earlier optimistic results, they showed, had quietly leaned on external signals, including oracle knowledge of the correct answer. The design rule follows directly: never let the writer be the only checker. Ground the evaluator in something outside the generator — a test result, a database error, a rendered page, a retrieved document, a human judgement. Anthropic’s harness-design writing agrees: agents asked to judge their own output tend to praise it even when it is mediocre, and a standalone evaluator is easier to tune toward scepticism.

Cadence. Every loop iteration costs model calls, latency and tokens. A loop that runs after every step is fast to correct but expensive; a loop that runs only at the end is cheap but lets errors compound through the whole run. The practical answer is to match cadence to the cost of being wrong: cheap, verifiable checks (a test, a schema validation, a database lookup) can run every step, while expensive model-as-judge evaluations belong at checkpoints — after a draft is complete, before a side effect happens, or when the agent asks for review. Put a hard cap on rounds either way; a loop that cannot converge should stop and escalate, not keep spending.

Authority. Decide in advance what the loop may change without a human. A loop that rewrites a draft is low-risk; a loop that retries a payment, deletes a file or sends a message is not. The OpenAI Agents SDK makes this concrete with guardrails — functions that inspect an input or output and can halt execution — and guardrail checks can run concurrently with the agent’s work, so a check may complete after the agent has already begun. For any action with side effects, place the required authorization or validation before the specific action it protects, rather than relying on a check that runs alongside it. The same principle applies to every loop: the more irreversible the action, the more the loop should pause for a human instead of deciding itself.

Measuring whether the loop helps

Cartoon robot with a checklist studying a before-and-after scoreboard, one gauge pointing down and one pointing up, with a loop arrow above.

A feedback loop that is never measured is an assumption, and the research gives a reason to be suspicious of assumptions here. In Huang and colleagues’ experiments, GPT-3.5 fell from 75.8% to 38.1% on CommonSenseQA after one round of intrinsic self-correction, and GPT-4 fell from 95.5% to 89.0% on GSM8K after two rounds. A loop can make an agent worse, and it will do so quietly — the agent still returns an answer, still sounds confident, and still costs more than the version without the loop.

The measurement that catches this is a before-and-after evaluation on a fixed task set: run the same tasks with the loop on and with the loop off, and compare accuracy, cost per task and latency. Anthropic’s eval guidance for agents recommends choosing deterministic graders where possible, LLM graders where necessary or for additional flexibility, and human graders judiciously for additional validation — and evaluating agents on their trajectories, not just their final answers.

Cost is part of the measurement, not an afterthought. Anthropic’s harness-design post gives a worked comparison: a single agent built a retro game maker in 20 minutes for $9, while the full harness — planner, generator and evaluator — took 6 hours and $200, with much higher quality. Record cost per task alongside accuracy, and decide the loop’s budget before you build it.

Common mistakes in feedback loop design

A loop with no reliable signal. The most common failure is a loop whose evaluator has nothing to check against. A model asked to review its own work from the same knowledge that produced it is grading its own homework. If the evaluator has no task-relevant, reliable signal to check against — a test, a retrieved fact, a tool result, or a human judgement — the loop adds cost and a false sense of safety. Build the verifier before the loop.

Unbounded loops. A loop without a round cap or a stopping condition will run until something external stops it — usually the budget. Every loop needs a maximum number of rounds and a rule for what happens when the cap is reached: escalate to a human, return the best draft so far with a warning, or fail loudly. Never let a loop fail silently by returning its last draft as if it passed.

Feedback the agent cannot act on. “This is wrong” is not feedback. A useful evaluation names what is wrong and what to change — a failing test name, the expected value, the missing field. Anthropic’s evaluator-optimizer pattern works because the evaluator writes specific, actionable feedback against explicit criteria; a vague critique produces a random revision. Write the criteria first, then the evaluator.

Guardrails that race the action they guard. A guardrail that runs concurrently with the agent is a check that may complete after the side effect it was meant to prevent. For any tool that changes state outside the agent, place the required authorization or validation before the tool runs, rather than relying on a concurrent check. This is a configuration detail, not a design philosophy — and it is the one to get right before the agent touches anything irreversible.

Putting ai agent feedback loops together: a worked example

Suppose an agent drafts customer replies and a self-evaluation loop reviews each draft before it is sent. The loop’s record for one iteration might look like this — a small JSON payload the system keeps for every loop turn, so the loop itself can be audited later.

{
  "task": "draft a reply to a refund request",
  "round": 1,
  "draft": "Your refund of $49.00 has been processed.",
  "evaluation": {
    "criteria": ["refund amount matches the order", "tone is apologetic, not defensive"],
    "scores": {"amount_matches_order": false, "tone": true},
    "feedback": "The order total is $59.00, not $49.00. Re-check the order before rewriting."
  },
  "decision": "revise",
  "next_action": "call get_order to fetch the correct total, then rewrite the draft"
}

The record shows why this loop works where a purely self-reviewing one would not: the feedback points at a verifiable fact — the order total — that the agent can check with a tool. That is the test for every loop you design: does the evaluator have a task-relevant, reliable signal to check against, judged against explicit criteria — a test result, a retrieved fact, a tool result, or a human judgement? And does the loop demonstrably improve the agent on a before-and-after evaluation? If the answer to either is no, the loop is decoration: spend the money on a test, a retrieval step, or a human review instead. Design the signal first, cap the rounds, measure before and after, and let the loop earn its cost on every run.