To run perform-web-task asynchronously, set the async parameter to true in your request. The API will return immediately with a workflow_id that you can use to poll for results.
Copy
Ask AI
import Anchorbrowser from 'anchorbrowser';const anchorClient = new Anchorbrowser({apiKey: process.env.ANCHORBROWSER_API_KEY});// Start async taskconst response = await anchorClient.tools.performWebTask({prompt: 'Extract the main heading and first paragraph from the page',url: 'https://docs.anchorbrowser.io',async: true});console.log('Workflow ID:', response.data.workflow_id);console.log('Status:', response.data.status);
The async perform-web-task accepts the following parameters:
Parameter
Type
Required
Description
prompt
string
Yes
The task to be autonomously completed
url
string
No
The URL of the webpage. If not provided, the tool will use the current page in the session
sessionId
string
No
An optional browser session identifier to reference an existing running browser session. When passed, the tool will be executed on the provided browser session
async
boolean
No
Whether to run the task asynchronously. If true, the task will be run asynchronously and the response will include a workflow ID. Defaults to false
agent
string
No
The AI agent to use for task completion. Options: browser-use (default), openai-cua, gemini-computer-use, anthropic-cua
provider
string
No
The AI provider to use for task completion. Options: openai, gemini, groq, azure, xai
model
string
No
The specific model to use for task completion. See Available Models for more information
detect_elements
boolean
No
Enable element detection for better interaction accuracy. Improves the agent’s ability to identify and interact with UI elements
human_intervention
boolean
No
Allow human intervention during task execution. When enabled, the agent can request human input for ambiguous situations
max_steps
integer
No
Maximum number of steps the agent can take to complete the task. Defaults to 200
secret_values
object
No
Secret values to pass to the agent for secure credential handling. Keys and values are passed as environment variables to the agent
highlight_elements
boolean
No
Whether to highlight elements during task execution for better visibility
output_schema
object
No
JSON Schema defining the expected structure of the output data
COMPLETED: The workflow has completed. The result field contains the task output as a string.
The status will be COMPLETED even if the agent fails to complete the task, since the workflow execution itself succeeded. Always check the result field to verify whether the agent completed the task successfully or encountered an error.
FAILED: The workflow has failed. The error field contains the error message