> ## 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.

# Record a tab

> Capture a tab as video and export the artifact

Record a single tab to video — an audit trail of what the agent saw — while the run keeps going. Recording rides the tab's screencast feed, so it works headless or headed and never steals frames from snapshots.

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

## Start and stop

`recording_start(target_id)` begins a per-tab screencast and returns
`{recording_id, path, started}` — optional `fps` and `quality` tune the feed.
`recording_stop(target_id)` finalizes it to an `.fmp4` artifact inside the
runtime. `recording_export` copies a finished artifact to any workspace
directory you choose and returns `{paths, bytes}` — grab it from there with
`runtime.files.download`.

```python Python theme={null}
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")["browser_id"]
tab = sandbox.browser.targets(bid)["target_id"]

rec = sandbox.browser.recording_start(bid, tab)
sandbox.browser.click(bid, "e2")            # work happens on camera
sandbox.browser.recording_stop(bid, tab)

sandbox.browser.recording_export(bid, rec["recording_id"], "/workspace/out")
print(sandbox.files.list("/workspace/out"))  # …fmp4
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' })).browserId;
const tab = (await sandbox.browser.targets(bid)).targetId;

const rec = await sandbox.browser.recordingStart(bid, tab);
await sandbox.browser.click(bid, 'e2'); // work happens on camera
await sandbox.browser.recordingStop(bid, tab);

await sandbox.browser.recordingExport(bid, rec.recording_id as string, '/workspace/out');
console.log(await sandbox.files.list('/workspace/out'));
await sandbox.kill();
```

```bash CLI theme={null}
gravixlayer runtime browser recording-start "$RT" --browser b1 --tab t1
# → {"recording_id": "tr-1", …}

gravixlayer runtime browser recording-stop "$RT" --browser b1 --tab t1

gravixlayer runtime browser recording-export "$RT" --browser b1 \
  tr-1 /workspace/out
```

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

curl -sS -X POST "$API/agents/runtime/$RT/browser/b1/targets/t1/recording/start" \
  -H "Authorization: Bearer $GRAVIXLAYER_API_KEY" \
  -H "Content-Type: application/json" -d '{}'

curl -sS -X POST "$API/agents/runtime/$RT/browser/b1/targets/t1/recording/stop" \
  -H "Authorization: Bearer $GRAVIXLAYER_API_KEY" \
  -H "Content-Type: application/json" -d '{}'

curl -sS -X POST "$API/agents/runtime/$RT/browser/b1/recordings/export" \
  -H "Authorization: Bearer $GRAVIXLAYER_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"recording_id": "tr-1", "dest_dir": "/workspace/out"}'
```

> [!NOTE]
>
> This records the **page**, not the desktop — for the whole screen use `desktop` [recording](https://docs.gravixlayer.ai/documentation/agentruntime/computer-use/recording.md). Both write artifacts into the guest filesystem; export paths are confined to the workspace.


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