Skip to main content
The cookie-sync skill copies cookies from your local Chrome into a Browserbase context. Your browser agent can reuse that context across cloud sessions instead of repeating a login flow on every run. Use it when you’re already signed in locally and want your agent to access the same site on Browserbase. You can filter cookies by domain and refresh an existing context when cookies expire.

Install

You need Node.js 22+, a Chromium-based browser with remote debugging enabled and at least one open tab, and BROWSERBASE_API_KEY in your environment.
Select your coding agent in the installer. Then ask your agent to run npm install in the installed cookie-sync directory to set up its script dependencies.

Sync an authenticated session

Sign in to the target site in the Chrome profile that exposes the debugging endpoint. If you launch Chrome with a separate --user-data-dir, sign in inside that profile first. Set CDP_URL if the skill can’t discover your debugging endpoint. Replace app.example.com with your site’s domain, then give your agent this prompt:
Your agent filters the cookies, creates or updates a context, and returns its ID. It then creates a session with that context and attaches the Browse CLI to the session’s connectUrl.
Cookie sync transfers cookies, not your entire browser profile. A site may require a fresh login or additional authentication state. Verify access before using the context in a scheduled job.

Refresh cookies

When a site signs you out, sign in locally again and ask your agent to refresh the same context:
The script accepts --domains for a comma-separated domain filter and --context for an existing context ID. Domain filters include subdomains. Later cloud sessions can reuse the context without your local Chrome running.

Troubleshooting

  • No DevTools endpoint: enable remote debugging in your Chromium browser and point CDP_URL at its debugging endpoint.
  • No open page targets: open a tab in that browser profile.
  • The site still requests a login: confirm that the local profile has valid cookies for the target domain, then refresh the context. Cookie sync doesn’t guarantee that a site will accept the session.

Further reading

Persistent contexts

Reuse cookies and browser state across sessions.

Skill source

View script options and browser setup instructions.