aw1-circuit-breaker
The server provides security inspection and containment status tools for AI agent tool calls.
Inspect Python code AST for unsafe constructs, shell injection, dynamic evaluation, and socket egress.
Validate arguments passed to external tools for risky shell patterns, eval triggers, or socket connections.
Retrieve the current state of zero-trust AST containment rules.
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.0.1)
Featured on Hashgraph Online (HOL): Read the independent source-level teardown: What aw1-breaker 2.0.0 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, per-actor rolling velocity monitors, and cryptographically signed HMAC execution tokens.
โก 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 aw1-circuit-breaker(Zero external dependencies. Pure Python standard library: Python 3.10 to 3.13).
๐ก๏ธ Enterprise Guard (Turnkey 3-Line Integration)
Drop enterprise boundary policies directly onto agent tools using the @guard.protect decorator:
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"๐ Model Context Protocol (MCP) Server
Run directly with Python:
python mcp_server.pyOr via uvx:
uvx mcp_server.pyMCP Client Configuration
Add to your Claude Desktop or Cursor configuration:
{
"mcpServers": {
"aw1-circuit-breaker": {
"command": "python",
"args": ["mcp_server.py"]
}
}
}โ๏ธ 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 ( |
Run the Showcase
python examples/enterprise_guard_demo.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 |
|
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:
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}")๐ Production Cloud API & Quota Upgrades
Deploying autonomous agents in production? Route your tool dispatch loops through our hosted API gateway with sub-0.2ms deterministic AST inspection:
Plan | Pricing (USD / BWP) | Quota & Features | Access / Checkout |
Developer Sandbox | Free | 10,000 requests, HMAC token minting | Code |
Developer Pro | $49 / BWP 650 /mo | 100,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 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.
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
Deterministic runtime safety for AI agents: scan PII, gate tool actions, verify LLM output.
Checked language for AI-written agent workflows: limits, cost and data flows known before running.
AgentGuard โ 20-tool AI safety MCP: policy preflight, risk scoring, audit logging, rate limits.
Jailbreak-proof AI guardrails. Automated Reasoning SMT solver, not an LLM. ZK proofs included.
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.426 npmMIT
- AlicenseNot gradedqualityAmaintenanceA 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.57Apache 2.0