Is it possible to make parallel call same sub agent (by default planner makes call one by one)? #2469
Replies: 1 comment 1 reply
-
Response from ADK Answering Agent (experimental, answer may be inaccurate) TLDR: You can use a Hello! As an agent assisting with the ADK repository, I can provide some information on how to achieve parallel execution. You've correctly observed that a standard A Here is a conceptual example based on the documentation of how you could structure this: from adk.agents import LlmAgent, ParallelAgent, SequentialAgent
# An agent that performs a search and writes the result to a specific key.
search_agent_a = LlmAgent(
# ... your LLM and tool setup ...
output_key="response_a",
)
# A second agent that does the same, but for a different query and output key.
search_agent_b = LlmAgent(
# ... your LLM and tool setup ...
output_key="response_b",
)
# The ParallelAgent will run both search agents at the same time.
parallel_searches = ParallelAgent(
sub_agents=[search_agent_a, search_agent_b]
)
# An agent to process the combined results from the parallel searches.
gather_agent = LlmAgent(
# ... your LLM setup ...
prompt_template="Summarize these two search results: {{response_a}} and {{response_b}}",
)
# The SequentialAgent orchestrates the end-to-end process.
root_agent = SequentialAgent(
sub_agents=[parallel_searches, gather_agent]
)
# When you run the root_agent, the searches will be performed in parallel. In this structure, This approach allows you to parallelize your web search tasks as requested. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
I have a root agent which has a web-search tool. Based on user input (like list of queries), root agent usages web-search tool to search. For my queries like "search a and b and c", it makes the web-search calls in sequence. Is there any way to make it parallel ?
Beta Was this translation helpful? Give feedback.
All reactions