File: b3_loop_agent/agents.py
In the iterative planner example, refiner_agent uses output_key="current_plan", which unconditionally writes the agent's text output to state after every run. When the critic approves the plan, the refiner is instructed to echo the completion phrase, which gets written to current_plan, silently overwriting the last valid plan.
As a result, after a successful loop, current_plan holds "The plan is feasible and meets all constraints." rather than the actual approved plan (e.g. "Activity: Exploratorium, Restaurant: La Mar").
Suggested fix: Remove output_key from refiner_agent and replace it with a custom tool (e.g. update_plan) that writes to state only when a genuine new plan is produced. When the critique is the completion phrase, the agent skips the tool call entirely, leaving current_plan intact.
Thanks for the great examples!! Hope this helps!
Mohammad Karimi
File:
b3_loop_agent/agents.pyIn the iterative planner example,
refiner_agentusesoutput_key="current_plan", which unconditionally writes the agent's text output to state after every run. When the critic approves the plan, the refiner is instructed to echo the completion phrase, which gets written tocurrent_plan, silently overwriting the last valid plan.As a result, after a successful loop,
current_planholds"The plan is feasible and meets all constraints."rather than the actual approved plan (e.g."Activity: Exploratorium, Restaurant: La Mar").Suggested fix: Remove
output_keyfromrefiner_agentand replace it with a custom tool (e.g.update_plan) that writes to state only when a genuine new plan is produced. When the critique is the completion phrase, the agent skips the tool call entirely, leavingcurrent_planintact.Thanks for the great examples!! Hope this helps!
Mohammad Karimi