# Agent routes: update, delete

URL: /code/api/agent/records-update · Id: `page:code/api/agent/records-update`

> The Agent Verbs update, delete as api.sb routes, with inputs, result, refusals and an example.

Reference for [Agent](/business/nouns/agent), one group of [Agent routes](/code/api/agent).

### Agent.update
Changes the given properties of an Agent. [Verb page](/business/nouns/agent/update?interface=api).

```text
PATCH /{namespace}/agents/{id}
```

Path: `id`. Body, as JSON: the other inputs. Emits `Agent.updated`.

**Inputs**

| Input | Type | Required | Description |
| --- | --- | --- | --- |
| `id` | `string` | Yes | The id of the Agent. |
| `instructions` | `text` | No | What the Agent does and how. |
| `model` | `string` | No | The model the Agent runs on. |
| `tools` | `string[]` | No | The tools the Agent may call. |
| `skills` | list of [Skill](/business/nouns/skill) | No | The Skills it loads. |
| `memory` | `string` | No | One of `tenant` (one Memory per Customer Tenant) or `startup` (one Memory for the Startup). |
| `maxSteps` | `integer` | No | The most steps one Task may take. |
| `budget` | `money` | No | The most one Task may spend; the Mandate’s Limits apply as well. |
| `handoffs` | list of [Role](/business/nouns/role) | No | The Roles it hands work to. |

**Returns**

| Output | Type | Required | Description |
| --- | --- | --- | --- |
| `agent` | [Agent](/business/nouns/agent) | Yes | The Agent. |

**Refuses when**

| Check | Error | Fix | Then call |
| --- | --- | --- | --- |
| The key is valid, but its scopes do not allow this operation. | [`forbidden`](/code/api/errors/forbidden) | Use a key whose scopes cover the operation, or ask an owner of the namespace to grant them. | None. |

**Example**

```bash
curl -X PATCH https://api.sb/leaseline.app/agents/agent_tCzKDMorKn \
  -H "Authorization: Bearer $STARTUP_BUILDER_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"skills":["skill_xBqG4zTxBA"]}'
```

```json
{
  "api": "https://api.sb/leaseline.app",
  "agent": {
    "$id": "https://api.sb/leaseline.app/agents/agent_tCzKDMorKn",
    "$type": "Agent",
    "instructions": "Write as the property manager’s assistant. Never promise a rent the manager has not set.",
    "model": "claude-opus-5-5",
    "status": "seated",
    "skills": [
      "skill_xBqG4zTxBA"
    ]
  },
  "action": {
    "$id": "https://api.sb/leaseline.app/actions/act_br07HsG8MG",
    "operation": "Agent.update",
    "status": "done"
  },
  "links": {
    "self": "https://api.sb/leaseline.app/actions/act_br07HsG8MG"
  }
}
```

### Agent.delete
Deletes an Agent: a soft delete that keeps its history, undone by `Thing.restore`. [Verb page](/business/nouns/agent/delete?interface=api).

```text
DELETE /{namespace}/agents/{id}
```

Path: `id`. Emits `Agent.deleted`.

**Inputs**

| Input | Type | Required | Description |
| --- | --- | --- | --- |
| `id` | `string` | Yes | The id of the Agent. |

**Returns**

| Output | Type | Required | Description |
| --- | --- | --- | --- |
| `agent` | [Agent](/business/nouns/agent) | Yes | The Agent. |

**Refuses when**

| Check | Error | Fix | Then call |
| --- | --- | --- | --- |
| The key is valid, but its scopes do not allow this operation. | [`forbidden`](/code/api/errors/forbidden) | Use a key whose scopes cover the operation, or ask an owner of the namespace to grant them. | None. |

**Example**

```bash
curl -X DELETE https://api.sb/leaseline.app/agents/agent_tCzKDMorKn \
  -H "Authorization: Bearer $STARTUP_BUILDER_API_KEY"
```

```json
{
  "api": "https://api.sb/leaseline.app",
  "agent": {
    "$id": "https://api.sb/leaseline.app/agents/agent_tCzKDMorKn",
    "$type": "Agent",
    "instructions": "Write as the property manager’s assistant. Never promise a rent the manager has not set.",
    "model": "claude-opus-5-5",
    "status": "seated"
  },
  "action": {
    "$id": "https://api.sb/leaseline.app/actions/act_br07HsG8MG",
    "operation": "Agent.delete",
    "status": "done"
  },
  "links": {
    "self": "https://api.sb/leaseline.app/actions/act_br07HsG8MG"
  }
}
```