Skip to main content

Namespace: workflow

strands.workflow

Helpers for wiring Temporal activities into Strands' tool and hook surfaces.

Both activityAsTool and activityAsHook produce workflow-side objects that dispatch user activities via workflow.executeActivity, so the I/O actually happens off the workflow.

Interfaces

Functions

activityAsHook

activityAsHook<E, I>(activityName, options): HookCallback<E>

Wrap a Temporal activity as a Strands hook callback.

The returned callback dispatches activityName as a Temporal activity each time the associated event fires. Register the callback with Agent.addHook or a Plugin's hook registration.

Type parameters

NameType
Eextends HookableEvent
II

Parameters

NameType
activityNamestring
optionsActivityAsHookOptions<E, I>

Returns

HookCallback<E>


activityAsTool

activityAsTool(activityName, options?): TemporalActivityTool

Wrap a Temporal activity as a Strands tool.

activityName must match the name registered on the worker (which defaults to the activity function's name). The returned Tool can be passed directly in AgentConfig.tools.

Parameters

NameType
activityNamestring
options?ActivityAsToolOptions

Returns

TemporalActivityTool