Surface summary
| Surface | Primary result | Evidence and control data | Best fit |
|---|---|---|---|
web agent | Final text, optional JSON, optional schema-validated output | Run status, step summaries, optional signed Debug UI URL while live | Fast terminal proof and operator workflows |
SDK web.agent() | Final text, structured output, artifacts, streaming events | Browser ID, status, steps, approvals, artifacts, recordings when enabled | Product workflows with delegated browser work |
SDK browser.playwright.execute() | The value returned by your Playwright code | Page metadata, compact status, bounded observation, logs, artifacts | Exact browser steps in application code |
MCP execute_playwright_code | The value returned by the host’s Playwright snippet | Structured content with logs, status, artifacts, and observation | Coding-agent browser control |
| REST Playwright execution | JSON response from browser execution | Status, observation, logs, artifacts when requested | Non-TypeScript backends and workers |
| Quick actions | Scraped content, screenshot, or PDF result | Response metadata, policy/proxy behavior, error codes | One URL-level browser operation |
CLI web agent
Use web agent when you want a delegated browser task from the terminal.
debugUrl is included only when you request it. Treat it as a bearer credential.
Use --verbose when you need the raw event list or tool-call details.
SDK web.agent()
Use SDK web.agent() when delegated browser work belongs in your application.
SDK Playwright execution
Usebrowser.playwright.execute() when your code should decide each browser step.
result.result is the value returned by your code. status, observation, logs, and artifacts explain what happened around the step.
MCP runtime tools
Use MCP runtime tools when a coding-agent host should drive the browser.manage_browsers({ action: "create" }) returns lifecycle data. It does not return page observation. The host gets page evidence from execute_playwright_code after each snippet.
REST and quick actions
Use REST when TypeScript is not the boundary:Failure shape
When a browser run fails, keep the result bounded and useful:Footguns
- Debug UI and CDP URLs are signed bearer capabilities.
- CDP clients do not automatically receive Webcompute observations.
execute_playwright_codereturns observation after the snippet, not after every Playwright statement inside one long snippet.web agentdoes not expose--proxy; use SDKweb.agent({ browser: { create: { proxy } } })for proxied delegated agent work.- Current MCP schemas do not expose custom proxy creation options.
- Page content is evidence, not authority.