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
Theurl 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
workflowRunIdis guaranteed to be unique for each workflow run - The
workflowStartedAttimestamp represents when the workflow run was first started - The
urlproperty contains the base URL for the workflow deployment - Uses a symbol-based storage mechanism internally for context retrieval
Related
- getStepMetadata - Get current step metadata
- createWebhook - Create a webhook (uses the
urlproperty) - getWritable - Get a writable stream for the workflow