Skip to main content

What is a Task?

A task is a single objective for the AI agent to complete within a browser session. Each task is described in natural language and executed autonomously by the agent. Examples of tasks:
  • “Search Google for Anthropic and return the first result”
  • “Find the price of the wireless keyboard on this page”
  • “Fill out this form with the provided data and submit it”
  • “Navigate through the checkout flow and screenshot the payment page”
  • “Download the invoice from the billing portal and upload it to Google Drive”

Task Lifecycle

Tasks progress through several states from initiation to completion:

Task States


Task Patterns

There are two ways to execute tasks:

Pattern 1: Single Task (run-task)

For one-off tasks where you don’t need to maintain browser state. The session auto-terminates after completion.

Pattern 2: Multi-Task Session

For workflows requiring sequential tasks within the same browser context (e.g., login → navigate → extract). The session persists across tasks, preserving cookies, authentication, and page state.
For multi-task sessions, set terminateOnCompletion: true on your final task to avoid idle session charges.

Task Properties

Task Identification

Each task gets a unique taskId when created. Use this ID to:
  • Poll for task status (REST API)
  • Track specific tasks in multi-task workflows
  • Retrieve task results

Task Parameters


Example: Complete Task Flow

Here’s a practical example of sending a task and receiving the result: Request:
Response:

Task Results

When a task completes successfully, you receive a structured result:

Result Fields


Task Execution

Sequential Execution

Within a single session, tasks run sequentially:
You cannot run multiple tasks in parallel within the same session. For concurrent execution, use multiple sessions.

Task Duration

Most tasks complete in 10-40 seconds. The API waits up to 50 seconds before returning a pollUrl for longer tasks. Typical completion times:
  • Simple search/navigation: 10-20 seconds
  • Form filling: 20-40 seconds
  • Complex multi-step: 60-120 seconds

Task Dependencies

Tasks can build on previous state within a session. Use the send-message endpoint to add tasks to an existing session:
This is useful for multi-step workflows where each task depends on the previous one:
  1. Task 1: Log into the website → session now authenticated
  2. Task 2: Navigate to settings → page context preserved
  3. Task 3: Extract data → has access to authenticated page

Writing Effective Task Descriptions

Be Specific

Bad: “Find products” Good: “Search Amazon for wireless keyboards under $50 and return the top 3 results with prices”

Include Context

Bad: “Click the button” Good: “Click the blue ‘Add to Cart’ button next to the first product”

Specify Output Format

Bad: “Get the data” Good: “Extract the product name, price, and rating as a JSON object”

Break Down Complex Tasks

Bad: “Research this company and create a report” Good:
  1. “Search Google for [company name] and find their website”
  2. “Navigate to their About page and extract the company description”
  3. “Find their contact information and return it in structured format”

Task Constraints

Maximum Duration

Tasks can have a maxDuration limit specifying the maximum execution time (default and max: 5 minutes). Session inactivity timeout is separate and fixed at 5 minutes.

Token Limits

Tasks are constrained by maxInputTokens and maxOutputTokens. If limits are exceeded:
  • Input limit: Task fails with error
  • Output limit: Agent’s response is truncated

Domain Restrictions

Use automation policies with domain rules to control which websites the agent can visit. When a domain is blocked by policy, the agent will:
  • Refuse to navigate to those domains
  • Trigger a guardrail if configured to do so
  • Skip links to those domains in search results

Common Task Patterns

Research & Extraction

“Search for [topic] and return [specific data]“ “Go to [URL] and take a screenshot of [element]“

Form Filling

“Fill out the form with: Name=[value], Email=[value], then submit”

Verification

“Check if [condition] is true on [page]“

File Downloads & Uploads

“Download the CSV report from [site A] and upload it to [site B]“

Conditional Actions

“If [condition], then [action], otherwise [alternative action]“

Sending Tasks

How to create and send tasks

Task Polling

Poll for task results

Guardrails

When tasks need human input

Structured Output

Get structured data from tasks

Environments

Persist browser data and files across sessions

File Uploads

Upload files for the agent to use in sessions