Docs
Connect an agent to TryBrake.
Before your agent runs a risky action, it asks TryBrake. TryBrake applies your rules and answers allowed, blocked or pending (a human must decide). That's the whole idea.
Quickstart
- Create an account and add an agent in Agents & keys. Pick how it's built: n8n, Make, Zapier, Claude Code, Codex, Cursor, Gemini CLI, Python, JavaScript, or anything else.
- Follow the steps shown for that kind. For n8n and Make you connect your account; for coding assistants and your own code you paste one text into your AI assistant.
- Write your rules in Rules & limits, by hand or by describing them in a sentence. Every new agent already gets safe defaults.
Want the details or a custom setup? Everything below is the plain API the connectors use.
How a decision is made
For each call, TryBrake checks, in this order:
- The workspace kill-switch, the agent's status, and whether this action is switched off.
- Your volume limits, like "at most 20 refunds per hour".
- Your rules, from top to bottom. The first rule that matches decides. If none matches, the action is allowed.
No AI is involved at this point: the same call with the same rules always gets the same answer.
Authentication
Each agent has its own key, starting with ag_live_. Send it as a Bearer token. Keep it in an environment variable, never in your code.
Authorization: Bearer ag_live_...Check an action
Call this right before running the action.
POST https://trybrake.com/api/v1/actions
Content-Type: application/json
{
"tool": "stripe.refund",
"args": { "order_id": "A-1042", "amount": 2450 },
"run_id": "ticket-48211",
"reasoning": "Customer says the parcel never arrived"
}tool- Required. The action's name, like stripe.refund or send_email. Letters, digits, _ . : - (up to 100).
args- The action's details as a JSON object (under 10 KB). Rules can test any field, like amount.
run_id- Optional. Groups the steps of one task (a ticket, a conversation) for the replay.
reasoning- Optional. Why the agent wants to do it. Shown to approvers and in the replay.
call_id- Optional. Your own id for this call, to report its result later.
{
"decision": "pending",
"action_id": "6f1c…",
"reason": "Refunds over 200 need approval",
"flags": []
}- allowed: run the action.
- blocked: don't run it.
reasonsays why; tell the user. - pending: wait for a human (next section).
flags lists unusual behaviour TryBrake noticed, like the same call repeated in a loop.
Wait for approval
While an action is pending, poll it every few seconds until the decision is approved or denied. Approvers decide from the dashboard or from the alert in Slack, Teams, Google Chat or Telegram.
GET https://trybrake.com/api/v1/actions/{action_id}
{ "action_id": "6f1c…", "decision": "approved", "reason": "…", "decided_at": "…" }Report the result
Optional, but it makes the replay complete: after the action ran, say how it went. This never changes a decision.
POST https://trybrake.com/api/v1/results
{ "action_id": "6f1c…", "outcome": "ok", "result": { "refund_id": "re_123" } }Use call_id instead of action_id if you sent one. outcome is ok or error; results over 8 KB are cut.
Declare your actions
Optional. Tell TryBrake what your agent can do, once at startup, so the dashboard lists these actions and their fields when you write rules.
POST https://trybrake.com/api/v1/tools
{ "tools": [{ "name": "stripe.refund", "fields": ["order_id", "amount"] }] }No-code tools
Tools that can't send JSON easily can put everything in the address. Every parameter not starting with _ becomes an arg.
POST https://trybrake.com/api/v1/actions?tool=stripe.refund&amount=2450&_run=ticket-48211&_wait=25_run: the run id._why: the reasoning._wait: hold the answer up to 25 seconds while a human decides, so the scenario can continue in the same run.
Ready-made connectors
You rarely need to call the API by hand. The dashboard gives you a connector already set up with your agent:
from agentguard import guard
@guard("stripe.refund")
def refund(order_id, amount):
... # only runs if TryBrake says yesimport { guard } from "./agentguard.mjs";
const refund = guard("stripe.refund", async ({ orderId, amount }) => {
// only runs if TryBrake says yes
});- Python and JavaScript: no dependencies. Blocked or denied calls raise an error and the function never runs. Pending calls wait for the decision.
- n8n and Make: connect your account and switch protection on, step by step. See n8n and Make.
- Claude Code, Codex, Cursor, Gemini CLI: a hook checks commands and file edits. See Claude Code and ChatGPT & OpenAI.
Rules and limits
A rule has an action (or * for all), an optional condition on one field, and an effect: allow, block or ask a human.
- Conditions compare a field of
args:=,!=,>,>=,<,<=, orcontains. - Time conditions: the hour, the day of the week, or weekends, in your workspace's time zone.
- Repeat conditions: the same value seen before, like a second refund for the same order in 30 days.
- Shell commands get
detected_risksautomatically (likerecursive_deleteorforce_push), whatever the spelling. - Limits cap how many calls of an action go through in a time window.
Errors and outages
401: the key is missing, wrong or revoked.400: the request is malformed; the message says what to fix.- If TryBrake can't be reached or answers with an error, don't run the action. All our connectors fail closed this way, and yours should too.
Put a brake on your agents today.
Connect your first agent in five minutes. 14 days free, no credit card.

