To learn how to receive input stream data inside your tasks, see our Input
Streams documentation.
Sending data to a running task
Using defined input streams (Recommended)
The recommended approach is to use defined input streams for full type safety:.send() method is fully typed — the data parameter must match the generic type you defined on the input stream.
.send() works the same regardless of how the task is listening — whether it uses .wait()
(suspending), .once() (non-suspending), or .on() (continuous). The sender doesn’t need to know
how the task is consuming the data. See Input Streams for details on each
receiving method.Practical examples
Cancel from a Next.js API route
app/api/cancel/route.ts
Approval workflow API
app/api/approve/route.ts
Remix action handler
app/routes/api.approve.ts
Express handler
Sending from another task
You can send input stream data from one task to another running task:Error handling
The.send() method will throw if:
- The run has already completed, failed, or been canceled
- The payload exceeds the 1MB size limit
- The run ID is invalid
Important notes
- Maximum payload size per
.send()call is 1MB - You cannot send data to a completed, failed, or canceled run
- Data sent before a listener is registered inside the task is buffered and delivered when a listener attaches
- Input streams require Realtime Streams v2 (enabled by default in SDK 4.1.0+)

