Skip to main content

Session Parameters

Parameters used when creating a new session via POST /start/start-session.

environmentId

  • Type: string
  • Required: No
  • Default: null
  • Description: ID of an environment to attach to the session. When set, the browser loads the environment’s saved cookies, local storage, extensions, and other browser data before starting the task. Files stored in the environment are also available to the session. This maintains consistent browser state (e.g., login sessions) and persistent file access across multiple sessions.
Example:
Use profiles to skip login steps. Log in once with a profile attached, then reuse that profile for future sessions. The saved cookies keep you authenticated.

policyId

  • Type: string
  • Required: No
  • Default: null
  • Description: ID of an automation policy to enforce during the session. When set, every agent action is evaluated against the policy’s rules before execution. Actions can be allowed, blocked, or paused for human approval depending on the matching rule. Policies cover domain restrictions, keyword filters, action types, URL patterns, and sensitive data detection.
Example:
policyId is a top-level session parameter, alongside environmentId and proxy. A session can have a policy, an environment, both, or neither. See Automation Policies for details.

proxy

  • Type: object | null
  • Required: No
  • Default: null
  • Description: Proxy configuration for the session. Routes all browser traffic through the specified proxy server. The proxy is applied at the device level, ensuring no IP leakage. Adds 2-3 seconds of cold-start latency per session.
Two proxy sources are available: WebRun Proxy Fields: Custom Proxy Fields: Examples:
The proxy field is a top-level session parameter, alongside environmentId. It is not nested inside task. The proxy applies to the entire session. All tasks within the session use the same proxy.
See Proxies guide for use cases and best practices.

mode

  • Type: string
  • Required: No
  • Default: "default"
  • Description: Session mode. Currently only "default" is supported.
Example:

reachOutMode

  • Type: string, one of "off", "guardrail_only", "full"
  • Required: No
  • Default: "guardrail_only"
  • Description: Controls whether the chat-connected user (Telegram, WhatsApp, Slack, Discord, Teams) on the session’s environment receives proactive messages from this session. The chat user is only contacted when no client is actively watching the session (no polling or WebSocket subscriber). This is a top-level session parameter and applies for the lifetime of the session.
Allowed values: Validation: Invalid values return 400 Bad Request with the error message reachOutMode must be one of: off, guardrail_only, full. Example:
The mode is locked at session creation. To change the behavior, create a new session. See Routing Guardrails to a Chat User for the full flow.

task

  • Type: object
  • Required: No
  • Description: Configuration for the task to run when the session starts. Contains all task-specific parameters.
Example with structured_json:
Example with structured_csv:
All task-specific parameters like prompt, startingUrl, outputType, and outputSchema are now nested inside the task object.

Task Parameters

Parameters used inside the task object when creating a session, or in the message body when sending a new task via POST /start/send-message.

prompt

  • Type: string
  • Required: No
  • Default: ""
  • Description: Task description for the AI agent to execute.
Example:

startingUrl

  • Type: string
  • Required: No
  • Default: null
  • Description: URL where the browser should navigate before starting the task. Speeds up task execution by starting at the relevant page.
Example:
Setting a startingUrl eliminates the need to navigate from a blank page, reducing task execution time and cost.

maxDuration

  • Type: number (milliseconds)
  • Required: No
  • Default: 300000 (5 minutes)
  • Maximum: 300000 (5 minutes)
  • Description: Maximum time a task can run before automatic termination.
Example:
Tasks automatically terminate after maxDuration. Set this value based on your expected task completion time.

maxInputTokens

  • Type: number
  • Required: No
  • Default: 100000
  • Description: Maximum number of input tokens the AI can process. Limits context size to control costs.
Example:

maxOutputTokens

  • Type: number
  • Required: No
  • Default: 100000
  • Description: Maximum number of output tokens the AI can generate. Limits response size to control costs.
Example:

terminateOnCompletion

  • Type: boolean
  • Required: No
  • Default: false
  • Description: Whether to automatically terminate the session after the current task completes. Set to true to prevent idle session charges.
Example:
Cost Optimization: Set terminateOnCompletion: true on your last task to automatically close the session and prevent idle charges.

outputType

  • Type: string
  • Required: No
  • Default: "text"
  • Values: "text", "structured_json", "structured_csv"
  • Description: Specifies the output format.
Examples:
When using outputType: "structured_json" or "structured_csv", you must also provide an outputSchema to define the expected response structure.

outputSchema

  • Type: object (JSON Schema) or array (column names)
  • Required: No (required when outputType is "structured_json" or "structured_csv")
  • Description: Defines the expected response structure. The format depends on the outputType:
    • For structured_json: A JSON Schema object
    • For structured_csv: An array of column name strings
Example for structured_json:
Supported JSON Schema Types:
  • string - Text values
  • number - Numeric values (integers and decimals)
  • boolean - True/false values
  • object - Nested objects with defined properties
  • array - Arrays with defined item structure
