mirror of
https://github.com/langchain-ai/langgraph-reflection.git
synced 2026-07-01 16:00:21 -04:00
cr
This commit is contained in:
@@ -10,6 +10,9 @@ pip install langgraph-reflection
|
||||
|
||||
## Details
|
||||
|
||||
<div style="display: flex; align-items: flex-start; gap: 20px;">
|
||||
<div>
|
||||
|
||||
This reflection agent uses two subagents:
|
||||
- A "main" agent, which is the agent attempting to solve the users task
|
||||
- A "critique" agent, which checks the main agents work and offers any critiques
|
||||
@@ -22,7 +25,12 @@ The reflection agent has the following architecture:
|
||||
- If the critique agent finds something to critique, then the main agent is called again
|
||||
- If there is nothing to critique, then the overall reflection agent finishes
|
||||
4. Repeat until the overall reflection agent finishes
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<img src="langgraph-reflection.png" alt="Reflection Agent Architecture" width="100"/>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
We make some assumptions about the graphs:
|
||||
- The main agent should take as input a list of messages
|
||||
|
||||
+2
-1
@@ -153,6 +153,8 @@ def create_graphs():
|
||||
return create_reflection_graph(assistant_graph, judge_graph).compile()
|
||||
|
||||
|
||||
reflection_app = create_graphs()
|
||||
|
||||
if __name__ == "__main__":
|
||||
"""Run an example query through the reflection system."""
|
||||
example_query = [
|
||||
@@ -163,6 +165,5 @@ if __name__ == "__main__":
|
||||
]
|
||||
|
||||
print("Running example with reflection...")
|
||||
reflection_app = create_graphs()
|
||||
result = reflection_app.invoke({"messages": example_query})
|
||||
print("Result:", result)
|
||||
|
||||
Reference in New Issue
Block a user