---
title: "listAgents"
---

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

# listAgents

Path: agenthold API › agents

`GET /workspaces/{workspaceId}/agents`

URL: `/api/v1/workspaces/{workspaceId}/agents`

Agents in the workspace that the caller can see.

## Authentication

Requires one of the following:

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

## Path parameters

- `workspaceId` (`listAgents.path.workspaceId`; string, required)

## Code samples

### cURL

```bash
curl --request GET \
  --url '<base-url>/api/v1/workspaces/<workspaceId>/agents' \
  --cookie 'agenthold_session=<agenthold_session>'
```

### TypeScript

```typescript
const url = '<base-url>/api/v1/workspaces/<workspaceId>/agents';
const options = {
  method: 'GET',
  headers: {cookie: 'agenthold_session=<agenthold_session>'}
};

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/workspaces/<workspaceId>/agents"

headers = {"cookie": "agenthold_session=<agenthold_session>"}

response = requests.get(url, headers=headers)

print(response.text)
```

## Responses

### 200

Agents.

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

### 404

Error.

#### Example

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

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


Source: https://agenthold.dev/api/list-agents/index.md
