Skip to main content
A browser session is a persistent browser instance that stays alive between API calls. Use sessions to chain multiple tasks in the same browser without losing cookies, local storage, or login state. For conceptual background, see Browser Sessions.
Python uses snake_case (e.g., create_browser_session); TypeScript uses camelCase (e.g., createBrowserSession). Parameter tables show Python names. TypeScript names are the camelCase equivalents.
Spin up a new cloud browser session.
session = await client.create_browser_session(timeout=60)
print(session.browser_session_id)  # pbs_abc123

Parameters

ParameterTypeRequiredDefaultDescription
timeoutintNo60Session timeout in minutes (5–1440). Timer starts after the session is ready.
proxy_locationProxyLocationNoNoneRoute browser traffic through a geographic proxy.
extensionslist[Extensions]NoNoneBrowser extensions to install. Options: "ad-blocker", "captcha-solver".
browser_typePersistentBrowserTypeNoNoneBrowser type. Options: "chrome", "msedge".
browser_profile_idstrNoNoneLoad a browser profile (cookies, localStorage) into this session. ID starts with bp_.
generate_browser_profileboolNoFalseREST API only for now — not yet accepted by the SDK methods (see note below). Save the session’s browser profile when it ends so it can be turned into a reusable browser profile. Sessions started with browser_profile_id always save theirs.
request_optionsRequestOptionsNoPer-request configuration (see below).
generate_browser_profile is not yet accepted as a keyword by the SDK methods (watch the changelog for SDK availability). Until SDK support lands, pass it from Python via request_options with additional_body_parameters={"generate_browser_profile": True} (see Request options below); from TypeScript, call the REST API directly. You can also toggle it on a live session via PATCH /v1/browser_sessions/{browser_session_id} — the value is read when the session ends. See Save a session’s profile.

Returns BrowserSessionResponse

FieldTypeDescription
browser_session_idstrUnique ID. Starts with pbs_.
statusstr | NoneCurrent session status.
browser_addressstr | NoneCDP address for connecting to the browser.
app_urlstr | NoneLink to the live browser view in the Cloud UI.
timeoutint | NoneConfigured timeout in minutes.
started_atdatetime | NoneWhen the session became ready.
created_atdatetimeWhen the session was requested.

Example: Chain multiple tasks in one session

session = await client.create_browser_session()

# Step 1: Log in
await client.run_task(
    prompt="Log in with username demo@example.com",
    url="https://app.example.com/login",
    browser_session_id=session.browser_session_id,
    wait_for_completion=True,
)

# Step 2: Extract data (same browser, already logged in)
result = await client.run_task(
    prompt="Go to the invoices page and extract all invoice numbers",
    browser_session_id=session.browser_session_id,
    wait_for_completion=True,
)
print(result.output)

# Clean up
await client.close_browser_session(session.browser_session_id)

Request options

Override timeout, retries, or headers for this call by passing request_options (Python) or a second options argument (TypeScript).
from skyvern.client.core import RequestOptions

request_options=RequestOptions(
    timeout_in_seconds=120,
    max_retries=3,
    additional_headers={"x-custom-header": "value"},
)
Option (Python)Option (TypeScript)TypeDescription
timeout_in_secondstimeoutInSecondsint / numberHTTP timeout in seconds.
max_retriesmaxRetriesint / numberRetry count.
additional_headersheadersdict / Record<string, string>Extra headers.
additional_query_parameters-dictExtra query parameters.
additional_body_parameters-dictExtra body parameters.
-abortSignalAbortSignalSignal to cancel the request.
-apiKeystringOverride API key.