From 94bd1bf1a068d74df0284b6172872ca7172a8a55 Mon Sep 17 00:00:00 2001 From: Agents-swarm-it Date: Mon, 19 Jan 2026 22:33:50 +0000 Subject: [PATCH 1/2] Fix: Use escalate to properly terminate loop in agent.py --- tutorial_implementation/tutorial07/essay_refiner/agent.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tutorial_implementation/tutorial07/essay_refiner/agent.py b/tutorial_implementation/tutorial07/essay_refiner/agent.py index 2688774..3e03066 100644 --- a/tutorial_implementation/tutorial07/essay_refiner/agent.py +++ b/tutorial_implementation/tutorial07/essay_refiner/agent.py @@ -10,7 +10,7 @@ def exit_loop(tool_context: ToolContext): Called by the refiner when critic approves the essay. """ print(f" [Exit Loop] Called by {tool_context.agent_name} - Essay approved!") - tool_context.actions.end_of_agent = True # Signal to stop looping + tool_context.actions.escalate = True # Signal to stop looping # Return a minimal valid content part so the backend always produces a valid LlmResponse return {"text": "Loop exited successfully. The agent has determined the task is complete."} @@ -126,4 +126,4 @@ def exit_loop(tool_context: ToolContext): ) # MUST be named root_agent for ADK -root_agent = essay_refinement_system \ No newline at end of file +root_agent = essay_refinement_system From 3251a8a0de5019a950cd781372020f6d52270709 Mon Sep 17 00:00:00 2001 From: Agents-swarm-it Date: Mon, 19 Jan 2026 22:39:12 +0000 Subject: [PATCH 2/2] Fix: Update tutorial docs to match correct termination logic --- docs/docs/07_loop_agents.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/docs/07_loop_agents.md b/docs/docs/07_loop_agents.md index 78b7fa3..bbd3bd2 100644 --- a/docs/docs/07_loop_agents.md +++ b/docs/docs/07_loop_agents.md @@ -182,7 +182,7 @@ def exit_loop(tool_context: ToolContext): Called by the refiner when critic approves the essay. """ print(f" [Exit Loop] Called by {tool_context.agent_name} - Essay approved!") - tool_context.actions.end_of_agent = True # Signal to stop looping + tool_context.actions.escalate = True # Signal to stop looping # Return a minimal valid content part so the backend always produces a valid LlmResponse return {"text": "Loop exited successfully. The agent has determined the task is complete."}