Observed since 20 Oct, 21:37 UTC
No superseded metadata states collected. Unchanged observations do not create new revisions.
Chaos Engineering & Failure Diagnosis for AI Agents
Chaos testing and failure diagnosis for AI agents.
AgentChaos is currently 0.2.0: a Python toolkit for repeatedly running agent
tests, injecting realistic failures, collecting trace-like spans, detecting common
failure modes, ingesting framework-shaped traces, and exporting reliability reports.
The v0.1 track is intentionally small: pytest integration, two injectors, two detectors, three metrics, JSON reports, and a CLI summary command. v0.2 is focused on framework-neutral adapter boundaries, runtime ingestion prototypes, trace-based semantic detectors, and release hygiene.
Implemented today:
ChaosTracer for agent, tool, and chat spansChaosRunner for repeated callable executionexecute_chaos_test() as the framework-neutral execution serviceToolTimeout, ArgSchemaMutationLoopDetector, ArgSchemaViolationDetector, ToolInvocationMismatchDetectorstep_success_rate_at_k, run_variance, recovery_rate@chaos, --chaos, --chaos-report, chaos_traceragentchaos summarize <report.json>stream/astream_events ingestion adapter with parent reconstructionNot implemented yet:
TraceSpan without importing framework SDKs.Clone the repo and install it locally:
git clone https://github.com/jeffery0929/agentchaos.git
cd agentchaos
python -m venv .venv
source .venv/bin/activate
pip install -e ".[dev]"
Run the no-API-key demo:
pytest examples/basic --chaos --chaos-report chaos_reports/basic.json -q
Summarize the report:
agentchaos summarize chaos_reports/basic.json
Expected result:
AgentChaos report: pytest_suite
tests: 1
total runs: 3
successful runs: 3
failed runs: 0
matched detections: 3
from agent_chaos import chaos
from agent_chaos.injectors import ToolTimeout
@chaos(injectors=[ToolTimeout(p=0.2)], runs=10)
def test_agent_handles_tool_timeouts(chaos_tracer):
with chaos_tracer.invoke_agent("flight-agent"):
result = my_agent.run("Book a flight from SFO to NRT")
assert result.status == "success"
Run it with:
pytest --chaos --chaos-report agentchaos-report.json
agentchaos summarize agentchaos-report.json
@chaos is lazy-loaded from the package root, so ordinary import agent_chaos does not
pull in pytest. Pytest is only needed when using the pytest plugin.
The JSON report includes:
step_success_rate_at_krun_variancerecovery_rate--chaos-include-spansProduction agent failures are often not clean assertion failures. They show up as loops, bad tool arguments, fabricated observations, retry storms, premature stops, and task drift. AgentChaos focuses on a narrow v0.1 gap:
fault injection + trace-backed failure classification + CI-friendly reports
See:
In scope:
Out of scope for v0.1:
pytest -q
ruff check agent_chaos tests examples
ruff format --check agent_chaos tests examples
mypy agent_chaos tests examples
pytest examples/basic --chaos --chaos-report chaos_reports/basic.json -q
agentchaos summarize chaos_reports/basic.json
After configuring a small API budget and adding OPENAI_API_KEY to ignored local env
files, run the manual paid smoke test:
python examples/openai_paid_dogfood/run_demo.py
agentchaos summarize chaos_reports/openai-paid-dogfood.json
The default model is gpt-5.4-nano to keep the first paid run cheap.
Apache 2.0. See LICENSE.
Download counts and popularity will appear here as the collector receives them.
| Version | Published | Direct dependencies | Open version |
|---|---|---|---|
| 0.2.0 | 3 Jun 2026 | 20 |
This describes our collected data; it is not a security assessment.
Observed since 20 Oct, 21:37 UTC
No superseded metadata states collected. Unchanged observations do not create new revisions.
package:b812c53b52053a841f26d7147d44a4031310395fa954afc914c970b6433e30c2