Skip to main content

Overview

Use withWorkflow(options, fn) to mark an end-to-end run. All nested tasks, agents, and tools are captured under this workflow.

Signature

Basic Usage

With Association Properties

Nested Tasks

Parameters

string
required
Workflow display name for identification in the Keywords AI dashboard
number
Version number for tracking workflow iterations
Record<string, any>
Custom metadata to associate with the workflow (user ID, session ID, etc.)

Return Value

Returns a Promise that resolves to the return value of the provided function.

Best Practices

  • Use descriptive workflow names for easy navigation in the dashboard
  • Keep workflows coarse-grained; use tasks for internal steps
  • Add association properties for filtering and grouping in analytics
  • Always call initialize() before using withWorkflow()