Skip to main content
The Input Streams API allows you to send data into running Trigger.dev tasks from your backend code. This enables bidirectional communication — while output streams let you read data from tasks, input streams let you push data into them.
To learn how to receive input stream data inside your tasks, see Input Streams in the Streams doc.
Input streams are keyed by runId — they’re correct for sending data to a specific live run. If you need a bidirectional channel that survives run boundaries (e.g. a chat that resumes tomorrow, an agent coordinated across many runs), look at chat.agent: it’s built on a durable Session row that owns its runs and exposes the same consumer-side API (on / once / wait / waitWithIdleTimeout) on its .in channel.

Sending data to a running task

The recommended approach is to use defined input streams for full type safety:
The .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 the current streams implementation (v2 is the default in SDK 4.1.0+). See Streams for details.