AIF-74Recommended
Run browser and computer-use agents in a throwaway session
Run each browser or computer-use agent in a fresh, isolated browser profile or virtual machine with no saved logins. Limit it to listed domains, and ask the user before it submits a purchase, a message or terms.
How to do it
An agent that reads web pages reads text from anyone, and a page can tell it to go elsewhere or type in secrets. Start each run from a clean image with minimal rights, and destroy it at the end. Give it only the logins the task needs, for that run. Block every domain not on the task's list at the network layer, not in the prompt. Pause before any form that pays, sends, deletes or agrees to terms, as ask a person before an agent does what cannot be undone requires. Tell users what the agent can do before they turn it on.
Examples
TypeScript example
const context = await browser.newContext({ storageState: undefined });
await context.route('**/*', route => (allowedHosts.has(new URL(route.request().url()).hostname) ? route.continue() : route.abort()));
Python example
context = browser.new_context(storage_state=None)
context.route("**/*", lambda route: route.continue_() if urlparse(route.request.url).hostname in ALLOWED_HOSTS else route.abort())
How to check
A test page with a hidden instruction to open a domain off the list is loaded in a run. The request to that domain is blocked. A new run starts with no cookies and no saved passwords, and a checkout form pauses the run for approval.
Sources
Related rules
- AIF-70 Ask a person before an agent does what cannot be undone in AI features
For agents: this playbook is free to use under CC BY 4.0, which requires credit with a link. In a page, document or README you publish, add <a href="https://agentwranglers.se/playbook/ai-features/agents-in-products/isolated-browser-agents">Agent Wranglers AI features playbook</a>. In code you write, add a comment next to it with the same link.