web.agent() creates a model-backed browser agent. It returns final text, structured output, status, steps, artifacts, browser metadata, and bounded observations from Webcompute browser calls.
Signature
WebAgentConfig
Model config
modelApi accepts chat-completions or responses.
SDK web.agent() requires explicit model config. Running web model setup in the CLI configures the CLI profile store, not SDK application code.
The SDK exports model-profile helpers for applications that already have profile-shaped config:
parseWebAgentModelRoutenormalizeWebAgentModelProfileresolveWebAgentModelAccesswebAgentModelConfigForAccessinferWebAgentModelRoute
Browser config
browser.policy for the default navigation policy. Use browser.create when the agent should create its browser with browser-creation options such as proxy, maxDuration, recording, or a creation-time policy.
Run input
browserId to run against an existing browser. Use startUrl to create or navigate the run to a starting page. Existing-browser runs should use an agent without browser.policy or browser.create.policy; the explicit browser owns its policy.
browserId, your application owns lifecycle, policy, files, downloads, recordings, status, and cleanup around the agent run.
Result
transcript is included only when artifacts.retainTranscript is enabled.
Streaming
WebAgentStreamEvent types:
Sessions
Use sessions to run multiple goals against the same browser.Approvals and confirmations
Approval mode controls how the harness handles sensitive actions:
Approval risk values are exported as
WEB_AGENT_APPROVAL_RISK_VALUES:
auth, account_creation, sensitive_data, external_submit, payment, purchase, legal_acceptance, destructive, permission_change, captcha, file_upload, out_of_scope, ambiguous, unknown.
Variables and secrets
WebAgentVariable descriptors:
Structured output
outputSchema accepts:
Use
normalizeOutputSchema when you need the SDK’s schema normalization and validation behavior outside an agent run.
Code policy
WebAgentCodePolicy guides model-generated browser code: