# Freeze an agent

Source: https://immiscible.fly.dev/docs/api/post-api-w-wid-agents-aid-freeze

`POST /api/w/:wid/agents/:aid/freeze`

Stop the agent now: its action requests are denied (`agent_frozen`), its model calls and proxied tool calls are refused with `403 agent_stopped` before anything is sent, and approvals in flight are cancelled. See [the kill switch](https://immiscible.fly.dev/docs/guides/kill-switch.md).

| Field | Description |
|---|---|
| `reason` | why; recorded |
| `hold` | `owner`, `security` or `incident`: who may lift it. Kill owners and security leads default to `security` |

## Authentication

Session cookie. A signed-in person: the console's session cookie. Every state-changing request also carries the header `x-immiscible-csrf: 1`, and the member's role decides what it may do. Bearer tokens are ignored on these routes, so no machine credential can reach them.

## Path parameters

- `wid` (string, required): Workspace id
- `aid` (string, required): Agent id

## Request

curl:

```bash
curl -X POST "https://immiscible.fly.dev/api/w/$IMMISCIBLE_WORKSPACE/agents/agt_4f2c91a7/freeze" \
  -H "cookie: __Host-sid=$IMMISCIBLE_SESSION" \
  -H "x-immiscible-csrf: 1" \
  -H "content-type: application/json" \
  -d '{
    "reason": "posting to an unknown domain",
    "hold": "security"
  }'
```

Node:

```ts
const res = await fetch('https://immiscible.fly.dev/api/w/$IMMISCIBLE_WORKSPACE/agents/agt_4f2c91a7/freeze', {
  method: 'POST',
  headers: {
    cookie: `__Host-sid=${process.env.IMMISCIBLE_SESSION}`,
    'x-immiscible-csrf': '1',
    'content-type': 'application/json',
  },
  body: JSON.stringify({
    reason: 'posting to an unknown domain',
    hold: 'security',
  }),
});
const data = await res.json();
console.log(res.status, data);
```

Python:

```python
import os
import requests

res = requests.post(
    "https://immiscible.fly.dev/api/w/$IMMISCIBLE_WORKSPACE/agents/agt_4f2c91a7/freeze",
    headers={
        "cookie": f"__Host-sid={os.environ['IMMISCIBLE_SESSION']}",
        "x-immiscible-csrf": "1",
        "content-type": "application/json",
    },
    json={
        "reason": "posting to an unknown domain",
        "hold": "security",
    },
)
print(res.status_code, res.json())
```
