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.
Properties
Section titled “Properties”memoryScopeWithSuffix
Section titled “memoryScopeWithSuffix”
readonlymemoryScopeWithSuffix: (suffix) =>string
Defined in: packages/core/src/workflow/types.ts:58
Build a AgentRunInput.memoryScope namespaced to this workflow run:
${workflowRunId}:${suffix}.
Parameters
Section titled “Parameters”suffix
Section titled “suffix”string
Returns
Section titled “Returns”string
parentStepId
Section titled “parentStepId”
readonlyparentStepId:string|null
Defined in: packages/core/src/workflow/types.ts:40
signal
Section titled “signal”
readonlysignal: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.
stepId
Section titled “stepId”
readonlystepId:string|null
Defined in: packages/core/src/workflow/types.ts:38
stepPath
Section titled “stepPath”
readonlystepPath:string[]
Defined in: packages/core/src/workflow/types.ts:39
workflowRunId
Section titled “workflowRunId”
readonlyworkflowRunId:string
Defined in: packages/core/src/workflow/types.ts:37
Id of this workflow invocation (shared by all steps/agents in the run).
Methods
Section titled “Methods”emit()
Section titled “emit()”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.
Parameters
Section titled “Parameters”string
payload?
Section titled “payload?”unknown
Returns
Section titled “Returns”void
setTitle()
Section titled “setTitle()”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.
Parameters
Section titled “Parameters”string
Returns
Section titled “Returns”Promise<void>