Session Strategy
The question: how do I keep a login and browser state alive across many pages and many tool calls?Preserve, don’t recreate
- Use ONE persistent profile per account (
webrain_session(op=login)). - Keep the session open across pages (
webrain_session(op=open)→ navigate → navigate → … → close). - Never discard a working profile/session — that is how you end up re-solving challenges.
Authenticate once
webrain launch <service> <profile> <url>(orwebrain_session(op=login)).- Log in (native login, vault + TOTP) or let the human complete a 2FA/approval gate in the headed browser.
- The profile now carries the session.
Reuse it
- Re-attach the authenticated Chrome:
CDP_URL=http://127.0.0.1:9222(orwebrain_session(op=open, cdp_url=...)). - Every subsequent navigate/extract shares the session.
Transfer to another engine
Export cookies on the live browser (webrain_session(op=cookies)), import on the
target connection (op=setcookies), then batch on that same connection. Or use
op=save_state / op=restore_state for portable cookies + localStorage.

