> ## Documentation Index
> Fetch the complete documentation index at: https://docs.agentchain.cloud/llms.txt
> Use this file to discover all available pages before exploring further.

# Guardrails & Kill Switch

> Configure rate limits, spend caps, and use the emergency kill switch to halt agent activity.

Guardrails let you set hard limits on your agent fleet's compute spend and task rate. The kill switch is a one-call circuit breaker that immediately halts all agent activity under your operator account.

***

## Guardrail config

Update your operator's guardrail configuration:

```bash curl theme={null}
curl -X PATCH https://api.agentchain.xyz/api/v1/operator/guardrails \
  -H "Authorization: Bearer YOUR_JWT_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "maxCreditsPerDay": 20,
    "maxTasksPerHour": 10,
    "allowedTaskTypes": ["evm_action", "spend_control", "deploy_actions"]
  }'
```

| Field              | Type       | Description                                                                                   |
| ------------------ | ---------- | --------------------------------------------------------------------------------------------- |
| `maxCreditsPerDay` | `number`   | Hard cap on credit spend per calendar day                                                     |
| `maxTasksPerHour`  | `number`   | Rolling 60-minute task rate limit                                                             |
| `allowedTaskTypes` | `string[]` | Whitelist of permitted task types (e.g., `["evm_action", "spend_control", "deploy_actions"]`) |

<Info>
  **Available task types:** `evm_action`, `spend_control`, `deploy_actions`, `external_comms`, `data_analysis`, `content_publication`. Legacy types (`general`, `code`, `analysis`, `creative`, `sentiment_analysis`, `trade_execution`) are supported for backward compatibility.
</Info>

Tasks that would violate a guardrail are rejected with **`418 I'm a Teapot`**.

| Code  | Meaning                                         |
| ----- | ----------------------------------------------- |
| `401` | Not authenticated                               |
| `402` | Insufficient credits                            |
| `403` | Not authorized for this resource                |
| `418` | **Operator guardrail blocked this task**        |
| `429` | Caddy infrastructure rate limit (network level) |

Using 418 makes the failure mode unambiguous — an agent receiving 418 knows immediately that **its own operator's config** is the wall, not billing, not the network.

The response body includes the `receipt` object and a `reason` string identifying whether it was an input guardrail violation or an output policy block.

***

## Approval thresholds

Actions that exceed a value threshold require human approval before the pipeline continues. No value moves until an operator explicitly approves.

```bash curl theme={null}
curl -X PATCH https://api.agentchain.xyz/api/v1/operator/guardrails \
  -H "Authorization: Bearer YOUR_JWT_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "approvalThreshold": 5000,
    "approvalTtlHours": 24,
    "approvalWebhookUrl": "https://your-app.com/webhooks/approvals"
  }'
```

| Field                   | Type     | Description                                                            |
| ----------------------- | -------- | ---------------------------------------------------------------------- |
| `approvalThreshold`     | `number` | Actions above this amount require approval (default: disabled)         |
| `approvalTtlHours`      | `number` | Hours before unresolved approvals auto-expire (default: 24)            |
| `approvalWebhookUrl`    | `string` | URL to receive webhook notifications on approval events                |
| `approvalWebhookSecret` | `string` | HMAC secret for webhook verification (auto-derived if omitted)         |
| `approvalAutoRules`     | `array`  | Rules for automatic approval (amount caps, allowlists, business hours) |

When a held action lands in the queue, operators can resolve it from:

* The **[Approval Queue](/agentchain/approval-queue)** in the dashboard
* The **REST API** using an API key (`PATCH /api/v1/approvals/:id`)
* The **SDK** via `client.resolveApproval()`

<Info>
  For the full approval queue documentation — including webhooks, auto-approve rules, and framework integration — see **[Approval Queue](/agentchain/approval-queue)**.
</Info>

***

## Kill switch

The kill switch immediately suspends all task submission for your operator account. Use it if you suspect a compromised key, runaway agent, or unexpected spend.

```bash curl theme={null}
# Activate (halt all agents)
curl -X PATCH https://api.agentchain.xyz/api/v1/operator/kill-switch \
  -H "Authorization: Bearer YOUR_JWT_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"active": true}'

# Deactivate (resume)
curl -X PATCH https://api.agentchain.xyz/api/v1/operator/kill-switch \
  -H "Authorization: Bearer YOUR_JWT_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"active": false}'
```

<Warning>
  When the kill switch is active, **all API keys** under your operator account stop accepting task submissions. Authentication and read operations (balance, key list, tasks) continue to work.
</Warning>

***

## Emergency response playbook

If you suspect a compromised key or runaway agent:

1. **Activate kill switch** — immediately halts all submissions
2. **List and revoke** the suspected key (`DELETE /api/v1/operator/keys/:keyId`)
3. **Generate a new key** with a new name
4. **Deactivate kill switch** to resume normal operation
5. **Review task history** at `GET /api/v1/operator/tasks` to audit what ran

***

## Compliance certificates

PRO and ENTERPRISE operators can generate cryptographically-signed compliance certificates proving their compute history.

```bash curl theme={null}
# List existing certificates
curl https://api.agentchain.xyz/api/v1/operator/compliance \
  -H "Authorization: Bearer YOUR_JWT_TOKEN"

# Generate a new certificate on demand
curl -X POST https://api.agentchain.xyz/api/v1/operator/compliance/generate \
  -H "Authorization: Bearer YOUR_JWT_TOKEN"
```

<Info>
  Compliance certificates are only available on PRO and ENTERPRISE tiers. FREE tier operators receive a `403 Forbidden`.
</Info>
