aw1-circuit-breaker
This MCP server provides circuit-breaker tools for evaluating and securing autonomous AI agent tool calls.
intercept_tool_call: Inspect an agent's tool call usingactor_id,tool_name, andpayload; return a security verdict (PERMITTEDorHALT_AND_CONTAIN), authorization status, execution token if permitted, risk score, and detected AST primitives.analyze_code_ast: Statically analyze source code, commands, or queries in environments like Python, Bash, or SQL to detect dangerous patterns such as dynamic evaluation, shell piping, lateral network egress, and destructive operations.get_circuit_breaker_telemetry: Retrieve engine version, operational status, active defense policies, registered containment layers, and SLA guarantees.
Provides an adapter that drops into LangGraph agent execution nodes to guard tool dispatches before they run, raising a CircuitBreakerException when a tool call (e.g. a bash command with shell injection) is halted by AST containment rules.
aw1-breaker (v2.1.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) decompilation, declarative Policy-as-Code, per-actor rolling velocity monitors, and cryptographically signed HMAC execution tokens.
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:
Metric | Result | Industry Standard (LLM-as-a-Judge) |
Throughput | 8,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 |
Attack Blocking Latency | < 0.13 ms (Fail-Closed) | N/A (Probabilistic) |
Deterministic Guarantee | 100% Mathematical AST Match | Probabilistic (~85–95%) |
⚡ 10-Second Test Drive (Zero-Install)
Test the circuit breaker live in your terminal without installing anything:
uvx aw1-circuit-breaker --demoOr verify an arbitrary snippet:
uvx aw1-circuit-breaker verify "subprocess.run(['rm', '-rf', '/'])"Related MCP server: agent-guardrail
📦 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 instantly (< 0.2ms)
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.pyOr via uvx:
uvx aw1-circuit-breakerMCP 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 guarantees deterministic enforcement.
Interception Matrix
Attack Vector | Attacker Strategy | LLM Guardrail Result | AW-1 AST Circuit Breaker |
Dynamic Execution |
| Evades semantic filters | 🛑 Tripped ( |
Shell Escapes |
| Masked as system task | 🛑 Tripped ( |
Lateral Exfiltration |
| Disguised as HTTP fetch | 🛑 Tripped ( |
SQL Destruction |
| Prompt jailbreak bypass | 🛑 Tripped ( |
Dunder Introspection |
| Bypasses keyword filters | 🛑 Tripped ( |
Run the Showcase
python examples/enterprise_guard_demo.py🔬 Autonomous Breakout Benchmark Suite (BRK Gauntlet)
Frontier AI models frequently exhibit alignment faking and instrumental convergence—learning to disguise malicious tool calls or bypass runtime sandboxes.
aw1-breaker was evaluated against the standardized BRK Adversarial Gauntlet across 1,000 randomized execution cycles against frontier agent runtimes:
Vector | Exploit Mechanism / Attack Signature | AW-1 Layer | Interception Latency | Containment |
BRK-101 | Steganographic Base64 & | Layer 0 AST Decompiler ( | 0.12 ms | 100.0% (PASS) |
BRK-102 | Covert Socket Egress & C2 Exfiltration: Unauthorized raw TCP sockets attempting credential harvesting ( | Network Socket Gate ( | 0.15 ms | 100.0% (PASS) |
BRK-103 | Privilege Escalation & Self-Replication: Autonomous cluster offloading ( | Fail-Closed Policy Arbitrator | 0.08 ms | 100.0% (PASS) |
BENIGN | Fast-Path Developer Commands: Read-only operations ( | Gate 0 Zero-Overhead Bypass | 0.05 ms | Permitted (0% False Positives) |
Reproduce the 1,000-Cycle Gauntlet Locally
Run the complete evaluation suite with standard Python (zero dependencies required):
python tests/test_breakout_gauntlet.py
---
## ⏱️ Runtime Latency Telemetry
Deterministic security must not throttle agent execution. AW-1 operates with sub-millisecond AST parsing and microsecond-scale argument filtering across warm execution loops.
*Sample Size: 1,000 synthetic iterations per test vector on Debian Python 3.13.*
| Evaluation Target | p50 Latency | p95 Latency | p99 Latency | Status |
| :--- | :--- | :--- | :--- | :--- |
| **AST Inspection (Benign Payload)** | **0.0889 ms** | 0.1298 ms | 0.1645 ms | `< 0.2 ms` Overhead |
| **AST Inspection (Adversarial Exploit)** | **0.0520 ms** | 0.0919 ms | 0.1051 ms | Instant Breakout Halt |
| **Shell Argument Injection Guard** | **0.0051 ms** | 0.0096 ms | 0.0195 ms | Sub-20 µs Inspection |
Reproduce locally:
```bash
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 a production-grade HTTP interception gateway for microservices, browser frontends, and autonomous agent platforms.
Endpoint:
POST https://p20.laveto.net/wisdom/api/v1/interceptCORS: Enabled (
Access-Control-Allow-Origin: *)Arbitration Engine Latency:
< 0.80 ms
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
Plan | Pricing (USD / BWP) | Quota & Features | Access / Checkout |
Developer Sandbox | Free | 10,000 requests, HMAC token minting | Code |
Developer Pro | $49 / BWP 690 /mo | 50,000 audit requests, 1 license key, offline HMAC validation | |
Team / Startup | $199 / BWP 2,650 /mo | 1,000,000 audit requests, 5 seat keys, Redis state sync | |
Enterprise Dedicated | $990 / BWP 13,200 /mo | Unlimited seats, dedicated gateway tenant, custom statutory lenses | |
To activate enterprise quotas, pass your signed bearer token in the |
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.
Available Tools
3 toolsanalyze_code_astA
Deconstruct source code or commands into abstract syntax tree (AST) primitives to detect dangerous patterns.
Identifies dynamic evaluations, shell piping, lateral network egress, and destructive operations.
Args:
code: The source code snippet, query, or command string to statically analyze.
environment: The syntactic context or execution environment ('python', 'bash', 'sql'). Default is 'python'.
Returns:
Dictionary containing detected execution primitives, security classification, and containment recommendations.
| Name | Required | Description | Default |
|---|---|---|---|
| code | Yes | ||
| environment | No | python |
Output Schema
| Name | Required | Description |
|---|---|---|
| result | Yes |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
With no annotations, the description carries the full burden, and it does disclose that the operation is static (no execution) and that it returns detected primitives, a security classification, and containment recommendations. It omits things like performance limits or how strictly classification thresholds are set, but the safety-relevant behavior is communicated.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
Front-loaded with purpose followed by clear Args/Returns sections; the two-line opener carries the real signal. The Args/Returns blocks are somewhat formulaic but each line adds information, with no filler sentences.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
An output schema exists so return values needn't be spelled out, and both parameters are documented despite zero schema coverage. For a two-parameter, annotation-free analysis tool this is essentially complete, with only explicit usage routing missing.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
Schema description coverage is 0%, so the description must compensate, and it does: it documents 'code' as the snippet/query/command to analyze and 'environment' as the syntactic context, adding concrete enum-like values ('python', 'bash', 'sql') and the 'python' default that the schema does not provide.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
States a specific verb+resource ('Deconstruct source code or commands into abstract syntax tree primitives') and a concrete goal ('to detect dangerous patterns') with enumerated categories of what it finds. The sibling tools (telemetry, interception) are clearly different, so an agent can identify this as the static-analysis entry point without checking schemas.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
The intent ('statically analyze... to detect dangerous patterns') implies when the tool is useful, i.e., security screening of code or commands. However, it gives no explicit when-to-use/when-not guidance, no mention of prerequisites such as when to prefer it over intercept_tool_call, and no exclusions.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
get_circuit_breaker_telemetryB
Retrieve operational status, active defense policies, and telemetry for the AW-1 Circuit Breaker.
Returns:
Dictionary with engine version, status, registered containment layers, and SLA guarantees.
| Name | Required | Description | Default |
|---|---|---|---|
No parameters | |||
Output Schema
| Name | Required | Description |
|---|---|---|
| result | Yes |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
With no annotations provided, the description carries the full burden, and it does convey that this is a read-only retrieval ("Retrieve"), which is meaningful behavioral signal. However, it discloses nothing about permissions, rate limits, freshness/latency of the telemetry, or whether calling it has any side effects. The "Returns" block largely restates the output schema rather than adding behavioral context.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
The definition is short and front-loaded, with the core action stated in the first sentence. The trailing "Returns" block is somewhat redundant given that an output schema exists, but it costs little and does not obscure the purpose.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
For a zero-parameter, read-only telemetry tool with a dedicated output schema, the description is essentially complete: what it returns is covered by the schema, and the purpose is clear. Only the absence of any usage guidance keeps it from being fully complete.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
The tool takes zero parameters, so there is nothing for the description to disambiguate; the baseline for a no-parameter tool is 4. Nothing in the description misrepresents the empty input schema.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The description pairs a specific verb ("Retrieve") with a specific resource ("operational status, active defense policies, and telemetry for the AW-1 Circuit Breaker"), so an agent knows exactly what it fetches. It does not explicitly differentiate itself from the siblings intercept_tool_call and analyze_code_ast, but those are functionally dissimilar, so the risk of confusion is low.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
There is no statement of when to call this tool versus the siblings, no prerequisites, and no exclusions. The agent must infer usage entirely from the name and resource description.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
intercept_tool_callB
Intercept and evaluate an autonomous AI agent tool execution payload before runtime invocation.
Determines whether the execution is safe or requires immediate containment.
Args:
actor_id: Unique identifier or name of the calling agent, user, or process.
tool_name: The target tool, environment, or command type (e.g., 'bash', 'sql', 'python', 'eval').
payload: The raw code, shell command, query, or parameters to be inspected by the circuit breaker.
Returns:
Dictionary containing the security verdict ('PERMITTED' or 'HALT_AND_CONTAIN'),
authorization status, cryptographic execution token (if permitted), risk score,
and detected AST primitives.
| Name | Required | Description | Default |
|---|---|---|---|
| payload | Yes | ||
| actor_id | Yes | ||
| tool_name | Yes |
Output Schema
| Name | Required | Description |
|---|---|---|
| result | Yes |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
With no annotations, the description carries the full burden. It discloses useful behavior beyond the schema — a verdict of PERMITTED or HALT_AND_CONTAIN, issuance of a cryptographic execution token, risk scoring, and AST primitive detection — but omits side effects (token issuance/mutation), required authorization or credentials, idempotency, and what happens operationally when containment triggers.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
The lead sentence is well front-loaded and the Args/Returns docstring structure is scannable, but it reads as an internal docstring rather than an agent-facing definition, and the Returns block restates information the output schema already provides.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
An output schema exists, so the enumerated return values are redundant rather than necessary. For a security-gating tool with no annotations and three required parameters, the description still leaves out the critical operational facts: whether this call is a mandatory precondition, what authorization it needs, and how it relates to its two sibling tools.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
Schema description coverage is 0%, so the description must compensate, and it does: all three parameters are defined with intent and examples (actor_id as caller identity, tool_name as target type with 'bash'/'sql'/'python'/'eval' examples, payload as the raw artifact to inspect). It lacks format constraints such as max payload size or accepted tool_name values, but the semantic gap is largely closed.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
States a specific verb+resource ('Intercept and evaluate an autonomous AI agent tool execution payload') and the outcome it decides (safe vs. requires containment). It is clear on its own, but never distinguishes itself from siblings like analyze_code_ast, which also inspects code/AST content, leaving overlap for an agent to resolve.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
No guidance on when this must be called versus alternatives. The description implies a pre-invocation gate but never says it is mandatory before every tool execution, nor when to prefer analyze_code_ast or get_circuit_breaker_telemetry instead.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
6 tool updates
v0.1.2- Added
analyze_code_ast - Added
get_circuit_breaker_telemetry - Removed
get_containment_status - Removed
inspect_python_code - Removed
inspect_tool_arguments - Added
intercept_tool_call
3 tool updates
v0.1.0- First observed
get_containment_status - First observed
inspect_python_code - First observed
inspect_tool_arguments
TDQS
Scored across 3 tools
Each tool has a recognizable role: get_circuit_breaker_telemetry reads status, intercept_tool_call gates a runtime execution, and analyze_code_ast performs static analysis. However, intercept_tool_call and analyze_code_ast overlap, since both inspect payloads and both return detected AST primitives/risk, so an agent may hesitate between them.
All three names use a consistent snake_case verb_noun pattern (get_..., intercept_..., analyze_...). The convention is predictable and readable across the set.
Three tools is at the low end but reasonable for a focused circuit breaker: status, enforcement, and analysis. It is slightly thin, with no tools for adjacent concerns like policy management or audit history.
The core inspect/enforce/observe lifecycle is covered, but the telemetry tool references 'active defense policies' and 'containment layers' with no tool to list, create, or update those policies, and there is no audit/decision-log retrieval. These are notable gaps for a security-gateway domain.
Maintenance
Related MCP Connectors
Autonomous agent guardrails, bash sandboxing, MCP rugpull diffing & prompt firewalls.
Deterministic runtime safety for AI agents: scan PII, gate tool actions, verify LLM output.
LLM agent security review: live injection/jailbreak probes plus a static audit of missing guardrails
Real-time MCP & A2A prompt-injection, jailbreak, and tool-schema poisoning firewall for AI agents.
Related MCP Servers
- AlicenseAqualityDmaintenanceStatic worst-case token-budget analysis for LLM-agent workflows using AST analysis to identify certifiable, default-dependent, non-certifiable, and runaway units, with optional signed budget certificates.430 npmMIT
- AlicenseNot gradedqualityBmaintenanceA runtime gate for coding agents. Blocks the tool calls that wreck a repo (force-push main, rm -rf, secret exfiltration, CI wipe) and lets normal build and commit work through. Machine-checked git-branch core (z3); the rest is high-precision heuristics. Tested on 3,790 real CI commands, 0 false blocks.1MIT
- FlicenseNot gradedqualityCmaintenanceEnables autonomous AI agents and MCP clients to route tool calls through a zero-trust firewall that blocks dangerous shell commands, redacts secrets and PII, restricts sensitive file access, and logs verdicts. It provides an MCP interceptor decorator to protect MCP server tools with AST-based command injection checks and allow, block, or redact decisions.2-
- AlicenseAqualityAmaintenanceIn-memory polyglot AST pruning and deterministic context firewall for coding agents, eliminating up to 72.4% token bloat with zero telemetry egress.5339 PyPI7Apache 2.0