agentchaos-tools
Chaos testing for agentic AI — fault injection hooks for openai-agents-python.
Simulate tool failures, latency, and corrupted outputs to verify your agent handles real-world conditions gracefully.
Install
pip install agentchaos-tools
Usage
from agents import Agent, Runner, function_tool
from agentchaos import FaultInjectionHooks, ToolFault, FaultType
@function_tool
def web_search(query: str) -> str:
return f"Results for {query}"
agent = Agent(name="assistant", tools=[web_search])
hooks = FaultInjectionHooks(
faults=[
ToolFault(tool_name="web_search", fault_type=FaultType.EXCEPTION, rate=0.5),
ToolFault(tool_name="calculator", fault_type=FaultType.LATENCY, latency_seconds=2.0),
],
seed=42, # optional: reproducible fault patterns
)
result = await Runner.run(agent, "Search for something", hooks=hooks)
hooks.report()
# agentchaos-tools report — 1 fault(s) triggered:
# 1. [EXCEPTION] tool='web_search'
Fault types
| Type | What it does |
|---|---|
EXCEPTION |
Raises RuntimeError before the tool runs |
LATENCY |
Injects asyncio.sleep delay before the tool runs |
CORRUPTION |
Records that output was corrupted (visible in report) |
Parameters
| Parameter | Type | Default | Description |
|---|---|---|---|
tool_name |
str |
required | Name of the tool to target |
fault_type |
FaultType |
required | Type of fault to inject |
rate |
float |
1.0 |
Probability (0.0–1.0) that the fault fires |
latency_seconds |
float |
1.0 |
Delay in seconds (LATENCY only) |
seed |
int |
None |
Random seed for reproducible tests |
License
MIT
Metadata
Release files for agentchaos-tools 0.1.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| agentchaos_tools-0.1.1.tar.gz | 3.3 kB | Without provenance | Details for agentchaos_tools-0.1.1.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| agentchaos_tools-0.1.1-py3-none-any.whl | Python 3 | none | any | Details for agentchaos_tools-0.1.1-py3-none-any.whl |
Total release size: 7.1 kB
Release files / agentchaos_tools-0.1.1.tar.gz
| Download URL | agentchaos_tools-0.1.1.tar.gz |
|---|---|
| Size | 3.3 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
50168c99e1fc90990387952888a76f44e7fdc352eee62399e0dac44bfafe69b4
|
|
BLAKE2b-256 checksum How to use checksums |
7b8de56186a6133c597d641315e106949c7606e5e17f138c05d3344e28fcf2ea
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.11.9
|
Release files / agentchaos_tools-0.1.1-py3-none-any.whl
| Download URL | agentchaos_tools-0.1.1-py3-none-any.whl |
|---|---|
| Size | 3.8 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
6175c5e9fe81c71ff03ca83b501657d298e99c03c1abe3c17bbe6d69a16cf9b1
|
|
BLAKE2b-256 checksum How to use checksums |
0e6acbbf73fab9a169ae20979cfb27b4341014b94c8f94f2e6b050e615e3258f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.11.9
|
Security for agentchaos-tools 0.1.1
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.