tl  tr
  Home | Tutorials | Articles | Videos | Products | Tools | Search
Interviews | Open Source | Tag Cloud | Follow Us | Bookmark | Contact   
 Agentic AI > ADK Agent Testing > Testing ADK Agents with Google Search Built-in Tool

Testing ADK Agents with Google Search Built-in Tool

Author: Venkata Sudhakar

ShopMax India's ADK-powered assistant uses the Google Search built-in tool to answer real-time queries: checking current smartphone prices, verifying product availability, or looking up courier tracking numbers. Testing agents that use the Google Search tool requires isolating the search layer so tests do not make live network calls, while still verifying that the agent correctly invokes the search, uses the result, and formats the response for the customer.

When testing ADK agents with the Google Search tool, replace the real search function with a deterministic mock that returns a fixed result for a known query. Assert that the agent called the search with the expected query, that it used the search result in its response, and that it gracefully handles empty or error results. This pattern keeps tests fast, reliable, and free from API costs.

The example below mocks the Google Search tool for a ShopMax India price-check agent. The mock returns a fixed result for a Samsung Galaxy query. Tests verify the agent calls search with the right query, uses the price in its response, and handles a no-results case without crashing.


It gives the following output,

... (3 passed in 0.01s)

In production, ShopMax India should cache Google Search results for common product queries to reduce API costs and latency. Set a maximum result count and a character limit on snippets to avoid bloating the LLM context window. Run a weekly integration test against the live Google Search API with a fixed known query to detect quota or schema changes before they reach customers.


 
  


  
bl  br