---
title: "updateAgent"
---

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

# updateAgent

Path: agenthold API › agents

`PATCH /agents/{agentId}`

URL: `/api/v1/agents/{agentId}`

Image and resource changes take effect after a rebuild (see `needsRebuild`).

## Authentication

Requires one of the following:

- `session`, apiKey, in cookie
- `token`, http bearer, header `Authorization`

## Path parameters

- `agentId` (`updateAgent.path.agentId`; string, required)

## Request body

_Required._

- `name` (`updateAgent.name`; string, optional)
  - maxLength: `100` · minLength: `1`
- `image` (`updateAgent.image`; string, optional)
- `cpus` (`updateAgent.cpus`; number, optional)
- `memoryMb` (`updateAgent.memoryMb`; integer, optional)
  - format: `int64`
- `idleMinutes` (`updateAgent.idleMinutes`; integer, optional)
  - maximum: `10080` · minimum: `1`
- `harness` (`updateAgent.harness`; string, optional) — Harness id (see /harnesses). Default claude-code.
- `model` (`updateAgent.model`; string, optional)
- `permissionPolicy` (`updateAgent.permissionPolicy`; string, optional)
  - one of `"auto-approve"`, `"ask"`

## Example request

```json
{
  "name": "string",
  "image": "string",
  "cpus": 0,
  "memoryMb": 0,
  "idleMinutes": 1,
  "harness": "string",
  "model": "string",
  "permissionPolicy": "auto-approve"
}
```

## Code samples

### cURL

```bash
curl --request PATCH \
  --url '<base-url>/api/v1/agents/<agentId>' \
  --header 'Content-Type: application/json' \
  --cookie 'agenthold_session=<agenthold_session>' \
  --data '
{
  "name": "string",
  "image": "string",
  "cpus": 0,
  "memoryMb": 0,
  "idleMinutes": 1,
  "harness": "string",
  "model": "string",
  "permissionPolicy": "auto-approve"
}
'
```

### TypeScript

```typescript
const url = '<base-url>/api/v1/agents/<agentId>';
const options = {
  method: 'PATCH',
  headers: {
    'Content-Type': 'application/json',
    cookie: 'agenthold_session=<agenthold_session>'
  },
  body: JSON.stringify({
    name: 'string',
    image: 'string',
    cpus: 0,
    memoryMb: 0,
    idleMinutes: 1,
    harness: 'string',
    model: 'string',
    permissionPolicy: 'auto-approve'
  })
};

fetch(url, options)
  .then(res => res.json())
  .then(json => console.log(json))
  .catch(err => console.error(err));
```

### Python

```python
import requests

url = "<base-url>/api/v1/agents/<agentId>"

payload = {
    "name": "string",
    "image": "string",
    "cpus": 0,
    "memoryMb": 0,
    "idleMinutes": 1,
    "harness": "string",
    "model": "string",
    "permissionPolicy": "auto-approve"
}
headers = {
    "cookie": "agenthold_session=<agenthold_session>",
    "Content-Type": "application/json"
}

response = requests.patch(url, json=payload, headers=headers)

print(response.text)
```

## Responses

### 200

Updated.

#### Example

```json
{
  "id": "string",
  "workspaceId": "string",
  "name": "string",
  "owner": {
    "id": "string",
    "email": "string",
    "name": "string",
    "avatarUrl": "string"
  },
  "image": "string",
  "harness": "string",
  "cpus": 0,
  "memoryMb": 0,
  "idleMinutes": 0,
  "state": "creating",
  "stateError": "string",
  "stateChangedAt": "2019-08-24T14:15:22Z",
  "needsRebuild": true,
  "model": "string",
  "permissionPolicy": "auto-approve",
  "credentialsInSandbox": true,
  "login": {
    "source": "account",
    "user": {
      "id": "string",
      "email": "string",
      "name": "string",
      "avatarUrl": "string"
    },
    "mine": true,
    "connected": true,
    "kind": "string",
    "status": "ok",
    "reason": "string"
  },
  "lastActivityAt": "2019-08-24T14:15:22Z",
  "sleepsAt": "2019-08-24T14:15:22Z",
  "role": "viewer",
  "createdAt": "2019-08-24T14:15:22Z",
  "updatedAt": "2019-08-24T14:15:22Z"
}
```

