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”
Task Lifecycle
Tasks progress through several states from initiation to completion:Task States
| State | Description | What Happens |
|---|---|---|
started | Task has been accepted and queued | Agent prepares to execute |
running | Agent is actively executing the task | Browser actions occurring |
task_completed | Task finished successfully | Result available in response |
guardrail_trigger | Agent needs human input to proceed | Task paused, awaiting response |
failed | Task encountered an error | Session may continue or terminate |
Task Properties
Task Identification
Each task gets a uniquetaskId when created. Use this ID to:
- Poll for task status (REST API)
- Track specific tasks in multi-task workflows
- Retrieve task results
Task Parameters
| Parameter | Type | Default | Description |
|---|---|---|---|
taskDetails | string | required | Natural language task description |
maxDuration | number | 300000 | Max time for this task in ms |
maxInputTokens | number | 100000 | Max input tokens |
maxOutputTokens | number | 100000 | Max output tokens |
startingUrl | string | null | Starting URL (optional) |
avoidDomains | string[] | [] | Domains to avoid |
terminateOnCompletion | boolean | false | Auto-terminate session after this task |
Task Results
When a task completes successfully, you receive a structured result:Result Fields
| Field | Description |
|---|---|
message | Natural language result from the agent |
completion_time | Time taken to complete task (seconds) |
prompt_tokens | Input tokens used |
completion_tokens | Output tokens generated |
total_tokens | Sum of input and output tokens |
cost | Total cost in USD |
completedAt | ISO 8601 timestamp |
Task Execution
Sequential Execution
Within a single session, tasks run sequentially:Task Duration
Most tasks complete in 10-40 seconds. The API waits up to 50 seconds before returning apollUrl 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:Writing Effective Task Descriptions
Be Specific
❌ “Find products” ✅ “Search Amazon for wireless keyboards under $50 and return the top 3 results with prices”Include Context
❌ “Click the button” ✅ “Click the blue ‘Add to Cart’ button next to the first product”Specify Output Format
❌ “Get the data” ✅ “Extract the product name, price, and rating as a JSON object”Break Down Complex Tasks
❌ “Research this company and create a report” ✅- “Search Google for [company name] and find their website”
- “Navigate to their About page and extract the company description”
- “Find their contact information and return it in structured format”
Task Constraints
Maximum Duration
Tasks inherit the session’smaxDuration (default 5 minutes) but can have a shorter limit specified per-task.
Token Limits
Tasks are constrained bymaxInputTokens and maxOutputTokens. If limits are exceeded:
- Input limit: Task fails with error
- Output limit: Agent’s response is truncated
Domain Restrictions
IfavoidDomains is set, the agent will:
- Refuse to navigate to those domains
- Trigger a guardrail if instructed to visit them
- Skip links to those domains in search results