Example for structured_csv:
The CSV output will include a header row with the specified column names, followed by data rows.
For JSON schemas, use "additionalProperties": false to ensure the output contains only the fields you specify.

secrets

  • Type: array
  • Required: No
  • Default: []
  • Description: Array of secret entries to provide credentials for websites the agent visits. Secrets are matched by domain pattern so the agent uses the right credentials for each site.
Secret Entry Structure: Example:
Secrets are never stored in a database or persisted anywhere. They are only attached to the active session and immediately discarded once the session is destroyed. Secrets are never included in task output or webhook payloads.
See Secrets guide for matching rules, custom fields, and best practices.

files

  • Type: string[] (array of file ID strings)
  • Required: No
  • Default: []
  • Description: Array of file IDs (returned from POST /files/upload) to attach to a task. The agent can use these files during browser automation, for example, uploading a document to a website form. This is a task-level parameter. Place it alongside prompt.
Example with /start/run-task:
Example with /start/start-session:
See File Uploads guide for the full upload workflow.

webhook

  • Type: object
  • Required: No
  • Description: Webhook configuration for receiving task completion notifications.
Webhook Object Structure: submittedData Options:
  • "ai_response" - The response from the AI (text, structured_json, or structured_csv), only the results/output from the LLM
  • "full_response" - Full body response that includes the usage info
  • "just_ping" - Just a ping notification, no data payload
Example:
Complete Example with Structured Output and Webhook:

Task Parameters

Parameters used when starting a new task via POST /start/send-message with actionType: "newTask". All Task Parameters are available, plus:

actionType

  • Type: string
  • Required: Yes
  • Values: "newTask", "state", "interaction", "guardrail"
  • Description: Type of action to perform on the session.
Example:

newState

  • Type: string
  • Required: Yes (for actionType: "newTask" and actionType: "state")
  • Values:
    • For tasks: "start"
    • For state control: "pause", "resume", "stop", "terminate"
  • Description: State change to apply.
Examples:

Message Parameters

Parameters used in the message field of POST /start/send-message.

For State Control (actionType: “state”)

Required Parameters:
  • actionType: "state"
  • newState: "pause" | "resume" | "stop" | "terminate"
Example:

For Manual Interaction (actionType: “interaction”)

Required Parameters:
  • actionType: "interaction"
  • action: Object containing interaction details
Action Object Structure:

takeOverControl / releaseControl

CLICK / DOUBLE_CLICK

Parameters:
  • x (number): Horizontal coordinate (0-1024)
  • y (number): Vertical coordinate (155-600, accounting for browser chrome)
Coordinate System: The browser viewport is 1024×600 pixels. The top 155 pixels are browser chrome (not clickable). Clickable area is 1024×445 pixels starting at Y=155.

TYPE

Parameters:
  • text (string, required): Text to type
  • humanLike (boolean, optional): Simulate human typing speed

KEY_PRESS

Parameters:
  • key (string, required): Key to press
Common Keys:
  • Enter
  • Escape
  • Tab
  • Backspace
  • ArrowUp, ArrowDown, ArrowLeft, ArrowRight

For Guardrail Response (actionType: “guardrail”)

Required Parameters:
  • actionType: "guardrail"
  • prompt: Human-provided information
  • newState: "resume"
Example:

Response Fields

Fields returned in API responses.

Session Response Fields

Returned from POST /start/start-session:

Task Response Fields

Returned from POST /start/send-message with actionType: "newTask" and POST /start/run-task: When task completes within 50 seconds: When task is still running after 50 seconds:

Poll Response Fields

Returned from GET /task/:sessionId/:taskId: While running: When completed: When guardrail triggered: When failed:

Usage Object Structure

The usage object provides token and cost information:
Example:

OpenAI-Compatible Parameters

Parameters for POST /v1/chat/completions.

model

  • Type: string
  • Required: Yes
  • Value: "webrun-browser-1"
  • Description: Model to use. Currently only webrun-browser-1 is available.

messages

  • Type: array of message objects
  • Required: Yes
  • Description: Array of conversation messages
Message Object Structure:
Example:

stream

  • Type: boolean
  • Required: No
  • Default: false
  • Description: Enable streaming responses via Server-Sent Events (SSE).

max_tokens

  • Type: number
  • Required: No
  • Default: 2000
  • Description: Maximum number of tokens in the response.

temperature

  • Type: number
  • Required: No
  • Description: Not used (included for OpenAI compatibility only). Task execution is deterministic.

Type Definitions

ActionType


StateType


InteractionType


OutputType


OutputSchema

For structured_json, use a JSON Schema object:
For structured_csv, use an array of column names:
Combined type:

WebhookConfig


SecretEntry


###TaskConfig

ProxyConfig


SessionConfig


TaskMessage


StateMessage


InteractionMessage


GuardrailMessage


Parameter Validation

Constraints