Documentation Index
Fetch the complete documentation index at: https://docs.parallel.ai/llms.txt
Use this file to discover all available pages before exploring further.
For AI agents: a documentation index is available at https://docs.parallel.ai/llms.txt. The full text of all docs is at https://docs.parallel.ai/llms-full.txt. You may also fetch any page as Markdown by appending
The Parallel Task Group API enables you to batch process hundreds or thousands of Tasks efficiently. Instead of running Tasks one by one, you can organize them into groups, monitor their progress collectively, and retrieve results in bulk. The API is comprised of the following endpoints:
Creation: To run a batch of tasks in a group, you first need to create a task group, after which you can add runs to it, which will be queued and processed.
.md to its URL or sending Accept: text/markdown.POST /v1/tasks/groups(Create task-group)POST /v1/tasks/groups/{taskgroup_id}/runs(Add runs. Up to 1,000 runs per POST request.)
GET /{taskgroup_id} and GET /{taskgroup_id}/runs. Please note that the runs endpoint streams back the requested runs instantly (using SSE) to allow for large payloads without pagination, and it doesn’t wait for runs to complete. Runs in a task group are stored indefinitely, so unless you have high performance requirements, you may not need to keep your own state of the intermediate results. However, it’s recommended to still do so after the task group is completed.
GET /v1/tasks/groups/{taskgroup_id}(Get task-group summary)GET /v1/tasks/groups/{taskgroup_id}/runs(Fetch task group runs)
GET /{taskgroup_id}/events. To also retrieve the task run result upon completion you can use the task run endpoint
GET /v1/tasks/groups/{taskgroup_id}/events(Stream task-group events)GET /v1/tasks/runs/{run_id}/result(Get task-run result)
Key Concepts
Task Groups
A Task Group is a container that organizes multiple task runs. Each group has:- A unique
taskgroup_idfor identification - A status object with
is_active(boolean) andtask_run_status_counts(counts by status) - The ability to add new Tasks dynamically
Group Status
Track progress with real-time status updates:- Total number of task runs
- Count of runs by status (queued, running, completed, failed)
- Whether the group is still active (
is_activebecomesfalsewhen all runs finish) - Human-readable status messages
Quick Start
1. Define Types and Task Structure
2. Create a Task Group
3. Add Tasks to the Group
By default, the response refreshes and returns the latest status of all runs in the group. If you’re adding tasks at scale and don’t need a fresh status on each response, setrefresh_status to false for faster responses — the response will still include a cached status. You can retrieve the latest status at any time via the GET task-group endpoint.
4. Monitor Progress
5. Retrieve Results
ThegetRuns endpoint returns a Server-Sent Events stream, not a simple JSON response. It emits one event per run currently in the group (a snapshot of each run’s state), then closes. To pick up runs added after that snapshot, resume from the last event_id via the last_event_id parameter.
Each event in the stream has:
type: Either"task_run.state"or"error"event_id: Cursor for resuming the stream via thelast_event_idparameterrun: TheTaskRunobject withrun_id,status, andis_activeinput: The original input (only included wheninclude_input=true)output: The result output (only included wheninclude_output=trueand the run completed successfully)
/events endpoint shown below the getRuns examples.
Batch Processing Pattern
For large datasets, process Tasks in batches to optimize performance. Settingrefresh_status to false is recommended when adding tasks in bulk, as it skips refreshing the group status on each request for faster responses: