agentafk
Configuration

Use a browser with AFK

Browse with isolated Playwright sessions, save a login in the session vault, or connect your own Chrome profile.

AFK's native browser_* tools use Playwright Chromium in an isolated context. Use them for ordinary web tasks, or save a browser login when an unattended run must access a signed-in site. Your regular Chrome profile is separate; connect it through Chrome DevTools MCP only when you want the agent to act inside your own browser.

Start browsing

Install the Playwright Chromium binary once with pnpm exec playwright install chromium in a source checkout, or use the install hint returned by browser_open if the browser binary is missing.
Start afk i and ask the agent to open a site. browser_open navigates, browser_observe returns actionable elements, and browser_act interacts with them.
Use browser_screenshot for visual inspection and browser_close when the session is done.

browser_act prefers visible text and ARIA roles. Use an element_id from the latest observation to disambiguate duplicate labels; IDs are not stable across observations. Domain restrictions configured with AFK_BROWSER_ALLOWED_DOMAINS and AFK_BROWSER_BLOCKED_DOMAINS also apply to navigation. The blocklist wins over the allowlist.

Save an authenticated session

Run afk browser login https://example.com/login --profile work from an interactive terminal. AFK opens a headed Playwright window.
Log in yourself in that window, then return to the terminal and press Enter. The command saves the browser's storage state in a profile vault and closes the window.
Set AFK_BROWSER_DEFAULT_PROFILE=work for later agent runs. Check available profiles with afk browser profiles.

Profiles contain cookies and tokens. Storage state is saved under AFK's state root with restrictive 0600 file permissions and restored when that profile is opened by the native browser tools. Established profiles are refreshed on close. An unset default profile starts fresh unless you previously saved a profile named default. Login requires a human; the agent does not silently create an authenticated vault. The login browser follows AFK's guarded egress policy. For an unattended run that needs a new login or human decision, the agent should stop, ask through the available elicitation channel, and notify rather than claim it authenticated on its own. See Unattended runs.

A saved browser profile is a credential. Do not commit, copy into a prompt, or share its storage state file. A login may expire and require another human login.

Use your own Chrome instead

afk browser connect registers chrome-devtools-mcp in your MCP config for a Chrome 144 or newer profile. Enable remote debugging at chrome://inspect/#remote-debugging, then accept Chrome's consent prompt when the agent connects. Run /mcp to inspect the connection. afk browser disconnect removes the registration. This path grants access to your real signed-in profile; use it only when intended. The native Playwright tools continue to use an isolated browser, not your Chrome profile.

Configuration and limitations

VariableEffect
AFK_BROWSER_HEADLESS=0Show a visible window for native browser tools. The default is headless.
AFK_BROWSER_DEFAULT_PROFILERestore a named saved vault profile.
AFK_BROWSER_ALLOWED_DOMAINSRestrict navigation to comma-separated host globs.
AFK_BROWSER_BLOCKED_DOMAINSRefuse matching host globs even if allowed.
AFK_BROWSER_DOM_SNAPSHOTS=1Save DOM snapshots with browser witness data.
AFK_BROWSER_CONFIGPoint to an alternate browser JSON configuration file.

Playwright is the only native browser backend. AFK_BROWSER_BACKEND=auto (the default) and playwright both choose Playwright. The old value agent-browser is accepted only for compatibility: it warns and resolves to Playwright, not to a second backend. Browser observations and screenshots are recorded as witness sidecars; password-shaped tool input is redacted from witness metadata, but the page receives what you entered.

On this page