Skip to main content

Interface: ChildWorkflowHandle<T>

workflow.ChildWorkflowHandle

A client side handle to a single Workflow instance. It can be used to signal, wait for completion, and cancel a Workflow execution.

Given the following Workflow definition:

export const incrementSignal = defineSignal('increment');
export async function counterWorkflow(initialValue: number): Promise<void>;

Start a new Workflow execution and get a handle for interacting with it:

// Start the Workflow with initialValue of 2.
const handle = await startWorkflow(counterWorkflow, { args: [2] });
await handle.signal(incrementSignal, 2);
await handle.result(); // throws WorkflowExecutionTerminatedError

Type parameters

NameType
Textends Workflow

Hierarchy

Properties

firstExecutionRunId

Readonly firstExecutionRunId: string

The runId of the initial run of the bound Workflow


workflowId

Readonly workflowId: string

The workflowId of the current Workflow

Inherited from

BaseWorkflowHandle.workflowId

Methods

result

result(): Promise<WorkflowResultType<T>>

Promise that resolves when Workflow execution completes

Returns

Promise<WorkflowResultType<T>>

Inherited from

BaseWorkflowHandle.result


signal

signal<Args>(def, ...args): Promise<void>

Signal a running Workflow.

Example

await handle.signal(incrementSignal, 3);

Type parameters

NameType
Argsextends any[] = []

Parameters

NameTypeDescription
defstring | SignalDefinition<Args>a signal definition as returned from defineSignal
...argsArgs-

Returns

Promise<void>

Inherited from

BaseWorkflowHandle.signal