Agent Guardrails Wrapper
The reasoning layer proposes; the wrapper disposes. Mechanical floors for agents that can spend money.
$29
Works with the AI Agents you already use
Agent Guardrails Wrapper
Example session with this skill installed
Audit my agent's order execution tool and design a mechanical wrapper that enforces a 2% daily loss cap and a kill switch.
- Read your context and instructions
- Compiled the agent guardrails wrapper
I have audited the execute_order tool in src/trading/executor.py. The current implementation relies on a system prompt to stay within risk limits, which is a significant side-channel vulnerability.
Agent Guardrail Architecture
The following implementation moves the risk logic out of the model's reasoning loop and into a deterministic wrapper.
# src/safety/wrapper.py
import time
from typing import Dict, Any
class ExecutionWrapper:
def __init__(self, daily_loss_limit: float, kill_switch_path: str):
self.daily_loss_limit = daily_loss_limit
self.kill_switch_path = kill_switch_path
self.start_equity = self._get_fresh_equity()
def _get_fresh_equity(self) -> float:
# Implementation of "Fresh-read precondition"
pass
def check_gate(self, request_size: float) -> bool:
# Check 1: Kill Switch (Mechanical)
if self._is_kill_switch_engaged():
return False, "REJECTED: Kill switch active"
# Check 2: Loss Floor (Deterministic)
current_equity = self._get_fresh_equity()
if (self.start_equity - current_equity) > self.daily_loss_limit:
return False, "REJECTED: Daily loss cap hit"
return True, "ALLOWED"
def _is_kill_switch_engaged(self) -> bool:
with open(self.kill_switch_path, 'r') as f:
return f.read().strip() == "STOP"
# The reasoning layer proposes; the wrapper disposes
def guarded_execute(agent_request: Dict[str, Any]):
wrapper = ExecutionWrapper(daily_loss_limit=2000.0, kill_switch_path="/var/run/agent.stop")
is_allowed, reason = wrapper.check_gate(agent_request['size'])
if is_allowed:
return raw_execute_order(agent_request)
else:
return {"status": "error", "message": reason}
Next steps
- Move the
raw_execute_orderfunction to a private module so the agent cannot call it directly via tool-use. - Initialize the
ExecutionWrapperwith a fresh-read from your broker API on every request to prevent state decay. - Set up a cron-based watchdog to check the
/var/run/agent.stopfile if the heartbeats in your journal cease.
Connects securely to your tools. The creator never sees your data.
About this skill
If your agent can spend money, place trades, deploy code, or take irreversible actions, politeness is not a gate. This skill defines guarded-by-construction: exactly one mechanical entry point for consequential actions; refusal lists enumerated in code (price bands, loss-streak caps, equity floors, kill switch, mandate state) with fail-closed behavior on missing state; formula-computed limits the model cannot influence; open positions inheriting the same wrapper; and the standing rule that verification decays with the code — any change to the guarded path voids the audit. Runtime resilience covers supervisor restarts, heartbeat-based DOWN detection, an external backstop outside the failure domain with honestly stated blind intervals, and journaled boots. Includes the Goodhart pressure discipline: when the goal is unreachable through disciplined play, reframe the objective — because a far-out goal pressures the agent toward forcing the exact actions its edge depends on refusing. What's inside: SKILL.md (the architecture law), reference/audit-checklist.md (static audit from live code, dynamic fire-the-gates tests, red-flag list), examples/worked-example.md (a static audit excerpt that finds an unguarded side path).
Find more skills like this on the Claude Skills Marketplace, the Codex Skills Marketplace and the Gemini Skills Marketplace, or browse Claude Skills for Security.
Architecture requires a separate failure domain for backstops. Audit reports are only valid for the specific code version analyzed.
How to use
- 1
Connect your agent to the Agensi MCP
Copy the prompt and paste it into Claude, ChatGPT, Cursor or any agent that supports MCP. It sets up the connection for you. Manual setup
- 2
Sign in to Agensi
Your agent shows a sign-in link. Sign in and click Allow.
- 3
Ask for what you need
Your agent loads this skill and uses it on your task. It always asks before buying a skill.
Reviews
No reviews yet
Be one of the first to try it. Every listed skill goes through the trust checks below.
Security scanned
Checked by our 8-point scan before listing
Fresh listing
Recently published to Agensi
Money-back guarantee
Doesn't do what its page promises? You get your money back.
Trust & safety
Security scan
Security scan passed 5 days ago