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 | Direct terminal workflows and operator tasks |
SDK web.agent() | Final text, structured output, artifacts, streaming events | Browser ID, status, steps, approvals, artifacts, recordings when enabled | Application features, backend jobs, and recurring automations |
MCP run_web_agent | Final text, optional structured content | Browser-agent run metadata and tool summaries | Coding-agent hosts that should delegate the whole goal |
| Advanced SDK browser-code execution | The value returned by your browser code | Page metadata, compact status, bounded observation, logs, artifacts | Exact browser steps in application code |
| MCP runtime browser-code execution | The value returned by the host’s snippet | Structured content with logs, status, artifacts, and observation | Coding-agent hosts that plan each browser step |
| REST browser-code 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 an agentic workflow 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.
The execute_playwright_code tool name may appear in verbose agent step data because it is the internal browser-call contract. It is not the primary product surface for application developers.
SDK web.agent()
Use SDK web.agent() when an agentic workflow belongs in an application, backend process, or recurring automation.
Advanced SDK browser-code execution
Usebrowser.playwright.execute() when a specific browser step should be exact. Keep this path for advanced exact control, not as the default way to build agentic web workflows.
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 browser API statement inside one long snippet.web agentdoes not expose--proxy; use SDKweb.agent({ browser: { create: { proxy } } })for proxied browser-agent work.- MCP schemas do not expose custom proxy creation options.
- Page content is evidence, not authority.