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 Feature Flags and Progressive Rollout

Testing ADK Agents with Feature Flags and Progressive Rollout

Author: Venkata Sudhakar

Feature flag testing for ADK agents verifies that agents activate new behavior only when the corresponding flag is enabled, and fall back to the previous behavior when it is disabled. ShopMax India uses feature flags to progressively roll out updated recommendation logic to 10% of Mumbai customers first, then expand to Delhi and Bangalore after validating quality metrics - agents must be tested for both flag states before any rollout begins.

A FeatureFlagService resolves flag state (enabled/disabled) for a given user or session. The agent tool checks the flag and branches accordingly. Tests cover four scenarios: flag enabled returns new behavior, flag disabled returns old behavior, flag rollout percentage routes correctly (10% enabled, 90% disabled), and flag override for specific users works as expected. Using a fake flag service in tests avoids any dependency on a real flag platform like LaunchDarkly or GrowthBook.

The example below defines a FakeFeatureFlagService, tests the agent tool under enabled and disabled flag states, and verifies that a 10% rollout routes approximately the right fraction of users to the new behavior.


It gives the following output,

Flag ON: algo=v2, items=['Samsung QLED', 'LG OLED']
Flag OFF: algo=v1
Rollout: 22/200 users enabled (11.0%)
3 passed in 0.05s

Always test both the enabled and disabled states in the same test run to prevent flag state from leaking between tests. Use deterministic hash-based rollout (as shown above) rather than random sampling so that the same user always gets the same experience and tests are reproducible. Add a flag cleanup fixture in conftest.py that resets all flags to disabled after each test module so that flag state does not bleed across test files in the CI run.


 
  


  
bl  br