Skip to content

WorkflowContext

Defined in: packages/core/src/workflow/types.ts:35

Workflow execution scope. Implemented by WorkflowContextImpl (class); prefer ctx.step(...) on the instance. Bound methods are arrow fields, so destructuring is safe.

Passed to the workflow author’s run function. Callers may pass parentCtx on Workflow#run to nest under a parent run; otherwise the runtime supplies context.

readonly memoryScopeWithSuffix: (suffix) => string

Defined in: packages/core/src/workflow/types.ts:58

Build a AgentRunInput.memoryScope namespaced to this workflow run: ${workflowRunId}:${suffix}.

string

string


readonly parentStepId: string | null

Defined in: packages/core/src/workflow/types.ts:40


readonly signal: AbortSignal

Defined in: packages/core/src/workflow/types.ts:46

Aborts when WorkflowRunHandle.cancel is called on this run (or a parent run that this invocation nested under). Passed into ctx.step bodies and linked to child agent.run / agent.stream AbortControllers.


step: StepFn

Defined in: packages/core/src/workflow/types.ts:52

Run a named, cacheable unit of work. Child contexts are built from the parent host (this). Agent/tool bridge uses scoped ALS only inside step bodies and the workflow body.


readonly stepId: string | null

Defined in: packages/core/src/workflow/types.ts:38


readonly stepPath: string[]

Defined in: packages/core/src/workflow/types.ts:39


readonly workflowRunId: string

Defined in: packages/core/src/workflow/types.ts:37

Id of this workflow invocation (shared by all steps/agents in the run).

emit(name, payload?): void

Defined in: packages/core/src/workflow/types.ts:65

Emit a custom run event (type: "custom"). stepId on the persisted event is omitted at workflow root (when WorkflowContext.stepId is null). System lifecycle events cannot be authored this way.

string

unknown

void


setTitle(title): Promise<void>

Defined in: packages/core/src/workflow/types.ts:71

Set the inspector display title for this workflow run. Safe to call at the start of run, after a first step, or just before returning — blank titles are ignored.

string

Promise<void>