Skip to content

Agent Guardrails

Overview

Agents go rogue. They overspend. They call tools they shouldn’t. They run at 3am doing things nobody asked for.

Agent Guardrails is fraud prevention for AI agents — behavioral rules, anomaly detection, and automatic intervention.

Think Stripe Radar, but for agents instead of credit cards.

Behavioral Rules

Define what your agent can and can’t do:

from fiftyc import AgentAuth
import os
agent = AgentAuth(api_key=os.getenv("FIFTYC_API_KEY"))
# Rate limiting
agent.add_rule("max_calls_per_minute", 10)
# Time restrictions
agent.add_rule("block_tools_after_hours", True)
agent.add_rule("active_hours", {"start": "08:00", "end": "22:00", "tz": "UTC"})
# Pattern blocking
agent.guard(
blocked_patterns=["exec(", "rm -rf", "DROP TABLE"],
max_spend_per_hour=50
)

Anomaly Detection

Automatic alerts when agent behavior deviates from normal:

SignalTriggerAction
Spend spike4x daily average in 1 hourAlert human
Error surgeError rate jumps from 5% to 40%Pause agent
Off-hours activityCalls outside configured hoursBlock + alert
Tool pattern changeAgent suddenly using tools it never usedFlag for review
Rapid-fire calls>100 calls/minuteRate limit + alert
# Configure anomaly detection
agent.anomaly_detection(
spend_spike_threshold=4.0, # 4x normal = alert
error_rate_threshold=0.4, # 40% errors = pause
alert_channel="webhook", # or "email", "slack"
alert_url="https://your-app.com/agent-alerts"
)

Auto-Intervention

When guardrails trigger, the system can act automatically:

agent.configure_interventions(
on_spend_spike="pause_and_alert", # Pause agent, notify human
on_error_surge="pause_and_alert", # Pause agent, notify human
on_blocked_pattern="kill", # Immediate revoke
on_rate_limit="throttle" # Slow down, don't kill
)

Intervention Levels

LevelWhat HappensWhen
ThrottleSlow agent to 1 call/minRate limit exceeded
PauseStop agent, wait for human resumeSpend spike or error surge
KillRevoke all permissions permanentlyBlocked pattern detected
AlertNotify human, agent continuesOff-hours or unusual tool usage

Why This Matters

The #1 blocker for enterprise agent adoption is trust:

“What if my agent goes rogue?” “How do I prove to my CISO that agents are controlled?” “What if an agent drains my budget overnight?”

Guardrails make agents enterprise-safe:

  • Every rule is server-side enforced (can’t be bypassed by the agent)
  • Every intervention is logged in the audit trail
  • Humans stay in control without micromanaging every call

Integration with Agent Auth

Guardrails are part of the Agent Auth SDK. They work automatically with Agent Wallets — no separate setup needed.

# Full setup: auth + wallet + guardrails in one
agent = AgentAuth(api_key=os.getenv("FIFTYC_API_KEY"))
agent.configure(
auto_approve_below=10,
require_approval_above=50,
kill_after=500
)
agent.add_rule("max_calls_per_minute", 10)
agent.add_rule("block_tools_after_hours", True)
agent.anomaly_detection(
spend_spike_threshold=4.0,
alert_channel="webhook",
alert_url="https://your-app.com/alerts"
)
# Agent runs with full protection
@agent.authorize(credit_limit=100)
def my_agent_task():
return agent.call("genius", problem="Optimize logistics")