Skip to main content

Workflow

An AI workflow composed of steps.

Properties

beforeEach()

beforeEach: (callback) => void;

Registers a callback to be executed before each step.

Parameters

ParameterTypeDescription
callback() => Promise<unknown>Async function to execute before each step

Returns

void


rewindTo()

rewindTo: (step) => void;

Rewinds the workflow execution to a specific step.

Parameters

ParameterTypeDescription
stepProgrammaticStep | LLMStepThe step to rewind to

Returns

void


run()

run: (messages) => Promise<null | string>;

Runs the workflow with a given conversation context. Executes steps sequentially until completion or termination.

Parameters

ParameterTypeDescription
messagesConversationThe conversation context for the workflow

Returns

Promise<null | string>

The proposed reply if workflow completes, or null if terminated


terminate()

terminate: () => void;

Terminates the workflow, preventing further steps from being executed.

Returns

void