|
|
Concurrent Session Isolation Testing for ADK Agents
Author: Venkata Sudhakar
ShopMax India's ADK-powered customer support handles thousands of concurrent sessions - customers in Mumbai, Delhi, and Bangalore tracking orders simultaneously. Concurrent session isolation testing verifies that each agent session maintains its own independent state, preventing cross-contamination where one customer's order details bleed into another's response.
In ADK, each session should encapsulate its own context: customer ID, order ID, city, and conversation history. Tests run multiple sessions in parallel using asyncio.gather() and assert that every response contains only that session's data. Cross-contamination checks confirm that no other session's order IDs appear in a given response. Sequential call tests verify that state does not persist between back-to-back calls.
ShopMax India's test suite below spawns five concurrent sessions for customers from Mumbai, Delhi, Bangalore, Chennai, and Hyderabad. Each session tracks a unique order. The isolation test confirms correct order and city in every response and rejects bleed-over from peer sessions. A sequential test then verifies state resets cleanly between calls.
It gives the following output,
.. (2 passed in 0.03s)
In production, ShopMax India should enforce session boundaries at the ADK runner level - never sharing agent instances across concurrent requests. Use unique session IDs per HTTP request and validate in integration tests that no global mutable state exists. Monitor for cross-session data leaks using distributed tracing with unique trace IDs per customer. Load test with 500+ concurrent sessions before peak sale events like Diwali or Republic Day to catch race conditions that only surface under load.
|
|