This API is in beta and is accessible via the
/v1beta/tasks/groups
endpoint.POST /v1beta/tasks/groups(Create task-group)POST /v1beta/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 /v1beta/tasks/groups/{taskgroup_id}(Get task-group summary)GET /v1beta/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 /v1beta/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
4. Monitor Progress
5. Retrieve Results
ThegetRuns endpoint returns a Server-Sent Events stream, not a simple JSON response. Each event in the stream has:
type: Either"task_run.state"(a run reached a non-active status: completed, failed, or cancelled) 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)