Browser ›
Get browser
GET
/v1/sandboxes/{id}/browserWhether the sandbox's browser is turned on to be driven from outside it, whether it is running, and where it is reached. It changes nothing, and is answered whatever state the sandbox is in.
RequestTypeScript
- import { Agental } from "agental-sdk";
- const agental = new Agental();
- const sandbox = await agental.sandboxes.get("sbx_2a9a47e50daec64a");
- const browser = await sandbox.browser.get();
Answer200 OK · BrowserState
- {
- "enabled": boolean,
- "enabledAt": string | null,
- "running": boolean,
- "headless": boolean | null,
- "cdpUrl": string | null,
- "localCdpUrl": string | null,
- }
Whether the browser is on, whether it has a window, and the address to drive it at while it runs.
Path
idrequiredstring | e.g. "sbx_0123456789abcdef" |
Headers
AuthorizationrequiredBearer key | An API key that may make this call. |
Returns
200 Whether the browser is on, whether it has a window, and the address to drive it at while it runs.
BrowserState6 fields
enabledboolean
Whether the browser is turned on for the sandbox.
More
It stays so through a stop and a start, and a move to another server: Chrome is started again by itself, with nothing open in it.enabledAtstringnull
Since when it is on.
More
Null when it is off.runningboolean
Whether Chrome is running in the sandbox's machine now and its DevTools answer.
More
False while it is off, while the sandbox is not running, in the moments after a start before it is up again, and while a Chrome that is on the desktop waits for the desktop to be turned on.headlessbooleannull
Whether Chrome has no window.
More
False when it is on the desktop, where it is watched as it is driven. Null while it is off.cdpUrlstringnull
Where Chrome's DevTools are reached from outside the sandbox, over a WebSocket: what Playwright's connectOverCDP, Puppeteer's connect, browser-use and Stagehand are given.
More
It needs no token and is hard to guess, and whoever has it has the whole browser, with what it is signed in to, so it is to be kept as a password is. It stays the same through a stop and a start, and is another each time the browser is turned on. Null while the browser is not running, and where GET /v1/policy says publicUrls is false.localCdpUrlstringnull
Where the same DevTools are reached from inside the sandbox, as by playwright-cli attach --cdp.
More
Null while the browser is off.Errors and other answers
| 404 | Not found. |
Every error answers { "error": { "code", "message" } }; a key without the action a call needs answers 403 key_action_forbidden, naming it.