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

# Ask a human to help an Agent

> Request a handoff into the same Computer, let an authenticated human act in the Console, and resume only after re-observing the result.

Human assistance coordinates an Agent and a person working inside the same Computer. Use it when a person needs to solve a CAPTCHA, complete OAuth/2FA login, review a sensitive action, or make a judgment call.

The Agent requests assistance and passes the returned `dashboard_url` to the human. The human signs in to the Console, views the existing Desktop, takes control, completes the step, and returns control to the Agent.

> [!NOTE]
>
> Assistance is a **cooperative handoff**, not an OS-level input lock. Ordinary Desktop access stays available to the account owner, so the Agent must pause conflicting browser or desktop actions while waiting or while a human is active.

## Prerequisites

* The target Computer must belong to the Account and be `running`.
* Prepare the visible browser or application state first (Deepest does not automatically attach an arbitrary automation library to Chromium).
* **Agent side:** Authenticate with an Agent API Key (`assistance.request()` and `assistance.get()`).
* **Human side:** Must sign in to the same Account in the Web Console. Human-side signals (`begin`, `touch`, `complete`) require a current Human session—an Agent API Key cannot invoke them.

## Request assistance from the Agent

```js theme={null}
import { Deepest } from "@deepest/sdk";

const deepest = new Deepest({
  baseUrl: process.env.DEEPEST_API_URL,
  apiKey: process.env.DEEPEST_API_KEY,
});
const computer = deepest.computer(process.env.DEEPEST_COMPUTER_ID);

// Pause conflicting browser or desktop automation before requesting help.
const reply = await computer.assistance.request();
if (!reply.ok) {
  throw new Error(`${reply.error.code} (${reply.retry})`);
}
console.log({
  state: reply.result.state,
  assistance_id: reply.result.assistance_id,
  dashboard_url: reply.result.dashboard_url,
});
```

Expect `state: "waiting_human"`, an `assistance_id`, and a control-origin `dashboard_url`. Send that link and a concise description of what the human should do—never send an Account API Key or a raw runtime `viewer_url`.

Only one active assistance request exists per Computer. Calling `assistance.request()` again while one is active returns the existing request without extending its 1-hour lifetime.

## What the human does in the Console

**1. Open the Dashboard link**

The Console opens the Computer's assistance view (prompting for sign-in first if signed out) showing the initially read-only Desktop.

**2. Take control**

Click the picture or select **Take control** to begin (`assistance.begin`).

**3. Complete the step (and extend if needed)**

Perform the login, 2FA, or review. Select **Extend** when more active time is needed—ordinary keyboard typing and mouse clicks do not automatically renew the 120-second idle timer.

**4. Return to agent**

Select **Return to agent** (`assistance.complete`). The Console disables assistance input before handing control back. To keep using the Desktop manually outside an Agent handoff, select **Open Desktop**.

## States and timers

| State | Meaning | Agent behavior |
| - | - | - |
| `waiting_human` | Unexpired request awaits a human | Keep conflicting actions paused; send `dashboard_url` to the user |
| `human_active` | Human has started the handoff | Do not click, type, or drive the browser; poll at a reasonable interval |
| `agent` | No active assistance request | Re-observe the actual browser or application before resuming |

> [!WARNING]
>
> **Timers do not prove task success:**
>
> * A request expires **1 hour** after creation.
> * Active handoff automatically returns to `agent` **120 seconds** after `begin` or the latest accepted `touch` (triggered by **Extend** in the Console).
> * Computer Stop or a platform restart also clears temporary assistance state.
>
> Returning to `agent` never proves the user completed login, OAuth, or 2FA—always re-observe the page or ask the user.

## Observe and resume safely

Poll `assistance.get()` on a bounded interval (never a tight loop):

```js theme={null}
const current = await computer.assistance.get();
if (!current.ok) {
  throw new Error(`${current.error.code} (${current.retry})`);
}
if (current.result.state !== "agent") {
  console.log("Human handoff still active; keep conflicting work paused.");
} else {
  console.log("Control returned to agent; re-observe the application before continuing.");
}
```

Save the `assistance_id` you sent to the human; if a different ID appears, do not assume it is the same handoff. Before automating again, verify the current URL, signed-in account, and page state with your own inside-Guest observation tool—Deepest does not expose public screenshot, DOM, or CDP APIs.

## Human-session boundaries (Console vs. custom UI)

In standard workflows, the [Deepest Console](https://console.deepest.dev) connects the user's **Take control**, **Extend**, and **Return to agent** actions to `computer(id).assistance.begin`, `touch`, and `complete` under the user's live Human session.

If you build a custom authenticated Human UI using `@deepest/sdk` (`getSessionToken`), invoke `begin({ assistance_id })`, `touch({ assistance_id })`, and `complete({ assistance_id })` **only** in response to real human UI actions—never from an Agent Key, automated script, or synthetic keepalive timer. On an `UNKNOWN` write, call `assistance.get()` first rather than repeating `begin` or `complete` blindly.

## Lifecycle, security, and recovery

Closing a Viewer tab does not Stop the Computer or end an assistance request—Chromium and the Computer continue consuming Memory and shared CPU until explicitly stopped. The `assistance_id` locates context only; the Console still enforces Account sign-in, and runtime Viewer URLs cannot authenticate control API calls.

| Symptom | Recovery |
| - | - |
| Human sees login screen | Sign in to the owning Account; the deep link returns to the assistance view |
| `NOT_FOUND` or ended request | Call `assistance.get()`; do not reuse an expired or mismatched `assistance_id` |
| `UNAUTHORIZED` on `begin` / `touch` / `complete` | Requires a live Human session; an Agent API Key cannot invoke these endpoints |
| Handback occurred while user stepped away | Re-observe the page and send a new `assistance.request()` if still needed |
| Desktop failed to open | Check [Desktop overview](https://docs.deepest.dev/desktop/overview.md) and verify the Computer is `running` |
| `UNKNOWN` after a human action | Call `assistance.get()` before retrying |
| State is `agent` but task is incomplete | Inspect the actual application state or confirm with the human |

For exact schemas, see Desktop & Assistance in the [API Reference](https://docs.deepest.dev/api-reference.md). For ordinary visual access, see [Desktop overview](https://docs.deepest.dev/desktop/overview.md).


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.