Skip to content
Discussion options

You must be logged in to vote

Response from ADK Answering Agent (experimental, answer may be inaccurate)

TLDR: To control the number of iterations in a LoopAgent, use the max_iterations parameter, not max_turns. This setting controls the loop count for the LoopAgent itself and does not propagate to its sub-agents.


Hello! Thanks for your question.

To cap the number of iterations for a LoopAgent, you should set the max_iterations parameter in its constructor. The max_turns parameter is not used for this purpose. The loop will stop when the number of iterations reaches max_iterations or if a sub-agent returns an event with escalate=True.

Here is an example of how to configure it:

from google.adk.agents import LoopAgent

#…

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by NGC2336
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants