Reflection Agent
Reflection Agent joins two agents to improve the quality of answers. The first one, the main agent, answers the request. The second one, the judge, reviews that answer: if it approves it, that is what the user receives; if not, the judge explains what is wrong and the main agent tries again taking the critique into account. The cycle repeats until the judge approves or the step limit is reached.
Use it when a wrong or incomplete answer is costly and you would rather the system checks itself before answering, even if it takes a little longer.
When to use it
- An assistant drafts replies to complaints and you want a judge to check they are complete and correct before they are sent.
- You generate product descriptions and want them to always follow the same style rules.
- An agent answers questions about regulations and must not give information that is not backed up.
Configuration
| Field | What it does |
|---|---|
| Agent Name | The agent’s name. It is used when you connect it as a tool of another agent. Default: ReflectionAgent. |
| Agent Description | What the agent does, in one sentence. It helps other agents decide when to use it. |
| Input | The user’s request, usually connected from a Chat Input. |
| Connection | What to connect |
|---|---|
| Agent | The Agent output of the agent that must answer, for example an Agent or a Coding Agent V2. |
| Judge Agent | The Agent output of the agent that reviews the answers, usually a Judge Agent. The judge must return a score (score) saying whether it approves the answer and a comment (comment) with the critique, which is what Judge Agent does. |
Advanced options
| Field | What it does |
|---|---|
| Max Iterations | The maximum number of steps in the answer-and-review cycle. When the limit is reached, the cycle stops and whatever was produced last is returned. Default: 10. |
| Stream | Shows the answer in the chat as it is generated. The judge’s critiques appear as reasoning, separate from the final answer. Default: off. |
Output
- Response: the final answer, the one the judge approved. Connect it to a Chat Output.
- Tool: the pair as a tool, to connect it to another agent’s Tools input.
Example
A utility company wants its replies to customer complaints to always be complete and polite.
- Add an Agent with the customer service instructions and connect its Agent output to the Agent connection.
- Add a Judge Agent with its own criterion: the reply must apologise, explain the cause and offer a concrete solution. Connect its Agent output to Judge Agent.
- Connect a Chat Input to Input and Response to a Chat Output.
If the first reply offers no solution, the judge points it out and the agent rewrites it before it reaches the customer.
Good practices
- Give the judge clear, checkable criteria. A vague criterion makes the cycle go round without improving.
- Every round of the cycle uses AI model calls: set Max Iterations to the balance between quality and cost you need.
Related components
- Judge Agent: the judge that reviews the answers.
- Agent: NappAI’s general agent.