Workflow
An AI workflow composed of steps.
Properties
beforeEach()
beforeEach: (callback) => void;
Registers a callback to be executed before each step.
Parameters
| Parameter | Type | Description |
|---|---|---|
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
| Parameter | Type | Description |
|---|---|---|
step | ProgrammaticStep | LLMStep | The 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
| Parameter | Type | Description |
|---|---|---|
messages | Conversation | The 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