Skip to content

[FEAT] Add per-item options arrays for run() and runNoWait() in TypeScript SDK #3398

@Spid3rrr

Description

@Spid3rrr

Is your feature request related to a problem? Please describe.
When triggering workflows in bulk (array input), we often need different run options per item (mainly different additionalMetadata : taskId or topic or anything else that's helpful for dashboard filtering). The SDK should support this consistently for both run() and runNoWait() so bulk invocation remains ergonomic and predictable.

Describe the solution you'd like
Support per-item options arrays for both methods when input is an array:

  • run(input: I[], options: RunOpts[]): Promise<O[]>
  • runNoWait(input: I[], options: RunOpts[]): Promise<WorkflowRunRef<O>[]>

Expected behavior:

  • Map each options[i] to input[i].
  • Preserve existing shared-options behavior (options: RunOpts) for array input.
  • Throw a clear validation error if options.length !== input.length.
  • Keep current single-input behavior unchanged.

Describe alternatives you've considered

  • Using shared options for all items: insufficient when each item needs different metadata.
  • Looping and calling run()/runNoWait() one-by-one: adds boilerplate and can reduce batching ergonomics.
  • Packing execution options into input payload: mixes execution control with business input data.

Additional context
This is primarily an API consistency and developer-experience improvement for bulk runs.
Having the same per-item options model in both run() and runNoWait() reduces confusion and avoids requiring users to switch call patterns just to support heterogeneous run options.

I have a PR running locally that illustrates these changes. Let me know if you'd like me to open it to preview what the changes would look like.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions