Chaos Testing for Agentic AI

A standalone fault-injection toolkit that deliberately breaks your LLM calls and agent workflowsβ€”
and reports exactly what failed.

Quick Start (5 min) View on GitHub
0
Required Dependencies
7
Fault Types (v0.1-0.3)
2
Testing Layers
100%
Production Ready

Why Chaos Testing for Agents?

Agentic AI systems are brittle. Your agent works fine in the lab, but what happens when the LLM times out, a tool fails, or shared memory gets corrupted? Most teams don't know until production breaks.

🀐

Silent Failures Invisible to Monitoring

Your LLM returns garbage, but latency and tokens look normal. No alert fires. Chaos testing catches this.

⛓️

Cascade Failures in Multi-Agent Systems

One tool fails β†’ Agent A fails β†’ Agent B cascades. Without topology tracking, you miss the link.

πŸ”„

No Recovery Testing

Your retry logic might fail under rate limits. Your turn limits might not prevent infinite loops. Prove it works.

πŸ“Š

Resilience Unproven

Observability shows cost/latency. Chaos shows recovery. Together, they prove your agent is production-ready.

πŸš€

Framework-Agnostic

Works with any Python callable. LLM frameworks, agent frameworks, your custom codeβ€”no lock-in.

⚑

Zero Setup Overhead

pip install agentic-chaos. Wrap your calls. Run under chaos. No framework modifications needed.

How It Works

agentic-chaos operates in two layers: LLM calls and agent workflows.

Three-Layer Testing

πŸ”Œ

LLM Layer (v0.1)

Test individual LLM calls β€” timeouts, rate limits, silent degradation. Works against any LLM, any provider.

πŸ€–

Agent Layer (v0.2)

Test multi-agent workflows β€” tool failures, memory corruption, infinite loops. Tracks topology and cascades.

βš–οΈ

Fidelity & Handoff Layer (v0.3)

Score whether corruption actually mattered and break the edge between two agents β€” LLM-as-judge fidelity scoring plus edge-scoped handoff corruption/drop/delay.

Zero-Dependency Design

Python
from agentic_chaos.chaos import chaos_call, chaos_session

# Outside a session, this is a transparent pass-through
result = llm.complete("What is AI?")

# Inside a session, faults inject
with chaos_session(["token_timeout", "silent_degradation"]):
    try:
        result = chaos_call(llm.complete, "What is AI?", faults=["token_timeout"])
    except TokenTimeoutError:
        # Handle timeout, then retry without the fault
        result = llm.complete("What is AI?")

# That's it. No instrumentation. No framework lock-in.

Composition with Observability

Optional AgenticLens integration: merge chaos events straight into workflow reports so observability and resilience testing are one.

Python
from agenticlens import profile, step
from agentic_chaos.chaos import chaos_call, chaos_session

with chaos_session(["token_timeout"]) as session:
    with profile("Support Agent") as workflow:
        with step("Retriever"):
            chunks = chaos_call(retriever.search, query, faults=["token_timeout"])

# Merge chaos events into workflow
attach_events(session, workflow)

# agenticlens analyze workflow.json
# β†’ Shows cost/latency + chaos impact together

All Fault Types

7 fault types across LLM, agent, and handoff layers. Extensibleβ€”add your own.

⏱️ TokenTimeout LLM

Simulates a hung/slow completion. Hangs for N seconds then times out (or succeeds late).

Modes
raise, delay
CLI
token_timeout
πŸŒͺ️ RateLimitStorm LLM

Simulates a burst of 429 errors, then recovery. Tests retry logic and backoff behavior.

Stateful
Yes (counts firings)
CLI
rate_limit_storm
🀐 SilentDegradation LLM

Real latency, garbage output. Monitoring-blind failureβ€”the hardest to detect.

Detection
Very hard
CLI
silent_degradation
πŸ”§ ToolCallFailure Agent

Force a tool to failβ€”error, timeout, or return empty. Tests tool unavailability.

