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 Cloud Storage Data Connector

Testing ADK Agents with Cloud Storage Data Connector

Author: Venkata Sudhakar

ShopMax India's ADK agents read product catalogs, warranty PDFs, and return policy documents from Google Cloud Storage to answer customer queries. Testing agents that access Cloud Storage requires mocking the GCS client so tests run offline without credentials, while verifying that the agent reads from the correct bucket and object path, handles missing files gracefully, and correctly parses the retrieved content before using it in a response.

Inject a fake GCS client into the agent tool that stores objects in a dict keyed by bucket/object path. The fake supports get (returns bytes), upload (stores bytes), and exists (checks presence). Assert that the agent requests the expected path, uses the file content in its response, and returns a clear error when the object does not exist. This covers the most common failure modes: wrong path, missing file, and corrupt content.

The example below mocks the GCS client for ShopMax India's warranty lookup agent. Tests verify correct path construction, content usage in the response, missing file handling, and upload of a generated certificate.


It gives the following output,

.... (4 passed in 0.01s)

In production, ShopMax India should use IAM conditions to restrict agent access to specific GCS buckets and object prefixes, preventing the agent from inadvertently reading or overwriting files outside its intended scope. Enable object versioning on the warranties bucket so accidental overwrites can be recovered. Set signed URL expiry to 15 minutes for any warranty or certificate URLs sent to customers, and validate the order ID format before constructing GCS paths to prevent path traversal attempts.


 
  


  
bl  br