Skip to main content
Once you’ve defined your workflow functions, you need to trigger them to begin execution. This is done using the start() function from workflow/api, which enqueues a new workflow run and returns a Run object that you can use to track its progress.

The start() Function

The start() function is used to programmatically trigger workflow executions from runtime contexts like API routes, Server Actions, or any server-side code.
Key Points:
  • start() returns immediately after enqueuing the workflow - it doesn’t wait for completion
  • The first argument is your workflow function
  • The second argument is an array of arguments to pass to the workflow (optional if the workflow takes no arguments)
  • All arguments must be serializable
Learn more: start() API Reference

The Run Object

When you call start(), it returns a Run object that provides access to the workflow’s status and results.
Key Properties:
  • runId - Unique identifier for this workflow run
  • status - Current status of the workflow (async)
  • returnValue - The value returned by the workflow function (async, blocks until completion)
  • readable - ReadableStream for streaming updates from the workflow
Most Run properties are async getters that return promises. You need to await them to get their values. For a complete list of properties and methods, see the API reference below.
Learn more: Run API Reference

Common Patterns

Fire and Forget

The most common pattern is to start a workflow and immediately return, letting it execute in the background:

Wait for Completion

If you need to wait for the workflow to complete before responding:
Be cautious when waiting for returnValue - if your workflow takes a long time, your API route may timeout.

Stream Updates to Client

Stream real-time updates from your workflow as it executes, without waiting for completion:
Your workflow can write to the stream using getWritable():
Streams are particularly useful for AI workflows where you want to show progress to users in real-time, or for long-running processes that produce intermediate results.
Learn more: Streaming in Workflows

Check Status Later

You can retrieve a workflow run later using its runId with getRun():

Next Steps

Now that you understand how to start workflows and track their execution: