Skip to main content

Class: StrandsPlugin

strands.StrandsPlugin

Temporal plugin that runs Strands Agents inside Temporal workflows. Model, MCP tool, and (via workflow.activityAsTool) custom-tool invocations are routed through Temporal Activities for durable execution, retries, and timeouts.

Register on the worker (and on the client when using activityAsTool with interrupts, so the client-side data converter picks up the failure converter):

const client = await Client.connect({ plugins: [new StrandsPlugin({...})] });
const worker = new Worker({ ..., plugins: [new StrandsPlugin({...})] });

Hierarchy

Constructors

constructor

new StrandsPlugin(options?): StrandsPlugin

Parameters

NameType
options?StrandsPluginOptions

Returns

StrandsPlugin

Overrides

SimplePlugin.constructor

Properties

name

Readonly name: string

The name of the plugin

Inherited from

SimplePlugin.name

Methods

configureBundler

configureBundler(options): BundleOptions

Extend the bundler config so workflow code can bundle @strands-agents/sdk:

  • Ignore worker-only / non-workflow-safe modules that the SDK index transitively pulls in but that are unreachable from workflow code. This covers:

    • fs (statically imported by vended-plugins and vended-tools).
    • Every @strands-agents/sdk model provider's HTTP SDK (@aws-sdk/client-bedrock-runtime, @anthropic-ai/sdk, openai, @google/genai, ai). The workers constructs models worker-side; workflow code only goes through TemporalModel.
    • @temporalio/activity and @temporalio/client, which the worker-only halves of TemporalMCPClient, autoHeartbeat, and @temporalio/workflow-streams/client import.
    • path / crypto, pulled in transitively by the same worker-only code.
  • Replace the dynamic-imported MCP transport helpers (@modelcontextprotocol/sdk/client/{stdio,sse,streamableHttp}.js and their node:* dependencies, plus eventsource-parser/stream which streamableHttp.js reaches) with an empty module. They live in mcp-config.js's server-only code paths.

  • Inline async chunks so the bundle stays a single file — webpack's default JSONP chunk loader references self/document, neither of which exists in the workflow VM.

Parameters

NameType
optionsBundleOptions

Returns

BundleOptions

Overrides

SimplePlugin.configureBundler


configureClient

configureClient(options): ClientOptions

Configures client options by merging plugin parameters with existing options.

Parameters

NameTypeDescription
optionsClientOptionsThe existing client options

Returns

ClientOptions

Modified client options with plugin configuration applied

Inherited from

SimplePlugin.configureClient


configureConnection

configureConnection(options): ConnectionOptions

Configures connection options by merging plugin parameters with existing options. Special handling for function-based API keys.

Parameters

NameTypeDescription
optionsConnectionOptionsThe existing connection options

Returns

ConnectionOptions

Modified connection options with plugin configuration applied

Inherited from

SimplePlugin.configureConnection


configureNativeConnection

configureNativeConnection(options): NativeConnectionOptions

Configures native connection options by merging plugin parameters with existing options.

Parameters

NameTypeDescription
optionsNativeConnectionOptionsThe existing native connection options

Returns

NativeConnectionOptions

Modified native connection options with plugin configuration applied

Inherited from

SimplePlugin.configureNativeConnection


configureReplayWorker

configureReplayWorker(options): ReplayWorkerOptions

Configures replay worker options by merging plugin parameters with existing options.

Parameters

NameTypeDescription
optionsReplayWorkerOptionsThe existing replay worker options

Returns

ReplayWorkerOptions

Modified replay worker options with plugin configuration applied

Inherited from

SimplePlugin.configureReplayWorker


configureWorker

configureWorker(options): WorkerOptions

Configures worker options by merging plugin parameters with existing options. Activities and nexus services are appended, while other options are replaced.

Parameters

NameTypeDescription
optionsWorkerOptionsThe existing worker options

Returns

WorkerOptions

Modified worker options with plugin configuration applied

Inherited from

SimplePlugin.configureWorker


runWorker

runWorker(worker, next): Promise<void>

Runs the worker, optionally wrapping execution in a custom context.

Parameters

NameTypeDescription
workerWorkerThe worker instance to run
next(w: Worker) => Promise<void>Function to continue worker execution

Returns

Promise<void>

Promise that resolves when worker execution completes

Inherited from

SimplePlugin.runWorker