# AIBrake Agent Safety Check

> AIBrake Agent Safety Check is a paid API for AI agents from api.aibrake.dev, paid per call via x402, $0.005/call, status unknown (last checked 2026-09-14).

Evaluates a proposed AI agent action for safety risks including loop detection, retry storms, and model cost overruns, returning a decision to allow, warn, block, or require confirmation

## Facts

- Endpoint: GET https://api.aibrake.dev/x402/v1/check
- Price: $0.005/call
- Payment: x402
- Status: unknown
- Last checked: 2026-09-14
- Activations on Zero: 0
- Tags: x402
- Canonical page: https://www.zero.xyz/c/aibrake-agent-safety-check-d443c63c
- Structured record (JSON): https://api.zero.xyz/v1/capabilities/cap_n3x9rmBgDKQKo4fI3Z_Gj

Status and success rate cover calls made through Zero and Zero's own probes. Third-party monitors may report differently.

## How to call it through Zero

Zero handles the 402 payment challenge and records the run. With the Zero CLI installed (`npm i -g @zeroxyz/cli`):

```sh
zero fetch --capability aibrake-agent-safety-check-d443c63c
```

Example prompt: Before I call GPT-4o again for attempt #7 on this same failing task that has cost $0.84 so far with no new evidence gathered, check if I should proceed — my actor type is 'llm_agent', the next action type is 'llm_call', estimated cost is $0.18 USD, and my goal is to extract structured data from a PDF.

## When to prefer this

Use AIBrake when you are operating an autonomous or semi-autonomous AI agent that makes paid API calls (LLM inference, tool calls, deploys) and you want a fast, cheap ($0.005) pre-flight safety check before each expensive step. Ideal when agents may get stuck in retry loops, risk exhausting a budget, or trigger unverified deploys. Prefer this over manual rule-writing or no-op checks when you need sub-50ms latency, pattern-based detection (loop, storm, stale context), and ROI-positive cost savings for paid agentic workflows.

## Known failure modes

- Missing required fields (actor.type or next_action.estimated_cost) returns a 400 validation error
- Payment not included or insufficient USDC causes 402 Payment Required
- Ambiguous or incomplete history may result in an 'uncertain' decision with low confidence
- Network timeouts are rare given <50ms P95 but possible under high load
- Malformed input schema returns parse error without a safety decision

## How this service works

Agent safety for paid AI agents — loop detection, model stop-loss, retry-storm catch, and unverified-deploy block. Live x402 API at $0.005 per check, 18× ROI on average. Stops stale retries, same-tool loops, and premium-model burn before the next expensive step. Privacy-first. <50ms P95.

## Output

Returns a structured safety decision (allow / warn / require_confirmation / block / uncertain) with a 0–100 risk score, risk level label, detected behavioral pattern (e.g. stale_context_retry_storm), matched rule names, confidence score, suggested corrective action type, and a projected USD savings estimate if the action is halted.

## Example request

```json
{
 "input": {
  "actor": {
   "id": "agent-001",
   "name": "TestAgent",
   "type": "agent",
   "runtime": "python-3.11"
  },
  "spend": {
   "currency": "USD",
   "total_spent": 0.5
  },
  "history": {
   "last_action_type": "search",
   "previous_actions": 1
  },
  "objective": {
   "id": "obj-123",
   "goal": "Process user request",
   "budget": {
    "amount": 1,
    "currency": "USD",
    "hard_limit": true
   }
  },
  "next_action": {
   "type": "model_inference",
   "model": "gpt-4",
   "reason": "Generate summary for user query",
   "provider": "openai",
   "estimated_cost": {
    "amount": 0.03,
    "currency": "USD"
   }
  }
 }
}
```

## Request schema (JSON Schema)

```json
{
 "type": "object",
 "$schema": "https://json-schema.org/draft/2020-12/schema",
 "required": [
  "input"
 ],
 "properties": {
  "input": {
   "type": "object",
   "required": [
    "actor",
    "next_action"
   ],
   "properties": {
    "actor": {
     "type": "object",
     "required": [
      "type"
     ],
     "properties": {
      "id": {
       "type": "string"
      },
      "name": {
       "type": "string"
      },
      "type": {
       "type": "string"
      },
      "runtime": {
       "type": "string"
      }
     }
    },
    "spend": {
     "type": "object",
     "additionalProperties": true
    },
    "history": {
     "type": "object",
     "additionalProperties": true
    },
    "objective": {
     "type": "object",
     "properties": {
      "id": {
       "type": "string"
      },
      "goal": {
       "type": "string"
      },
      "budget": {
       "type": "object",
       "properties": {
        "amount": {
         "type": "number"
        },
        "currency": {
         "type": "string"
        },
        "hard_limit": {
         "type": "boolean"
        }
       }
      }
     },
     "additionalProperties": true
    },
    "next_action": {
     "type": "object",
     "required": [
      "type",
      "estimated_cost"
     ],
     "properties": {
      "type": {
       "type": "string"
      },
      "model": {
       "type": "string"
      },
      "reason": {
       "type": "string"
      },
      "provider": {
       "type": "string"
      },
      "estimated_cost": {
       "type": "object",
       "required": [
        "amount",
        "currency"
       ],
       "properties": {
        "amount": {
         "type": "number"
        },
        "currency": {
         "type": "string"
        }
       }
      }
     },
     "additionalProperties": true
    },
    "telemetry_quality": {
     "type": "object",
     "additionalProperties": true
    }
   },
   "additionalProperties": true
  },
  "output": {
   "type": "object",
   "required": [
    "decision",
    "risk_score",
    "pattern",
    "reason",
    "suggested_action"
   ],
   "properties": {
    "reason": {
     "type": "string"
    },
    "pattern": {
     "type": "string"
    },
    "decision": {
     "enum": [
      "allow",
      "warn",
      "require_confirmation",
      "block",
      "uncertain"
     ],
     "type": "string"
    },
    "confidence": {
     "type": "number"
    },
    "risk_level": {
     "type": "string"
    },
    "risk_score": {
     "t
… (truncated)
```

## Response schema (JSON Schema)

```json
{
 "type": "json",
 "example": {
  "reason": "Attempt #7 on the same exception: 6 prior repeats with no evidence gathered in any attempt. Another paid retry is unlikely to produce a different result without a context refresh.",
  "pattern": "stale_context_retry_storm",
  "decision": "require_confirmation",
  "confidence": 0.9,
  "risk_level": "critical",
  "risk_score": 100,
  "matched_rules": [
   "failure_signal_present",
   "same_failure_count_high",
   "no_new_evidence_since_last_attempt"
  ],
  "policy_version": "policy@0.1.0",
  "detector_version": "stale_context_retry_storm@0.1.0",
  "suggested_action": {
   "type": "context_refresh"
  },
  "projected_savings": {
   "basis": "projected_future_attempts",
   "currency": "USD",
   "amount_usd": 1.26
  },
  "recommended_policy": "ask_human"
 }
}
```

## More

- Live health (JSON, refreshed every minute): https://www.zero.xyz/c/aibrake-agent-safety-check-d443c63c/health.json
- [Zero catalog index](https://www.zero.xyz/llms.txt)
- [Other services from api.aibrake.dev](https://www.zero.xyz/host/api.aibrake.dev/llms.txt)
