How the reflection agent architecture works
mainThe reflection agent uses a two-agent loop to iteratively improve outputs. It consists of a main agent (the solver) and a critique agent (the evaluator).
The Workflow:
- The main agent is called to solve the user's task.
- The critique agent is called to evaluate the main agent's work.
- Decision Logic:
- If the critique agent finds issues, it returns a user message containing the critique. This triggers the main agent to run again to address the feedback.
- If there is nothing to critique, the reflection agent finishes.
- This loop repeats until the critique agent finds no further issues.
Requirements for your graphs:
- The main agent must accept a list of messages as input.
- The critique agent (the judge) must return a user message if critiques exist, otherwise it should return no messages (or
None) to signal completion.