Modes
error, timeout, empty
CLI
tool_failure
πŸ’Ύ MemoryCorruption Agent

Corrupt shared agent stateβ€”truncate to 50%, inject garbage, or garble text.

Modes
truncate, inject, garble
CLI
memory_corruption
♻️ InfiniteLoop Agent

Force agent to loop past termination. Tests turn-limit safeguards.

Stateful
Yes (tracks turns)
CLI
infinite_loop
πŸ”— HandoffCorruption Agent

Targets the edge between two agents instead of a node β€” corrupt, drop, or delay a handoff payload in transit.

Modes
corrupt, drop, delay
CLI
handoff_corruption

Quick Start (5 minutes)

Install, wrap your calls, run under chaos.

1. Install

bash
pip install agentic-chaos

2. Wrap Your LLM Calls

Python
from agentic_chaos.chaos import chaos_call, chaos_session, TokenTimeoutError

with chaos_session(["token_timeout"]):
    try:
        result = chaos_call(
            llm.complete,
            "What is the weather?",
            faults=["token_timeout"]
        )
    except TokenTimeoutError:
        print("LLM timed outβ€”handled gracefully")

3. Run from CLI

bash
agentic-chaos chaos run my_app.py \
  --inject token_timeout,rate_limit_storm,silent_degradation \
  --save chaos_report.json

# Output:
# Chaos Events
# Step         Fault                 Outcome    Message
# ────────────────────────────────────────────────────────
# Retriever    token_timeout         errored    call hung for 2.0s then timed out
# LLMCall      silent_degradation    degraded   output silently degraded

# Saved chaos report to chaos_report.json

4. View Reports

The report is standalone JSON β€” load it, analyze it, integrate with your observability stack.

JSON
{
  "chaos_events": [
    {
      "fault_type": "token_timeout",
      "step_name": "Retriever",
      "outcome": "errored",
      "message": "call hung for 2.0s then timed out"
    }
  ]
}

Ready to Test Your Agent's Resilience?

Clone the repo, run a quickstart example, or check out the full documentation.

Roadmap

From v0.1 shipped to v1.0 (ChaosHub community registry).

v0.1
βœ“ Shipped
LLM Chaos Toolkit (3 faults, CLI, AgenticLens adapter)
v0.2
βœ“ Shipped (2026-07-13)
Agent Failure Injector (3 agent faults, topology tracking, LangGraph adapter)
v0.3
βœ“ Shipped
Fidelity Judges & Handoff Chaos (LLM-as-judge scoring, edge-scoped faults)
v0.4
🚧 Planned
Prompt/Model Drift Detector (snapshot, compare, detect silent changes)
v0.5
🚧 Planned
Streaming Faults, Provider Patching & Chaos Profiles
v0.6
🚧 Planned
Pytest Plugin & Assertions (CI/CD integration)
v0.7
🚧 Planned
Fault Cascades, Adaptive Intensity & Response Poisoning
v0.8
🚧 Planned
Chaos Workflows, Declarative Experiments & Explosion Radius
v0.9
🚧 Planned
Resilience Probes & Resilience Score (0–100 metric)
v1.0
🚧 Planned
ChaosHub (Shared Experiment Registry)

Each version is a minor bump on the same package β€” incremental PyPI releases with sustained activity.
View full roadmap β†’

How agentic-chaos Compares

What makes agentic-chaos unique in the market.

Feature ChaosEater Fault Injection FW Observability Tools agentic-chaos
Zero Dependencies βœ— βœ— βœ— βœ…
LLM Faults βœ— βœ“ βœ“ βœ… (3 types)
Agent Faults βœ— Limited Limited βœ… (3 types)
Silent Degradation Not mentioned Implicit Implicit βœ… Explicit
Topology Tracking βœ— βœ— Tracing only βœ… Graph + cascades
Framework Agnostic Kubernetes only Partially Framework-specific βœ… Any Python callable
Production Ready Research Emerging Mature βœ… Shipped v0.3