tl  tr
  Home | Tutorials | Articles | Videos | Products | Tools | Search
Interviews | Open Source | Tag Cloud | Follow Us | Bookmark | Contact   
 Generative AI > Google Gemini API > ADK Parallel Tool Execution

ADK Parallel Tool Execution

Author: Venkata Sudhakar

By default, when an ADK agent decides to call multiple tools in a single turn, it may execute them sequentially. For tools that are independent of each other - fetching stock levels, pricing, and shipping estimates simultaneously - sequential execution adds unnecessary latency. ADK supports parallel tool execution where multiple tool calls are dispatched concurrently and their results are collected before the model generates the final response.

ShopMax India product queries often require data from three independent sources: the pricing service, the inventory system, and the shipping estimator. Running these three tools in parallel reduces the combined latency from the sum of individual call times to the time of the slowest single call - typically a 60-70% latency improvement for multi-tool queries.

The below example shows how to implement parallel tool execution in an ADK agent using asyncio and demonstrate the latency benefit for a ShopMax India product query.


It gives the following output,

Parallel fetch completed in 512ms (vs ~1200ms sequential)
{
  "price":    {"price_inr": 89999, "discount_pct": 8, "final_inr": 82799},
  "stock":    {"total_stock": 41, "cities": ["Mumbai", "Delhi", "Hyderabad"]},
  "shipping": {"standard": {"days": 3, "cost_inr": 0},
               "express":  {"days": 1, "cost_inr": 299},
               "same_day": {"days": 0, "cost_inr": 599}},
  "fetch_ms": 512
}

The below example shows integrating the parallel fetch as an ADK FunctionTool so the agent calls a single tool that internally parallelises all data fetches for ShopMax India queries.


It gives the following output,

Parallel fetch completed in 508ms (vs ~1200ms sequential)

Agent (1124ms): Samsung 55" QLED TV - ShopMax India Summary

Price: Rs 82,799 (8% off Rs 89,999)

Stock: 41 units available across Mumbai, Delhi, and Hyderabad.
Note: Not currently stocked in Bangalore - ships from nearest warehouse.

Delivery to Bangalore:
  Standard - Free - 3 business days
  Express  - Rs 299 - Next business day
  Same Day - Rs 599 - Same day (selected PIN codes)

Total with Express delivery: Rs 83,098

Parallel tool execution is one of the highest-impact latency optimisations available in ADK. For ShopMax India, replacing three sequential tool calls (1200ms) with a single parallel fetch (500ms) and model synthesis (600ms) delivers the full response in under 1200ms instead of over 1800ms - a 35% end-to-end improvement that customers notice immediately in the chat interface.


 
  


  
bl  br