- `id` (`updateAgent.response.200.id`; string, required)
- `workspaceId` (`updateAgent.response.200.workspaceId`; string, required)
- `name` (`updateAgent.response.200.name`; string, required)
- `owner` (`updateAgent.response.200.owner`; object, required)
  - `id` (`updateAgent.response.200.owner.id`; string, required)
  - `email` (`updateAgent.response.200.owner.email`; string, required)
  - `name` (`updateAgent.response.200.owner.name`; string, required)
  - `avatarUrl` (`updateAgent.response.200.owner.avatarUrl`; string, required)
- `image` (`updateAgent.response.200.image`; string, required)
- `harness` (`updateAgent.response.200.harness`; string, required)
- `cpus` (`updateAgent.response.200.cpus`; number, required)
- `memoryMb` (`updateAgent.response.200.memoryMb`; integer, required)
  - format: `int64`
- `idleMinutes` (`updateAgent.response.200.idleMinutes`; integer, required)
- `state` (`updateAgent.response.200.state`; string, required)
  - one of `"creating"`, `"starting"`, `"running"`, `"stopping"`, `"sleeping"`, `"rebuilding"`, `"destroying"`, `"error"`
- `stateError` (`updateAgent.response.200.stateError`; string, required)
- `stateChangedAt` (`updateAgent.response.200.stateChangedAt`; string, required)
  - format: `date-time`
- `needsRebuild` (`updateAgent.response.200.needsRebuild`; boolean, required) — Image or resources changed since the sandbox was built.
- `model` (`updateAgent.response.200.model`; string, required)
- `permissionPolicy` (`updateAgent.response.200.permissionPolicy`; string, required)
  - one of `"auto-approve"`, `"ask"`
- `credentialsInSandbox` (`updateAgent.response.200.credentialsInSandbox`; boolean, required) — A harness login was completed inside the sandbox; the agent can read its own credentials.
- `login` (`updateAgent.response.200.login`; object, required) — Which login the agent's harness uses.
  - `source` (`updateAgent.response.200.login.source`; string, required) — account: the account login of `user`. secret: an API key secret attached to the agent wins. sandbox: whatever is signed in inside the sandbox. unsupported: the harness has no account logins.
    - one of `"account"`, `"secret"`, `"sandbox"`, `"unsupported"`
  - `mine` (`updateAgent.response.200.login.mine`; boolean, required) — You are that user.
  - `connected` (`updateAgent.response.200.login.connected`; boolean, required) — That user has connected a login for the agent's harness.
  - `user` (`updateAgent.response.200.login.user`; object, optional) — Whose account logins the agent uses.
    - `id` (`updateAgent.response.200.login.user.id`; string, required)
    - `email` (`updateAgent.response.200.login.user.email`; string, required)
    - `name` (`updateAgent.response.200.login.user.name`; string, required)
    - `avatarUrl` (`updateAgent.response.200.login.user.avatarUrl`; string, required)
  - `kind` (`updateAgent.response.200.login.kind`; string, optional) — How that login was connected.
  - `status` (`updateAgent.response.200.login.status`; string, optional)
    - one of `"ok"`, `"error"`
  - `reason` (`updateAgent.response.200.login.reason`; string, optional) — Why the account login is not used although a user is set.
- `role` (`updateAgent.response.200.role`; string, required)
  - one of `"viewer"`, `"operator"`, `"admin"`
- `createdAt` (`updateAgent.response.200.createdAt`; string, required)
  - format: `date-time`
- `updatedAt` (`updateAgent.response.200.updatedAt`; string, required)
  - format: `date-time`
- `lastActivityAt` (`updateAgent.response.200.lastActivityAt`; string, optional) — Last activity while running (prompts, terminals, files, CPU use in the sandbox).
  - format: `date-time`
- `sleepsAt` (`updateAgent.response.200.sleepsAt`; string, optional) — When the agent goes to sleep if nothing happens. Absent while busy or not running.
  - format: `date-time`

### 400

Error.

#### Example

```json
{
  "error": "string"
}
```

- `error` (`updateAgent.response.400.error`; string, required)

### 403

Error.

#### Example

```json
{
  "error": "string"
}
```

- `error` (`updateAgent.response.403.error`; string, required)

### 404

Error.

#### Example

```json
{
  "error": "string"
}
```

- `error` (`updateAgent.response.404.error`; string, required)


Source: https://agenthold.dev/api/agents/update/index.md
