# Workspace API

> Each user's cloud computer, with a browser, desktop and shell, that the assistant uses for sites and apps without an API. When the assistant needs the user, for example to sign in, it opens a handoff, and the user takes over the live browser and hands it back.

Part of the AGNT API reference. AGNT (https://agnt.ai) is the developer platform behind OpenAssistant (https://openassistant.us). Docs index: https://agnt.ai/llms.txt. Web page: https://agnt.ai/reference/api/workspace

Base URL: `https://api.agnt.ai`. Auth: `Authorization: Bearer ak_live_...`.

## POST /workspace/cleanup

Clean up the workspace

Clears temporary files and download caches on the user's workspace without touching the user's own files. With `scope: "sites"`, it also removes local working copies of the user's sites, which are restored when next needed.

Acts as one user: send `X-User-Email`.

**Request body** (JSON)

- `scope` (enum) One of: `cache`, `sites`.

**Responses**

- `200`: Cleanup result
  - `ok` (boolean, required)
  - `scope` (string)
- `403`: No end user on the call

```bash
curl 'https://api.agnt.ai/workspace/cleanup' \
  -X POST \
  -H "Authorization: Bearer ak_live_..." \
  -H "X-User-Email: user@example.com" \
  -H "Content-Type: application/json" \
  -d '{
  "scope": "cache"
}'
```

Example response:

```json
{
  "ok": true
}
```

## GET /workspace/handoff/active

List open handoffs

Returns every open request for the user to take over their workspace, oldest first, plus the newest on its own.

Acts as one user: send `X-User-Email`.

**Responses**

- `200`: Open handoffs
  - `ok` (boolean, required)
  - `handoffs` (object[], required)
    - `id` (string)
    - `taskId` (string | null): Task waiting on it; null for a session the user opened
    - `actionType` (enum) One of: `login`, `payment`, `form_fill`, `mfa`, `other`.
    - `prompt` (string): What the assistant asks the user to do
    - `targetUrl` (string)
    - `screenshotUrl` (string)
    - `status` (enum) One of: `pending`, `starting`, `ready`, `active`.
    - `expiresAt` (string)
    - `createdAt` (string)
  - `handoff` (object | null): Newest open handoff
- `403`: No end user on the call

```bash
curl 'https://api.agnt.ai/workspace/handoff/active' \
  -H "Authorization: Bearer ak_live_..." \
  -H "X-User-Email: user@example.com"
```

Example response:

```json
{
  "ok": true,
  "handoffs": [
    {
      "id": "6660c4a1f2e3b7d8a9c01234",
      "taskId": "6660c4a1f2e3b7d8a9c01234",
      "actionType": "login",
      "prompt": "prompt"
    }
  ]
}
```

## POST /workspace/handoff/launch

Open the workspace

Starts a handoff in which the user uses their workspace directly. The workspace starts in the background: poll the open handoffs until this one is ready, then start the live session.

Acts as one user: send `X-User-Email`.

**Responses**

- `200`: Started
  - `ok` (boolean, required)
  - `handoffId` (string, required)
  - `status` (enum, required) One of: `starting`.
- `403`: No end user on the call

```bash
curl 'https://api.agnt.ai/workspace/handoff/launch' \
  -X POST \
  -H "Authorization: Bearer ak_live_..." \
  -H "X-User-Email: user@example.com"
```

Example response:

```json
{
  "ok": true,
  "handoffId": "6660c4a1f2e3b7d8a9c01234",
  "status": "starting"
}
```

## POST /workspace/handoff/{handoffId}/session

Start a live session

Starts the computer if needed and returns a one-time link to a live view of it. The assistant cannot use the computer while the user has it. Each call issues a new link.

Acts as one user: send `X-User-Email`.

**Path parameters**

- `handoffId` (string, required)

**Request body** (JSON)


**Responses**

- `200`: Session link
  - `ok` (boolean, required)
  - `sessionUrl` (string, required): One-time link to the live session
  - `control` (object)
    - `generation` (integer)
    - `handoffId` (string)
    - `operator` (enum) One of: `user`, `agent`, `unknown`.
- `400`: Handoff is no longer open
- `403`: Not this user's handoff
- `404`: Handoff not found
- `409`: Control of the computer changed; refresh and retry

```bash
curl 'https://api.agnt.ai/workspace/handoff/<handoffId>/session' \
  -X POST \
  -H "Authorization: Bearer ak_live_..." \
  -H "X-User-Email: user@example.com" \
  -H "Content-Type: application/json" \
  -d '{}'
```

Example response:

```json
{
  "ok": true,
  "sessionUrl": "https://harborview.co"
}
```

## POST /workspace/handoff/{handoffId}/complete

Complete a handoff

Tells the assistant the user finished the step. Control returns to the assistant, and the waiting task continues.

Acts as one user: send `X-User-Email`.

**Path parameters**

- `handoffId` (string, required)

**Request body** (JSON)


**Responses**

- `200`: Completed
  - `ok` (boolean, required)
  - `taskId` (string | null)
- `400`: Session is not open
- `403`: Not this user's handoff
- `404`: Session expired or not found
- `409`: Control of the computer changed; refresh and retry

```bash
curl 'https://api.agnt.ai/workspace/handoff/<handoffId>/complete' \
  -X POST \
  -H "Authorization: Bearer ak_live_..." \
  -H "X-User-Email: user@example.com" \
  -H "Content-Type: application/json" \
  -d '{}'
```

Example response:

```json
{
  "ok": true
}
```

## POST /workspace/handoff/{handoffId}/defer

Defer a handoff

Closes the request because the user cannot do the step now. The computer returns to the assistant, which receives the message and suggested time and decides when to ask again.

Acts as one user: send `X-User-Email`.

**Path parameters**

- `handoffId` (string, required)

**Request body** (JSON)

- `message` (string, required): Message to the assistant, such as "after 5pm"
- `deferMinutes` (integer): Optional: minutes from now to try again

**Responses**

- `200`: Deferred
  - `ok` (boolean, required)
  - `deferredUntil` (string | null)
- `400`: Invalid body or handoff already closed
- `403`: Not this user's handoff
- `404`: Handoff not found
- `409`: Control of the computer changed; refresh and retry

```bash
curl 'https://api.agnt.ai/workspace/handoff/<handoffId>/defer' \
  -X POST \
  -H "Authorization: Bearer ak_live_..." \
  -H "X-User-Email: user@example.com" \
  -H "Content-Type: application/json" \
  -d '{
  "message": "Prefers morning meetings."
}'
```

Example response:

```json
{
  "ok": true
}
```

## POST /workspace/handoff/{handoffId}/decline

Decline a handoff

Closes the request because the user refuses. The computer returns to the assistant, which finds another way or reports that it cannot continue. It does not ask again for this task for a while.

Acts as one user: send `X-User-Email`.

**Path parameters**

- `handoffId` (string, required)

**Request body** (JSON)


**Responses**

- `200`: Declined
  - `ok` (boolean, required)
  - `taskId` (string | null)
- `400`: Handoff already closed
- `403`: Not this user's handoff
- `404`: Handoff not found
- `409`: Control of the computer changed; refresh and retry

```bash
curl 'https://api.agnt.ai/workspace/handoff/<handoffId>/decline' \
  -X POST \
  -H "Authorization: Bearer ak_live_..." \
  -H "X-User-Email: user@example.com" \
  -H "Content-Type: application/json" \
  -d '{}'
```

Example response:

```json
{
  "ok": true
}
```

## POST /workspace/handoff/resolve

Resolve handoffs

Ends the user's turn and reports, for each request, whether it was done, refused or left for later. Completed requests let their tasks continue; pending ones stay open. Ids that are not the user's are skipped.

Acts as one user: send `X-User-Email`.

**Request body** (JSON)

- `items` (object[], required)
  - `handoffId` (string, required)
  - `outcome` (enum, required) One of: `completed`, `declined`, `pending`.
  - `note` (string)

**Responses**

- `200`: Closed requests
  - `ok` (boolean, required)
  - `resolved` (object[], required)
    - `handoffId` (string)
    - `outcome` (enum) One of: `completed`, `declined`.
- `400`: Invalid body
- `409`: Control of the computer changed; refresh and retry

```bash
curl 'https://api.agnt.ai/workspace/handoff/resolve' \
  -X POST \
  -H "Authorization: Bearer ak_live_..." \
  -H "X-User-Email: user@example.com" \
  -H "Content-Type: application/json" \
  -d '{
  "items": [
    {
      "handoffId": "6660c4a1f2e3b7d8a9c01234",
      "outcome": "completed"
    }
  ]
}'
```

Example response:

```json
{
  "ok": true,
  "resolved": [
    {
      "handoffId": "6660c4a1f2e3b7d8a9c01234",
      "outcome": "completed"
    }
  ]
}
```

## GET /workspace/profile

Retrieve workspace usage

Returns rolling usage figures for the user's workspace. `profile` is `null` until the workspace has run.

Acts as one user: send `X-User-Email`.

**Responses**

- `200`: Profile
  - `ok` (boolean)
  - `profile` (object | null)
    - `lastActiveAt` (string | null)
    - `updatedAt` (string | null)
    - `peakMemoryBytes` (number): Highest memory use in the last 24 hours
    - `avgMemoryBytes` (number)
    - `memoryLimitBytes` (number)
    - `currentDiskBytes` (number)
    - `diskQuotaBytes` (number)
    - `avgCpuLoadAvg` (number)
    - `totalActiveMinutes` (number)
    - `topMcpSlugs` (string[]): Most-used connected tool servers

```bash
curl 'https://api.agnt.ai/workspace/profile' \
  -H "Authorization: Bearer ak_live_..." \
  -H "X-User-Email: user@example.com"
```

Example response:

```json
{
  "ok": true,
  "profile": {
    "lastActiveAt": "2026-10-15T14:30:00Z",
    "updatedAt": "2026-10-15T14:30:00Z",
    "peakMemoryBytes": 1,
    "avgMemoryBytes": 1
  }
}
```

## GET /workspace/snapshots

List workspace usage snapshots

Returns point-in-time usage, oldest first, taken at most every 5 minutes while the computer runs and kept for 30 days.

Acts as one user: send `X-User-Email`.

**Query parameters**

- `limit` (integer)

**Responses**

- `200`: Snapshots
  - `ok` (boolean)
  - `snapshots` (object[])
    - `timestamp` (string)
    - `memoryUsedBytes` (number | null)
    - `memoryTotalBytes` (number | null)
    - `diskUsedBytes` (number | null)
    - `diskQuotaBytes` (number | null)
    - `cpuLoadAvg` (number | null): One-minute load average
    - `activeMcpSlugs` (string[]): Connected tool servers running
    - `containerUptime` (number | null): Seconds

```bash
curl 'https://api.agnt.ai/workspace/snapshots' \
  -H "Authorization: Bearer ak_live_..." \
  -H "X-User-Email: user@example.com"
```

Example response:

```json
{
  "ok": true,
  "snapshots": [
    {
      "timestamp": "2026-10-15T14:30:00Z",
      "memoryUsedBytes": 1,
      "memoryTotalBytes": 1,
      "diskUsedBytes": 1
    }
  ]
}
```

## GET /workspace/watch

Watch a task's browser

Returns a still image of the browser tab the assistant is using for one of the user's tasks. It does not take control or start the computer; poll it for a live view. Returns `available: false` when there is nothing to show.

Acts as one user: send `X-User-Email`.

**Query parameters**

- `taskId` (string, required)

**Responses**

- `200`: Frame, or available false
  - `available` (boolean)
  - `reason` (enum): Set when available is false One of: `watch_unavailable`.
  - `taskId` (string)
  - `capturedAt` (string)
  - `width` (integer)
  - `height` (integer)
  - `pngBase64` (string): PNG image, base64
  - `sequence` (integer): Increases with each new frame
- `400`: Invalid taskId

```bash
curl 'https://api.agnt.ai/workspace/watch?taskId=' \
  -H "Authorization: Bearer ak_live_..." \
  -H "X-User-Email: user@example.com"
```

Example response:

```json
{
  "available": true,
  "reason": "watch_unavailable",
  "taskId": "6660c4a1f2e3b7d8a9c01234",
  "capturedAt": "2026-10-15T14:30:00Z"
}
```
