Skip to main content

03. Core Components

Feedback, Reflection and Goal Management

Goals define done. Feedback says how the last action went. Reflection turns that signal into a better plan, memory update, or escalation. Together they keep agents from thrashing blindly.

What you will learn

  • Define goals with testable done criteria
  • Name feedback sources agents actually use
  • Explain reflection as critique-and-update, not fluff
  • Wire goals, feedback, and reflection into the loop
  • Answer interview questions with short, solid answers
Goals, feedback, and reflection as three pillars of agent control
Interview staple: goals set the target; feedback scores reality; reflection updates the path.

Definition

Goal management is tracking a desired end state (and constraints) until it is verified complete, blocked, or cancelled. Feedback is any signal about outcomes โ€” tool results, tests, user ratings, critic models, or eval harnesses. Reflection is a deliberate step where the agent (or a critic component) interprets feedback and updates plan, memory, or strategy.

Without these, an agent is a tool-calling chatbot that hopes for the best.

Introduction

This lesson closes Module 03 (Core Components). You have LLMs, prompts, planning, memory, tools, and APIs โ€” feedback and goals tie them into a controllable loop.

Module 04 deepens workflow patterns like ReAct, where reflection often appears as the โ€œthoughtโ€ after an observation.

Why this trio matters

  • Stops infinite loops with no notion of progress
  • Turns failures into replans instead of blind retries
  • Makes success auditable for product and compliance
  • Feeds learning agents with critic signals over time

Goal management

A goal is not a vague wish. Encode it as state the system can check.

Goal lifecycle from define through track, verify, complete, or escalate
If done cannot be tested in code or clear criteria, the goal is not managed.
  • Define - success predicate, constraints, budget, owner
  • Decompose - subgoals with statuses (todo / doing / done / blocked)
  • Track - persist goal state across tool calls
  • Verify - run checks (tests, query, human confirm)
  • Close - complete, cancel, or escalate with a reason

Feedback sources

Prefer grounded signals over the model saying โ€œlooks good.โ€

  • Tool observations - HTTP codes, test output, query rows
  • Deterministic verifiers - linters, schema validators, policies
  • User feedback - thumbs, corrections, clarifications
  • Critic / judge models - rubric scores (use carefully)
  • Offline evals - golden tasks after prompt/tool changes
  • Telemetry - latency, cost, error rates as soft feedback

Reflection

Reflection is structured: what was attempted, what feedback said, what assumption failed, what to try next (or when to stop).

Act, feedback, reflect, update plan or memory, then act again
Reflection without an update to plan/memory/policy is just journaling.
  • Inline reflection - after each observation (ReAct-style)
  • Milestone reflection - after a subgoal attempt
  • End-of-run reflection - write episodic lessons to memory
  • Separate critic agent - review draft before side effects
  • Guard - cap reflection tokens/steps so it cannot stall forever

Wiring them together

  • Before acting - load goal state and constraints
  • After acting - score feedback against the active subgoal
  • On fail - reflect, replan subtree, or escalate
  • On success - mark done, promote facts to memory if needed
  • Always - log goal id, feedback, and reflection decision

Anti-patterns

  • Goals with no verifier (โ€œmake it betterโ€)
  • Retrying the same tool call without reflection
  • Trusting only the modelโ€™s self-praise as feedback
  • Writing every thought to long-term memory unfiltered
  • Reflection prompts that never change the plan object

Program / implementation notes

Store Goal and Subgoal records in state. Implement verify_* tools where possible. Add a reflect() step that must output a structured decision: continue / replan / escalate / finish.

  • Keep done checks in code paths the agent cannot skip
  • Separate user-visible status from internal reflection traces
  • Use budgets: max fails per subgoal before escalate
  • Eval reflection quality offline with known failure fixtures
  • Module 03 complete - next: Agentic Workflows (Module 04)

Advantages and limitations

  • Advantage: measurable completion instead of endless chat
  • Advantage: faster recovery from tool failures
  • Advantage: better learning signal for memory and evals
  • Limitation: weak verifiers allow false โ€œsuccessโ€
  • Limitation: noisy feedback causes thrashing
  • Limitation: over-reflection burns tokens without progress

Key points

  • Goals need testable done criteria and tracked status.
  • Feedback should be grounded (tools, tests, users, evals).
  • Reflection interprets feedback and updates plan/memory/policy.
  • Wire verify and escalate into the orchestrator, not only the prompt.
  • Cap retries and reflection steps.
  • Self-praise is not a verifier.

FAQs

Is reflection the same as chain-of-thought?

CoT can include reasoning traces. Reflection specifically critiques outcomes against goals and produces an update decision after feedback.

Do I need a separate critic model?

Not always. Deterministic verifiers are best when available. Critic models help for subjective quality, with human or rubric oversight.

How detailed should goals be?

Detailed enough to verify: explicit success checks, constraints, and budgets โ€” plus subgoals for multi-step work.

When should the agent escalate instead of reflecting again?

When replan caps are hit, feedback is contradictory, permissions are missing, or risk exceeds policy.

Interview questions

  1. What is goal management in an AI agent?

    Answer Defining, tracking, verifying, and closing a desired end state with constraints โ€” including subgoals and escalation when blocked.

  2. What counts as feedback for agents?

    Answer Signals about outcomes such as tool results, test/validator output, user corrections, critic scores, eval harness results, and operational metrics.

  3. What is reflection in Agentic AI?

    Answer A structured step that interprets feedback, diagnoses failures, and updates the plan, memory, or strategy โ€” or decides to stop/escalate.

  4. How do feedback and reflection differ?

    Answer Feedback is the signal; reflection is the policy that turns that signal into a change in behavior.

  5. How would you prevent infinite agent loops?

    Answer Enforce done checks, step/fail budgets, mandatory reflection after repeated failures, and escalate when caps are reached.

  6. Give a concrete goal + verifier example.

    Answer Goal: make unit tests pass for module X. Verifier: run_tests tool returns exit code 0 with no failed cases.

  7. Where does this fit a learning agent?

    Answer Feedback is the critic signal; reflection/learning updates the performance element (plan templates, memory, prompts) over time.

Related topics

Practice task

Complete each numbered practice step in a notebook or doc before opening the next lesson.

  1. Write a goal record for โ€œreduce checkout errorsโ€ with done check and constraints.
  2. List five feedback sources for that goal and rate each as hard/soft signal.
  3. Draft a reflection template: Attempted / Feedback / Diagnosis / Next decision.
  4. Set replan and escalate caps for a coding agent fixing CI.
  5. Answer interview questions 1, 3, and 5 in two sentences each.