Glossary term
Glossary term
Architecture
Agent pattern where outputs or actions are reviewed and used to improve future steps.
A strategy for improving the quality of an agentic workflow by examining (reflecting on) a step's output before passing that output to the next step.
The examiner is often the same LLM that generated the response (though it could be a different LLM). How could the same LLM that generated a response be a fair judge of its own response? The "trick" is to put the LLM in a critical (reflective) mindset. This process is analogous to a writer who uses a creative mindset to write a first draft and then switches to a critical mindset to edit it.
For example, imagine an agentic workflow whose first step is to create text for coffee mugs. The prompt for this step might be:
You are a creative. Generate humorous, original text of less than 50 characters suitable for a coffee mug.
Now imagine the following reflective prompt:
You are a coffee drinker. Would you find the preceding response humorous?
The workflow might then only pass text that receives a high reflection score to the next stage.
DeepMind's AlphaCode 2 uses a reflection loop where generated code is compiled and tested; failures are fed back as context so the model revises the solution up to 10 times before returning a final answer.
LangGraph-based document-drafting agents self-critique generated BRD sections against a quality rubric: if a section scores below threshold, the agent rewrites it before passing to the next stage.
Microsoft AutoGen's ConversableAgent implements reflection by having an inner critic agent score each generated plan step for feasibility, then routing low-confidence steps back for revision.
Created for this library
A coding assistant agent uses reflection to critique its own first draft and revise the code before returning a final version to the user.
A research assistant agent uses reflection to evaluate its own draft response against the user's question and revise where needed.
A customer support agent uses reflection to check whether its proposed reply addresses every part of the user's message before sending.
Definition source: Google for Developers Machine Learning Glossary | Creative Commons Attribution 4.0 License