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

# Ask a human

> Park an action until an operator approves or denies it

Put a human in the loop for risky steps: posting a payment, deleting a record, sending the message. `approval_request` parks until an operator resolves it (or `timeout_ms` elapses), and every request emits `approval_request` and `approval` events so a dashboard can surface the queue live.

CLI and cURL examples use `$RT` and browser `b1` ([Sessions](https://docs.gravixlayer.ai/documentation/agentruntime/browser-use/browser.md)).

## Park until a decision

`approval_request` returns `{approval_id, resolved, approved, note?}` — the
decision lands when `approval_resolve` fires with the same `approval_id`. An
unresolved request returns `resolved: false` when its timeout elapses, so the
agent can fall back or retry.

```python Python theme={null}
import threading
from gravixlayer import GravixLayer

client = GravixLayer()  # reads GRAVIXLAYER_API_KEY
sandbox = client.runtime.create(template="browser-small")
bid = sandbox.browser.open(url="https://example.com/cart")["browser_id"]

# Operator side — resolve as soon as the request lands (separate thread,
# separate lane; the parked request never blocks it)
def operator():
    r = sandbox.browser.approval_resolve(bid, "a1", approved=True, note="go")
    return r

# Agent side — parks until the resolve lands or 20 s pass
threading.Thread(target=operator, daemon=True).start()
decision = sandbox.browser.approval_request(bid, "Charge card ending 4242?", timeout_ms=20_000)
if decision["resolved"] and decision["approved"]:
    sandbox.browser.click(bid, "e9")  # place the order
sandbox.kill()
```

```typescript TypeScript theme={null}
import { GravixLayer } from 'gravixlayer';

const client = new GravixLayer();
const sandbox = await client.runtime.create({ template: 'browser-small' });
const bid = (await sandbox.browser.open({ url: 'https://example.com/cart' })).browserId;

// Agent request parks; the operator resolves from the same client —
// the parked request never blocks the resolve.
const decision = await Promise.all([
  sandbox.browser.approvalRequest(bid, 'Charge card ending 4242?', { timeoutMs: 20_000 }),
  sandbox.browser.approvalResolve(bid, 'a1', true, { note: 'go' }),
]).then(([d]) => d);

if (decision.resolved && decision.approved) {
  await sandbox.browser.click(bid, 'e9'); // place the order
}
await sandbox.kill();
```

```bash CLI theme={null}
# In one shell — parks until resolved or timeout
gravixlayer runtime browser approval-request "$RT" --browser b1 \
  "Charge card ending 4242?" --timeout-ms 20000

# In another — the operator's answer
gravixlayer runtime browser approval-resolve "$RT" --browser b1 a1
gravixlayer runtime browser approval-resolve "$RT" --browser b1 a2 --deny --note "not now"
```

```bash cURL theme={null}
API="https://api.gravixlayer.ai/v1"

curl -sS -X POST "$API/agents/runtime/$RT/browser/b1/approvals" \
  -H "Authorization: Bearer $GRAVIXLAYER_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"message": "Charge card ending 4242?", "timeout_ms": 20000}'

curl -sS -X POST "$API/agents/runtime/$RT/browser/b1/approvals/a1/resolve" \
  -H "Authorization: Bearer $GRAVIXLAYER_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"approved": true, "note": "go"}'
```

> [!NOTE]
>
> A parked approval never starves other calls on the same client — resolving, streaming events, and reading status all proceed while the request waits. Watch the `approval_request` event on the [events stream](https://docs.gravixlayer.ai/documentation/agentruntime/browser-use/events.md) to learn each request's `approval_id` the moment it parks.


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