Agentic Chaos
Start here
How does the application behave when a dependency fails?
What it does
Fault injection, experiment reports and resilience evidence, grouped by area below. Each area links to its detailed guide. For runnable commands, see the developer guide.
1. LLM-call faults
- Token timeout
- Hangs for
hang_seconds, then raisesTokenTimeoutError mode="delay"lets the real call finish late instead
- Hangs for
- Rate-limit storm
- Fails the first
burst_countcalls with aretry_afterhint, then clears
- Fails the first
- Silent degradation
- Corrupts a successful response's text while latency and token counts stay unchanged
- Custom corruption with
degrade_fn=
- Streaming faults
- Cut a stream, hang it, delay the first token or slow every chunk
- Sync and async streams (
chaos_stream(),chaos_astream())
- Provider errors
- Authentication errors and context-length overflows, shaped like SDK errors
- Async calls
chaos_acall()with cancellation-aware execution
Guides: Features · Streaming and async · Configuration
2. Agent faults and topology
- Agent faults
- Tool-call failure: error, timeout or empty result, for one tool or all
- Memory corruption: truncate, inject garbage, garble or decay across turns
- Infinite loop: forced "continue" signals to test turn limits
- Handoff corruption: corrupt, drop or delay a payload between two agents
- Instrumentation
wrap_tool()andwrap_node()for framework-neutral callablesTopologyTrackerrecords agent and tool nodes and edges
- LangGraph
- The same wrappers work on LangGraph tools and graph nodes, with no LangGraph dependency
Guides: Features · LangGraph adapter · Integrations
3. Advanced chaos
- Fault cascades
- Chain one fault after another with
cascade(first=..., then=..., delay_between=...)
- Chain one fault after another with
- Breaking-point search
find_breaking_point()increases fault intensity to find where recovery stops
- Response poisoning
- Confident wrong answers, fabricated references, malformed formats, prompt-injection and policy-bypass text (synthetic, never executed)
- Cost estimates
agentic-chaos estimatemodels retry costs from prices you supply, without running your app
Guides: v0.7 advanced chaos
4. Provider patching and profiles
- Provider patches
patch_openai(),patch_anthropic()andpatch_google()inject faults into one real client instance- Sync, async and streaming SDK calls; originals restored when the session ends
- Profiles
- Named TOML profiles (
chaos.toml) for reusable fault sets - Seeded probability sampling for repeatable runs
- Named TOML profiles (
Guides: v0.5 guide · Configuration
5. Explosion radius
- Scope
- Limit faults to chosen steps or providers with
Scope(...) - Exclusions always win; checked before probability sampling
- Works on every fault, cascade, workflow step and workflow
- Limit faults to chosen steps or providers with
Guides: Scope
6. Safety rails
- Circuit breaker
- Limits on recorded cost, failure rate, duration and number of injections
- Aborts the session and blocks later instrumented calls
- Dry runs
- Preview which faults would fire (target calls still run and can still cost money)
- Cost recording
record_cost()andrecord_usage()with prices you supply; prices are never guessed
Guides: Safety rails
7. Fidelity judges
- Scoring
- A 0–1 score for whether a corrupted output actually got worse
- Judges
HeuristicJudgewith no dependencies- Adapters for DeepEval and Pydantic Evals evaluators you construct
Guides: Fidelity judges
8. Contracts and pytest
- Built-in contracts
- Completes within a time limit, no unhandled error, maximum retries, recovered after failure, maximum cost impact, no retry storm, full topology traversal
- Missing evidence is inconclusive and never passes
- Gates
--contracton a CLI run exits 1 unless every contract passescontracts checkre-checks saved reports- Custom contracts by subclassing
Contract
- Pytest plugin
@pytest.mark.chaosmarkers, activated withpytest --chaoschaosfixture, baseline runs and saved reports per test
Guides: v0.6 contracts and pytest
9. Resilience probes and score
- Probes
- HTTP, function, response-quality and latency checks
- Run before, during and after the chaos; a failing "before" probe stops injection
- Resilience score
- A 0–100 score from recovery, probe results, latency and cost evidence
- Inconclusive when evidence is missing, never invented
- CI and history
--min-scoregate- Trend history with retention (
score show,score history,score prune)
Guides: v0.9 probes and resilience score
10. Workflows and experiments
- Chaos workflows
- Multi-stage campaigns from
Step,HealthCheck,Parallel,SuspendandTemplatestages - Human approval gates that can be resumed (
--approve,--resume-from)
- Multi-stage campaigns from
- Declarative experiments
- JSON, TOML or YAML documents, linted with
experiment validatewithout running targets
- JSON, TOML or YAML documents, linted with
- Scheduling
- Previews upcoming runs and prints crontab or GitHub Actions snippets
- Topology fuzzing
agent fuzzplaces seeded faults across the agent graph, weighted by fan-out- Unreached trials are reported, not counted as passes
Guides: v0.8 workflows
11. Drift detection
- Snapshots
- Baseline of prompt, model, model fingerprint, output and retrieval results
- Comparison
drift compareflags changes and exits 2 when drift is found- Alert cooldowns and emit-on-change controls
Guides: Drift detector · Drift report format
12. Containment assertions
- Stop and revoke checks
- Verify that nothing was dispatched after an effective stop or revocation
- In-flight completions and denied attempts handled explicitly
- Authenticated evidence
- Requires a verified, authenticated observation snapshot from AgenticLens
- Failed, unknown or incomplete evidence cannot pass
Guides: MCP Phase 6 containment · API reference
13. ChaosHub and plugins
- Recipes
- Six bundled scenarios: API cascade storm, multi-agent coordinator down, RAG context poisoning, RAG retriever failure, ReAct loop resilience, support escalation failure
hub list,hub searchandhub pull
- Exchange
- Opt-in remote recipes pinned to a full commit SHA; downloading never runs code
- Fault plugins
- Custom faults through the
agentic_chaos.pluginsentry point, loaded only when you ask
- Custom faults through the
Guides: ChaosHub
14. Reports and ecosystem interoperability
- Reports
- A
ChaosEventfor every fault and a standalone JSONChaosReport - Workflow, contract, score, fuzz and drift reports
- A
- AIOS export
--save-aiosandto_aios_run()export a draft AIOS Run
- Ecosystem
- Lens: merge chaos events into AgenticLens runs and verify containment evidence
- Evals: owns independent output scoring and release gates
- Control Tower: consumes attributed Chaos evidence
- MCP: the separate MCP package exposes Chaos workflows as tools
Guides: Output formats · Integrations · Coordinated readiness
What you need
A Python callable wrapped with chaos_call(), wrap_tool() or wrap_node(), or an experiment target, plus a fault configuration.
Start here
Inject a timeout into a local dummy search call: follow the quickstart.
Limits
- Injecting a fault does not prove recovery. Define recovery assertions, probes or contracts.
- Faults are simulated at the Python call boundary. Real network, TLS or provider-side behavior is not reproduced.
- Only wrapped call sites are affected; unwrapped calls are never faulted.
- The resilience score summarizes evidence in the report; it is not a guarantee.
- Not a load-testing tool.
See Limitations.
Documentation
- Developer Guide (simple): short task workflows and a capability index
- API Reference (detailed): exact Python functions, parameters and return values
- AI Readable Documentation: the full reference as one file for AI tools, with source declarations