|
|
Testing ADK Agents in Multi-Region Deployments
Author: Venkata Sudhakar
Multi-region deployments of ADK agents require tests that verify the agent behaves consistently regardless of which cloud region handles the request. ShopMax India deploys agents in Mumbai (asia-south1) and Hyderabad (asia-south2) to meet data residency requirements and reduce latency for customers placing orders across India.
Region-aware tests inject a region tag into session state or tool context and assert that the agent routes data correctly - for example, storing PII in the correct regional bucket and calling the right regional API endpoint. The test parameterization uses pytest.mark.parametrize to run the same assertions against each region config without duplicating code.
The example below parameterizes a test across two regions, injects a mock regional endpoint resolver, and asserts that the agent tool call goes to the correct URL for each region.
It gives the following output,
Region asia-south1: endpoint https://api-mumbai.shopmax.in OK
Region asia-south2: endpoint https://api-hyderabad.shopmax.in OK
2 passed in 0.11s
In production, inject the region via an environment variable or Cloud Run service metadata so that agents do not need region-specific code paths. In tests, always parametrize across all supported regions rather than testing only the primary region - latency and data-path bugs are often region-specific and only surface under regional load.
|
|