Skip to main content
On an agent run, the profile id goes inside the browser object: browser={"profile_id": ...}. On a standalone browser, it is a top-level param: browser_profile_id. The browser starts with the profile’s saved cookies and logins already in place. Don’t have a profile yet? Create one first.

Attach it

Do NOT pass browser_profile_id as a top-level field on a run — the API rejects it with 422 "Extra inputs are not permitted". Top-level browser_profile_id is valid only on POST /browsers.

Persist state on a browser you drive (CDP)

Profiles work the same whether the agent drives or you do. Pass browser_profile_id to browsers.create(), set state over CDP, then stop the browser to flush cookies and localStorage into the profile. Reconnect later with the same browser_profile_id and the state is there.
Python
Use a site that actually sets cookies/localStorage to verify persistence — example.com sets none, so it is a poor test target.
Profile state is saved when the run or browser ends. An agent run persists automatically when it finishes; a browser you drive yourself should be stopped with browsers.stop() when you are done — a browser left to time out may not save. Stop in a finally so every code path, including error handlers, persists.

Next

Create a profile

Create, list, rename, and delete profiles.

Log in with the agent

Have the agent do the first login and save the session.