Creating Tasks
Create a new task using thecreateTask
method:
Task Options
task
(required): Natural language description of what you want to automateagent
(optional): Agent to use (defaults to'BROWSER_AGENT'
)
Listing Tasks
Get a list of all your tasks with pagination support:Managing Task Runs
List Task Runs
Get all runs for a specific task:Check Run Status
Monitor the status of a task run:Get Run Results
Retrieve the results of a completed run:Wait for Run Completion
Wait for a task run to complete while monitoring its status:- Poll the task status at regular intervals
- Provide status updates through the
onStatusChange
callback - Automatically handle completion and error states
- Return the final result when the task completes
- Throw an error if the task times out or fails
Get Run GIF
Get the GIF recording of a task run. The GIF is automatically generated from browser screenshots taken during task execution:pending
: GIF is being generatedcompleted
: GIF is ready and can be accessed via theurl
fielderror
: GIF generation failed, check theerror
field for details
Stopping Tasks
Stop a Task Run
Stop a specific run of a task:Stop a Task
Stop a task from running future executions:Error Handling
All methods return anApiResponse
object with the following structure:
Best Practices
- Task Description: Write clear, specific task descriptions
- Status Monitoring: Regularly check task status for long-running tasks
- Error Handling: Always handle errors and edge cases
- Resource Management: Stop unused tasks to free up resources
- Pagination: Use pagination for listing tasks and runs to manage large datasets