Skip to main content
Returns metadata about the current workflow run, including the run ID, start time, and trigger URL.

Signature

Returns

WorkflowMetadata
Metadata about the current workflow run.

Usage

Basic Usage

Get workflow metadata inside a workflow function:

Use in Step Functions

Access workflow metadata from within a step:

Track Workflow Duration

Calculate how long a workflow has been running:

Include Run ID in External Requests

Pass the run ID to external systems:

Create Webhook URLs

The url property is used internally by createWebhook():

Logging and Observability

Include workflow context in logs:

Correlation with External Systems

Use run ID for correlation:

Unique Resource Names

Generate unique resource identifiers:

Scheduled Workflow Info

Combine with other metadata for scheduling:

Notes

  • Can be called from both workflow functions and step functions
  • Throws an error if called outside a workflow or step function
  • The workflowRunId is guaranteed to be unique for each workflow run
  • The workflowStartedAt timestamp represents when the workflow run was first started
  • The url property contains the base URL for the workflow deployment
  • Uses a symbol-based storage mechanism internally for context retrieval