You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
# It's a comfortable and warm day. You can choose light and breathable clothes. For example, a short - sleeved T - shirt or a thin shirt paired with casual pants or a skirt would be great. Since it's sunny, don't forget to wear a hat and sunglasses to protect yourself from the sun. Also, you can carry a light jacket in case the temperature drops in the evening, but it might not be necessary. Enjoy your day in Beijing!
from google.adk.tools.tool_context import ToolContext
172
+
173
+
defexit_loop(tool_context: ToolContext):
174
+
print(f" [Tool Call] exit_loop triggered by {tool_context.agent_name}")
175
+
tool_context.actions.escalate =True
176
+
return {}
177
+
178
+
planner_agent = Agent(
179
+
name="planner_agent",
180
+
description="Decomposes a complex task into smaller actionable steps.",
181
+
instruction=(
182
+
"Given the user's goal and current progress, decide the NEXT step to take. You don't need to execute the step, just describe it clearly. "
183
+
"If all steps are done, respond with 'TASK COMPLETE'."
184
+
),
185
+
)
216
186
187
+
executor_agent = Agent(
188
+
name="executor_agent",
189
+
description="Executes a given step and returns the result.",
190
+
instruction="Execute the provided step and describe what was done or what result was obtained. If you received 'TASK COMPLETE', you must call the 'exit_loop' function. Do not output any text.",
191
+
tools=[exit_loop],
192
+
)
193
+
194
+
root_agent = LoopAgent(
195
+
sub_agents=[planner_agent, executor_agent],
196
+
max_iterations=3, # Limit the number of loops to prevent infinite loops
0 commit comments