Task Runs
Understanding how Tasks Runs are created, processed, and returned
Executing a Task Run
Task runs are stateful objects, which means that creating a Task Run and retrieving its results are separate calls to the API. Each Task Run is an independent instance that progresses through a series of states from queued
to completed
. This asynchronous design enables efficient scaling of web research operations.
Task Run States
Status | Description | Can Transition To |
---|---|---|
queued | Task created and waiting for processing | running , failed |
running | Task actively being processed | completed , failed |
completed | Task successfully completed with results available | (Terminal state) |
failed | Task encountered an error | (Terminal state) |
Note: Running time varies by processor type and task complexity.
Creating a Task Run
The basic requirements of a task run are:
- Input data (string or JSON object)
- A processor selection
- Output schema (optional but recommended)
Optionally, you can include:
- Input schema (optionally used to validate run input)
- Metadata (for tracking or organizing runs)
A Task Run, once created, can be identified by its run_id
. A Task Run Result can be accessed once the Task Run status becomes completed
.
Rate Limits
The Task API enforces a limit of 2,000 requests per minute per API key. This limit applies across all POST and GET requests and helps ensure consistent performance for all users.
When you exceed this limit, the API returns a 429 Too Many Requests
status code.
Examples
Completed Status Example
Failed Status Example
If a Task Run encounters an error, the status will be set to failed
and details will be available in the errors
field: