Overview
Multi-task workflows allow you to reuse a single browser session for multiple sequential tasks. This is more efficient than creating a new session for each task, as the browser state persists between tasks. When to use:- Multiple related tasks on the same website
- Workflows that build on previous actions (e.g., login → search → checkout)
- Scenarios where maintaining browser state (cookies, local storage) is important
- Single, isolated tasks (use
/start/run-taskinstead) - Unrelated tasks across different websites
Creating Persistent Sessions
Use the/start/start-session endpoint to create a session that remains active for multiple tasks.
Save the
sessionId from the response: you’ll need it for all follow-up tasks.Sending Follow-Up Tasks
After creating a session, send additional tasks using the/start/send-message endpoint with actionType: "newTask".
Complete Working Example
This example demonstrates a complete multi-task workflow: creating a session, sending multiple tasks, polling for results, and terminating the session.Single vs Multi-Task Comparison
Use /start/run-task for Single Tasks
When you only need to execute one task and don’t need session persistence:
- Session automatically terminates when task completes
- No need to manage
sessionId terminateOnCompletion: trueis set automatically- More cost-effective for isolated tasks
Use /start/start-session for Multi-Task Workflows
When you need to:
- Execute multiple related tasks
- Maintain browser state between tasks
- Potentially interact manually between tasks
- Have control over session lifecycle
Session Parameters
Configure your session behavior with these parameters: Top-level parameters:
task parameters:
Example with parameters:
maxDurationis the max task duration (default and max: 5 minutes). Session inactivity timeout is fixed at 5 minutespromptcan be empty if you plan to send tasks later via/start/send-message- Always terminate sessions when done to avoid unnecessary charges
Best Practices
1. Always Terminate Sessions
Don’t forget to terminate sessions when your workflow completes:terminateOnCompletion on your final task: