Chaos engineering for AI agents — Chaos Monkey, but for your agents and tools.
Project description
chaos-agents
Chaos Monkey, but for AI agents.
chaos-agents injects controlled faults — latency, errors, corrupted /
truncated / empty outputs — into your agent and tool functions, so you can find
out how your system behaves before the real world does it for you.
⚠️ Early alpha (v0.1.0). The API is small on purpose and will grow.
Install
pip install chaos-agents
Usage
from chaos_agents import ChaosMonkey
# Roll the dice on every call.
monkey = ChaosMonkey(
latency=0.3, # 30% chance of an artificial delay
errors=0.1, # 10% chance of raising ChaosError
corruption=0.1, # 10% chance of scrambling the string output
truncation=0.05, # 5% chance of truncating the output
seed=42, # reproducible chaos
)
@monkey.wrap
def my_agent(prompt: str) -> str:
return call_llm(prompt)
my_agent("summarize this document")
print(monkey.report()) # {'latency': 1, 'errors': 0, ...}
You can also wrap inline:
result = monkey.run(call_llm, prompt)
Disable chaos in production without touching call sites:
monkey = ChaosMonkey(errors=0.1, enabled=False)
Built-in faults
| Fault | What it simulates |
|---|---|
latency |
slow / hanging agents and tools |
errors |
crashes and tool failures (raises ChaosError) |
corruption |
hallucinated / garbled responses |
truncation |
token-limit cutoffs and interrupted streams |
empty |
silent / dropped responses |
License
MIT
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file chaos_agents-0.1.0.tar.gz.
File metadata
- Download URL: chaos_agents-0.1.0.tar.gz
- Upload date:
- Size: 5.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.8
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
787b24cfda6086549d63ca05c65e03e90883183b60c97358cd68b587facb4324
|
|
| MD5 |
4417d9e63f9929c24fd4be7c1d6a0341
|
|
| BLAKE2b-256 |
007657902c03a975f49bfced4809418ee02df34404a0fc1ba1110284861a504d
|
File details
Details for the file chaos_agents-0.1.0-py3-none-any.whl.
File metadata
- Download URL: chaos_agents-0.1.0-py3-none-any.whl
- Upload date:
- Size: 6.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.8
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
41dedc8e87413e693792822546640661754f226b3676849d197a635f2ed4931c
|
|
| MD5 |
4cce14ea3389e176815a72f6ee1ccb45
|
|
| BLAKE2b-256 |
c343092c2c98162ce6ee3a9f604be8d318f6f95092233e82e18878df4c24e5f8
|