feat: add chaos testing module for fault injection#224
Conversation
0e06f09 to
28a0679
Compare
Review SummaryAssessment: Request Changes This PR introduces a well-structured chaos testing module with clean separation between effects, scenarios, plugin, and experiment orchestration. The ContextVar-based design for concurrency safety and the composition with the existing Review Categories
The overall design is thoughtful and the test coverage is good. Addressing the |
Review Summary (Follow-up)Assessment: Comment All feedback from the previous review has been thoroughly addressed — Remaining Items
These are straightforward fixes. Once addressed, this looks good to merge. |
2b51586 to
bb023d6
Compare
Description
Introduces a chaos testing module for fault injection during agent evaluation. Enables systematic testing of agent resilience under tool failures and response corruption without modifying agent code.
Key capabilities:
ToolCallFailure,TruncateFields,RemoveFields,CorruptValuesCasewith aneffectsfield that carries the failure injection config. ProvidesChaosCase.expand(cases, effect_maps)to generate the Cartesian product of base cases × named effect maps (adict[str, dict[str, list[ChaosEffect]]]where keys are short human-readable condition names)ChaosPluginhooks into Strands' nativeBeforeToolCallEvent/AfterToolCallEventsystem; reads the activeChaosCasefrom a ContextVar (zero chaos concepts in user task code)ChaosExperimentcomposes the baseExperimentto runChaosCaseobjects, managing ContextVar lifecycle per case for thread/async safetyDesign principles:
plugins=[chaos]to the agentChaosCaseextendsCase(not modifies it) — stable extension point for future chaos-specific fields without breaking the base frameworkChaosScenarioclass — simpler API surface with readable case names in reports (e.g.,book_a_flight|search_timeout)Case,Evaluator,EvaluationReport)Related Issues
#114
Documentation PR
strands-agents/docs#836
Type of Change
New feature
Testing
How have you tested the change? Verify that the changes do not break functionality or introduce warnings in consuming repositories: agents-docs, agents-tools, agents-cli
hatch run prepareChecklist
By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.