# Run.stream()
[EN] Source: https://mastra.ai/reference/streaming/workflows/stream

The `.stream()` method allows you to monitor the execution of a workflow run, providing real-time updates on the status of steps.

## Usage example

```typescript showLineNumbers copy
const run = await workflow.createRunAsync();

const { stream } = await run.stream({
  inputData: {
    value: "initial data",
  },
});
```

## Parameters

<PropertiesTable
  content={[
    {
      name: "inputData",
      type: "z.infer<TInput>",
      description: "Input data that matches the workflow's input schema",
      isOptional: true,
    },
    {
      name: "runtimeContext",
      type: "RuntimeContext",
      description: "Request Context data to use during workflow execution",
      isOptional: true,
    },
    {
      name: "tracingContext",
      type: "TracingContext",
      isOptional: true,
      description:
        "AI tracing context for creating child spans and adding metadata. Automatically injected when using Mastra's tracing system.",
      properties: [
        {
          parameters: [
            {
              name: "currentSpan",
              type: "AISpan",
              isOptional: true,
              description:
                "Current AI span for creating child spans and adding metadata. Use this to create custom child spans or update span attributes during execution.",
            },
          ],
        },
      ],
    },
    {
      name: "tracingOptions",
      type: "TracingOptions",
      isOptional: true,
      description: "Options for AI tracing configuration.",
      properties: [
        {
          parameters: [
            {
              name: "metadata",
              type: "Record<string, any>",
              isOptional: true,
              description:
                "Metadata to add to the root trace span. Useful for adding custom attributes like user IDs, session IDs, or feature flags.",
            },
          ],
        },
      ],
    },
  ]}
/>

## Returns

<PropertiesTable
  content={[
    {
      name: "stream",
      type: "ReadableStream<StreamEvent>",
      description:
        "A readable stream that emits workflow execution events in real-time",
    },
    {
      name: "getWorkflowState",
      type: "() => Promise<WorkflowResult<TState, TOutput, TSteps>>",
      description:
        "A function that returns a promise resolving to the final workflow result",
    },
    {
      name: "traceId",
      type: "string",
      isOptional: true,
      description:
        "The trace ID associated with this execution when AI tracing is enabled. Use this to correlate logs and debug execution flow.",
    },
  ]}
/>

## Extended usage example

```typescript showLineNumbers copy
const { getWorkflowState } = await run.stream({
  inputData: {
    value: "initial data",
  },
});

const result = await getWorkflowState();
```

## Stream Events

The stream emits various event types during workflow execution. Each event has a `type` field and a `payload` containing relevant data:

- **`start`**: Workflow execution begins
- **`step-start`**: A step begins execution
- **`tool-call`**: A tool call is initiated
- **`tool-call-streaming-start`**: Tool call streaming begins
- **`tool-call-delta`**: Incremental tool output updates
- **`step-result`**: A step completes with results
- **`step-finish`**: A step finishes execution
- **`finish`**: Workflow execution completes

## Related

- [Workflows overview](/docs/workflows/overview#running-workflows)
- [Workflow.createRunAsync()](/reference/workflows/workflow-methods/create-run)


---
title: "Reference: Run.streamVNext() (Experimental) | Streaming"
description: Documentation for the `Run.streamVNext()` method in workflows, which enables real-time streaming of responses.
---