This feature is currently in beta and requires the
parallel-beta: events-sse-2025-07-24
header when using the Task API.Overview
Task Runs support Server-Sent Events (SSE) at the run level, allowing you to receive real-time updates on ongoing research conducted by our processors during execution. For streaming events related to Task Groups, see the streaming endpoints on the Task Group API. Task Group events provide aggregate updates at the group level, while Task Run events represent updates for individual task runs. For a more comprehensive list of differences, see here.Enabling Events Streaming
To enable periodic event publishing for a task run, set theenable_events
flag to true
when creating the task run. If not specified, events may still be available, but frequent updates are not guaranteed.
Create a Task Run with events aggregation enabled explicitly:
/v1beta/tasks/runs/{run_id}/events
endpoint:
- All Task API processors starting from
pro
and above have event streaming enabled by default. - Event streams remain open for 570 seconds. After this period, the stream is closed.
Stream Behavior
When a stream is started, some earlier events are also re-sent in addition to new updates. This allows developers to build stateless applications more easily, since the API can be relied on without persisting every streamed update. It also supports scenarios where clients can disconnect and later reconnect without missing important events.For Running Tasks
When connecting to a stream for a task that is still running:- Complete reasoning trace: You receive all reasoning messages (
task_run.progress_msg.*
) from the beginning of the task execution, regardless of when you connect to the stream - Latest progress stats: You receive only the current aggregate state via
task_run.progress_stats
events, not historical progress snapshots - Real-time updates: As the task continues, you’ll receive new reasoning messages and updated progress statistics
- Final result: The stream concludes with a
task_run.state
event containing the complete task output when execution finishes
For Completed Tasks
When connecting to a stream for a task that has already completed:- Complete reasoning trace: You receive the full sequence of reasoning messages that occurred during the original execution
- Final progress stats: You receive the final aggregate statistics from when the task completed
- Immediate result: The stream ends with a
task_run.state
event that includes the complete task output in theoutput
field. This is useful so you don’t also need to use the result endpoint.
Reconnection Behavior
- Event streams are not resumable - there are no sequence numbers or cursors to resume from a specific point
- If you disconnect and reconnect to the same task:
- Running tasks: You get the complete reasoning trace again plus current progress stats
- Completed tasks: You get the same complete sequence as the first connection
-
Every connection starts with a
task_run.state
event indicating the current status
Supported Events
Currently, four types of events are supported:-
Run Status Events (
task_run.state
): Indicate the current status of the run. These are sent at the beginning of every stream and when the run transitions to a non-active status. -
Progress Statistics Events (
task_run.progress_stats
): Provide point-in-time updates on the number of sources considered and other aggregate statistics. Only the current state is provided, not historical snapshots. -
Message Events (
task_run.progress_msg.*
): Communicate reasoning at various stages of task run execution. The complete sequence from the beginning of execution is always provided. Note that this might not be available forlite
andbase
processors. -
Error Events (
error
): Report errors that occur during execution.
- Event streams always start with a status event and end with a status event (for completed tasks)
- The final status event for completed tasks always includes the complete output in the
output
field - Events within the reasoning trace maintain their original timestamps, allowing you to understand the execution timeline
- After the event has completed, reasoning traces may not get streamed anymore.
Differences Between Task Group Events and Task Run Events
Currently, the events returned by Task Groups is not a strict superset of events returned by Task Runs. See the list of differences below:Task Run Events | Task Group Events | |
---|---|---|
Purpose | Events for a single Task Run. | Events for an entire Task Group. |
Run-level events | Progress updates, messages, status changes. | Only run status changes. |
Resumable streams | No | Yes, using event_id . |
Events supported | Progress updates, messages, status changes for an individual run. | Group status and run terminations. |
Reasoning trace | Complete trace always provided when connecting. | Not available. |
Final results | Always included in final status event. | Available through separate API. |