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

# Agent API

> Read and change the Squasher Agent's settings, memory, and skills, and see its conversations, signals, and daily budget use.

The Agent API controls the [Squasher Agent](/features/squasher-agent) for one project. Read
requests need the `automations:read` permission. Changes need `automations:write`.

## Settings

```bash theme={null}
GET /v1/projects/{project_id}/agent/settings
PATCH /v1/projects/{project_id}/agent/settings
```

The response has a `settings` object. Send only the fields that you want to change:

```bash theme={null}
curl -X PATCH "https://api.squasher.ai/v1/projects/$SQUASHER_PROJECT_ID/agent/settings" \
  -H "Authorization: Bearer $SQUASHER_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{ "proactive_alerts": "sev1_only", "pr_review": "off" }'
```

| Field | Values |
| - | - |
| `proactive_alerts` | `all`, `important`, `sev1_only`, `off` |
| `pr_review` | `comment_on_risk`, `off` |
| `auto_fix` | `project_policy`, `off` |
| `reply_style` | `concise`, `detailed` |
| `daily_alert_cap` | An integer from 0 to 50 |
| `alert_channel_id` | A Slack channel ID, or `null` for the first one |

An unknown field returns `400`. A request with no valid value returns `422`.

## Memory

```bash theme={null}
GET /v1/projects/{project_id}/agent/memory
POST /v1/projects/{project_id}/agent/memory
DELETE /v1/projects/{project_id}/agent/memory/{memory_id}
```

The list includes project entries and organization entries. To add an entry, send:

| Field | Required | Description |
| - | - | - |
| `kind` | Yes | `rule`, `preference`, `fact`, or `incident`. |
| `content` | Yes | The text of the entry. At most 500 characters. |
| `scope` | No | `project` (default) or `organization`. |
| `replaces_id` | No | The ID of an entry that this entry replaces. |

When a `rule` matches a setting, the setting changes too. The response shows the changed settings
in `settings_applied`, or `null`.

| Status | Reason |
| - | - |
| `409` | The scope has its maximum number of entries, or the entry is a copy. |
| `404` | The entry in `replaces_id` does not exist. |
| `422` | The content is too long, has a secret, or tries to change the agent's safety rules. |

`DELETE` retires the entry. The agent does not use it again.

## Skills

```bash theme={null}
GET /v1/projects/{project_id}/agent/skills
POST /v1/projects/{project_id}/agent/skills
DELETE /v1/projects/{project_id}/agent/skills/{skill_id}
```

The list includes project skills, organization skills, and the names of the platform skills. When
a project skill and an organization skill have the same name, the project skill is used.

| Field | Required | Description |
| - | - | - |
| `name` | Yes | Lowercase letters, numbers, and hyphens. At most 64 characters. |
| `description` | Yes | When the agent must use the skill. At most 1,024 characters. |
| `content` | Yes | The instructions. At most 12,000 characters. |
| `scope` | No | `project` (default) or `organization`. |

A `POST` with a name that exists updates that skill. Organization skills also need the
`project:write` permission. A platform skill name returns `409`.

## Activity

```bash theme={null}
GET /v1/projects/{project_id}/agent/conversations
GET /v1/projects/{project_id}/agent/signals
GET /v1/projects/{project_id}/agent/usage
```

* `conversations` lists the last 100 conversations: Slack threads, dashboard chats, investigations,
  and pull request reviews.
* `signals` lists the last 100 events that the agent saw. Each one shows the `action` (for
  example `investigate`, `attach_to_existing`, or `ignore`), the `severity`, and the `reason`.
* `usage` shows today's use (UTC): `used_percent` of the daily budget, the budget `stage`, the
  number of `wakes`, and the number of `alerts_posted`.

| Stage | What the agent does |
| - | - |
| `normal` | All work. |
| `conserve` | All work except automatic fixes. |
| `notify_only` | Only answers to direct questions from people. |
| `exhausted` | Only answers to direct questions until the next day. |

## MCP

MCP Code Mode can read all of these endpoints. It can also change settings and add memory. It cannot
delete memory or change skills. See [MCP](/integrations/mcp).
