Skip to content
Conduit

mcp server

agent-chaos

Fault injection toolkit for agent systems. Inject latency spikes, partial failures, 429s, malformed tool outputs, and stale context between agents and their tools. Scenario-driven. Prove your circuit

reaatech/agent-chaoscommunitylistedunreviewed

Set up

Runs on your computer. Pick your agent and operating system.

This project does not publish an install method we can turn into a config. Follow the README instead.

README

synced Oct 21, 2026

Overview

Agent Chaos is a middleware-based fault injection system that sits between your agent and its tools/providers, injecting realistic failure scenarios to validate resilience patterns like circuit breakers, confidence gates, and fallback trees.

You've built circuit breakers, confidence gates, and fallback trees — Agent Chaos proves those patterns hold under real-world conditions.

Why Agent Chaos?

  • Nothing like this exists publicly. There's chaos engineering for microservices (Chaos Monkey, Litmus), but nothing purpose-built for agent tool-use reliability.
  • Framework agnostic. Works with LangChain, LlamaIndex, Vercel AI SDK, or any custom agent implementation.
  • Pluggable architecture. Extensible injectors let you model exactly the failure modes your system faces.

Features

CategoryCapability
8 Fault Injection TypesLatency, timeouts, rate limits, malformed output, token exhaustion, and more
Scenario-DrivenDeclarative YAML/JSON configuration with probability-based fault selection
Middleware ArchitectureTransparent interceptor pattern — no changes to your agent code
Targeted InjectionApply faults to specific tools, providers, or globally with glob-based selectors
Temporal PatternsSchedule chaos during specific time windows
Cascading FailuresDefine chains of failures across multiple tools
Hot ReloadingUpdate scenarios at runtime without restarting
Observability Built-InStructured logging, metrics collection, and OpenTelemetry tracing
CI/CD ReadyCLI-first design with JSON, JUnit XML, and HTML report outputs
TypeScript FirstFull type safety with strict mode and comprehensive type definitions

Fault Injection Types

FaultDescriptionTests
Latency SpikesInject random delays in tool responsesTimeout handling, UX degradation
TimeoutsSimulate complete provider unavailabilityCircuit breaker activation
Rate LimitsReturn 429 responses with retry headersRetry logic, backoff strategies
Malformed OutputReturn invalid/unexpected JSONInput validation, error recovery
Token Limit ExceededSimulate context window exhaustionToken management, summarization fallbacks
Stale ContextReturn outdated/cached responsesCache invalidation, freshness checks
Contradictory ResultsReturn conflicting information across toolsConflict resolution, confidence scoring
Partial FailuresSelectively fail some tools while others workGraceful degradation, fallback tree validation

Quick Start

CLI

# Install globally
npm install -g @reaatech/agent-chaos-cli

# Initialize a new project
agent-chaos init

# Generate a scenario template
agent-chaos generate network-degradation --output ./scenarios

# Validate your scenario
agent-chaos validate ./scenarios/network-degradation.yaml

# Run the scenario
agent-chaos run ./scenarios/network-degradation.yaml

Programmatic API

import { createChaosEngine } from '@reaatech/agent-chaos-core';

const engine = createChaosEngine({ mode: 'inject' });

engine.loadScenario({
  name: 'network-degradation',
  targets: [
    {
      selector: 'api.*',
      faults: [
        {
          type: 'latency',
          config: { minDelay: 100, maxDelay: 500 },
          probability: 0.3,
        },
      ],
    },
  ],
});

const response = await engine.intercept({
  id: '1',
  name: 'api.search',
  arguments: { query: 'hello' },
  timestamp: Date.now(),
});

Scenario File Example

# scenarios/network-degradation.yaml
name: Network Degradation
description: Simulates network-level failures across tool calls

defaults:
  probability: 0.1

targets:
  - selector: '*'
    faults:
      - type: latency
        config:
          minDelay: 100
          maxDelay: 30000
          distribution: exponential
        probability: 0.15

      - type: timeout
        config:
          timeout: 5000
        probability: 0.05

      - type: rateLimit
        config:
          retryAfter: 60
          includeHeaders: true
        probability: 0.05

overrides:
  - selector: 'webSearch'
    faults:
      - type: malformedOutput
        config:
          patterns: [truncated, invalidJson, missingFields]
        probability: 0.1

Packages

PackageDescriptionStatus
@reaatech/agent-chaos-coreFault injection engine, middleware, and injectorsPublished
@reaatech/agent-chaos-scenariosScenario loader, validator, and templatesPublished
@reaatech/agent-chaos-cliCommand-line interfacePublished
@reaatech/agent-chaos-adaptersLangChain, LlamaIndex, and Vercel AI SDK adaptersPlanned (v0.2)
@reaatech/agent-chaos-observabilityMetrics, structured logging, and OpenTelemetryPlanned (v0.2)

Architecture

┌──────────────────────────────────────────────────┐
│                   Agent System                    │
│  ┌──────────┐  ┌──────────┐  ┌──────────────┐   │
│  │ LangChain │  │LlamaIndex│  │  Custom Agent │   │
│  └─────┬─────┘  └─────┬────┘  └───────┬──────┘   │
│        └──────────────┼───────────────┘           │
│                       ▼                           │
│            ┌─────────────────────┐                │
│            │   Agent Chaos       │                │
│            │   Middleware Layer  │                │
│            └─────────┬───────────┘                │
│                      ▼                            │
│            ┌─────────────────────┐                │
│            │   Chaos Engine      │                │
│            │   • Scenario Loader │                │
│            │   • Fault Selector  │                │
│            │   • Injector Chain  │                │
│            └─────────┬───────────┘                │
│                      ▼                            │
│            ┌─────────────────────┐                │
│            │   Injectors         │                │
│            │   Latency│Timeout   │                │
│            │   RateLimit│Token   │                │
│            │   Stale│Malformed   │                │
│            └─────────┬───────────┘                │
└──────────────────────┼────────────────────────────┘
                       ▼
              Tools & API Providers

Documentation

DocumentDescription
Development PlanFull product roadmap and architecture
Agent SkillsAI agent skills for project development
Contributing GuidelinesHow to contribute to the project
Code of ConductCommunity standards
Security PolicyVulnerability reporting
ExamplesUsage examples and integrations

Development

Prerequisites

  • Node.js >= 20.0.0
  • pnpm >= 9.0.0

Setup

git clone https://github.com/reaatech/agent-chaos.git
cd agent-chaos
pnpm install
pnpm build

Commands

CommandDescription
pnpm buildBuild all packages
pnpm testRun the full test suite
pnpm lintLint all packages
pnpm type-checkRun TypeScript type checking
pnpm formatFormat code with Prettier
pnpm checkRun lint, type-check, and tests

Technology Stack

CategoryTechnology
RuntimeNode.js 20+ LTS
LanguageTypeScript 5.3+ (strict)
Package Managerpnpm 9+
MonorepoTurborepo
Buildtsup
TestingVitest
LintingESLint + Prettier
CI/CDGitHub Actions
Commit ConventionConventional Commits

Contributing

Contributions are welcome! Please see CONTRIBUTING.md for guidelines on reporting bugs, suggesting features, and submitting pull requests.

This project follows the Contributor Covenant code of conduct.


License

MIT © 2026 Rick Somers

↑↓ navigate openesc close