Declare a browser
Export a namedbrowser at the project root:
browser.ts
browser/ or sandbox/: those locations do not enable browser support.
|
idleTtlSeconds | 600 | Seconds of inactivity before the browser stops; accepts integers from 60 through 86400 |
Choose a scope
Thread scope starts each new conversation without another thread’s cookies or logins. For example, sign in to a web app with a test account, then reuse the tabs and login as you iterate on a change in the same thread. A separate app-testing conversation gets an isolated browser. Starting another thread does not delete the previous browser.
For user scope, change the declaration:
browser.ts
Restrict browser network access
A browser allow list restricts destinations and reduces the risk of sending data to unintended sites.Browser allow lists require
managed-deepagents>=0.10.4.browser.ts


Browser tools
Managed Deep Agents includes these tools automatically when a browser is defined:
Take a new snapshot after navigation or when element IDs become stale. Browsing and saving screenshots do not require an agent sandbox. Without a sandbox, screenshot files are saved in thread state, where the agent’s file tools can read them. Browser recordings require a sandbox.
Record a browser task
browser_record saves a video of the agent’s browser actions. Use it to show the steps of a task or demonstrate a UI change.
Browser recording requires
managed-deepagents version 0.10.0 or later and an agent sandbox to save the files.browser_record with action="start", performs the browser actions, then calls it with action="stop". The tool takes an optional absolute path, such as /workspace/recordings/demo.mp4, on either call.
The tool saves an H.264 MP4 and a JSON timeline alongside it. Without a path, it saves under /workspace/recordings/. The result includes the first and last frames.
Recordings use a 1280 × 800 viewport. Pauses between calls play for at most 1.5 seconds. Recording stops and saves when the run ends, when the agent hands the browser to a person, or after five minutes. It does not record the person’s actions during a handoff.
Hand off the browser
Human handoff lets you sign in or handle a page the agent cannot complete on its own. The agent callsbrowser_handoff(reason) to give you control of its thread’s browser window.
Custom clients must render the handoff artifact to provide the embedded browser or browser link.
To complete a login and return control:
- Ask the agent to perform the website task. If login, CAPTCHA, or two-factor authentication requires your input, the agent requests a handoff and explains why.
- Use the embedded browser or open the browser link supplied by your client. Studio shows a The agent needs you in the browser card with an embedded browser and an option to open it in a new tab. Enter credentials directly on the website, not in chat, and complete any required authentication steps.
- Click Hand back in the browser window when you are finished.
- The agent is notified that you handed control back. It inspects the current page to check whether login succeeded, then continues the task.

Animated browser handoff demo: sign in on the website, then hand control back to the agent.

Browser handoff in Studio, with Hacker News open and the Hand back control above the page.
Choose a browser per run
Setbrowser explicitly in a graph factory to choose the scope and idle timeout for a run:
agent.ts
browser=None in Python or browser: null in TypeScript. Pass a browser definition, not a middleware instance. Static agent definitions configure browser support in the declaration file instead.
See also
Connect these docs to your agent of choice via MCP for real-time answers.

