provider task-runstaskstasks GET
/api/projects/{project_id}/tasks/{task_id}/runs/{id}/stream/ @utdk/posthog
/api/projects/{project_id}/tasks/{task_id}/runs/{id}/stream/ tasks_runs_stream_retrieve
Server-Sent Events stream of task run events. Events carry an `id:` line (a Redis stream id) usable as a resume cursor.
The server caps each connection at 900 seconds: it emits `event: end` with `data: {"type": "rotated"}` and closes. This does NOT mean the run finished — reconnect with the `Last-Event-ID` header set to the last received event id to resume without gaps or duplicates. Only treat the stream as complete when the run itself reaches a terminal status.
`?start=latest` consumers must also carry `Last-Event-ID` across reconnects: reconnecting without it re-resolves to the then-current latest event, silently skipping anything published while disconnected.
**SDK consumers**: do not call the generated fetch wrapper for this path — it will buffer the entire stream. Use the URL builder (`getTasksRunsStreamRetrieveUrl`) with a streaming `fetch`/`EventSource`-style consumer and the `Last-Event-ID` header instead.
- Last-Event-ID header
- Resume cursor: the `id:` of the last event received on a previous connection. Events strictly after it are delivered.
- string
- id path required
- string
- project_id path required
- Project ID of the project you're trying to access. To find the ID of the project, make a call to /api/projects/.
- string
- start query
- Set to `latest` to skip the event backlog and only receive events published after connecting.
- string
- task_id path required
- string
Try it
Authentication
Configure credentials for PostHog API
Code snippet
Updates live as you fill in the form above.
TypeScript
import posthog from '@utdk/posthog';
await posthog.tasksRunsStreamRetrieve()