Skip to main content

Class: GoogleAdkPlugin

googleAdkAgents.GoogleAdkPlugin

The Temporal plugin for the Google Agent Development Kit (@google/adk).

The plugin's central mechanism is to run the native ADK Runner and agent graph inside the Workflow sandbox (deterministic) while routing only the non-deterministic I/O boundaries — model inference and MCP server calls — out to Activities. Making that work requires the @google/adk barrel to bundle into the Workflow sandbox; GoogleAdkPlugin.configureBundler is what makes the bundle build (see the recipe documented there).

Hierarchy

Constructors

constructor

new GoogleAdkPlugin(options?): GoogleAdkPlugin

Parameters

NameTypeDescription
options?GoogleAdkPluginOptionsWorker-side model + MCP configuration.

Returns

GoogleAdkPlugin

Overrides

SimplePlugin.constructor

Properties

name

Readonly name: string

The name of the plugin

Inherited from

SimplePlugin.name

Methods

configureBundler

configureBundler(options): BundleOptions

Makes the @google/adk agent loop bundle into the Workflow sandbox.

configureBundler is the single canonical bundling hook — the Worker runs it for both live execution and replay (Worker.create and Worker.runReplayHistory both bundle through getOrCreateBundle), so the recipe applies identically on both paths and there is no separate configureWorker/configureReplayWorker bundler override.

The recipe has three parts, all required:

  1. webpackConfigHook adds googleAdkSandboxCompatPlugin (the node: strip, shim redirects, and process provide) and the exact-match resolve.alias pin of @opentelemetry/api to a single bundle copy (see addSandboxCompat).
  2. ignoreModules stubs (alias → false) two groups: ADK's heavy node-only service packages (ADK_NODE_ONLY_SERVICE_PACKAGES) and every disallowed Node builtin (disallowedBuiltins). The builtins are already aliased to false by the bundler — listing them additionally tells its determinism guard "expected, don't fail" for the few ADK core reaches on paths that never run in a Workflow.
  3. workflowInterceptorModules gets the load-polyfills module prepended. Interceptor modules are evaluated per workflow — with the activator installed — before the user's workflow module (the initRuntime contract in @temporalio/workflow's worker-interface: it sets the activator, then imports interceptor modules in list order, then imports workflows), so the web globals @google/adk/@google/genai and ADK's OpenTelemetry chain dereference at module load (ReadableStream, performance, …) exist no matter what order the user's own imports evaluate in. The module exports an interceptors factory that registers nothing, per the documented interceptor-module contract. (A webpack entry preload would not work: entry code evaluates at bundle load, before any activator, where the polyfill's inWorkflowContext() gate is false — and in the reusable-V8-context mode the no-op evaluation would be cached and never re-run.) Known gap: custom payload/failure converter modules (payloadConverterPath / failureConverterPath) evaluate before interceptor modules, so a converter module that itself imports @google/adk/@google/genai must import @temporalio/google-adk-agents/workflow (or ./load-polyfills) first to install the polyfills.

Tradeoff: putting all disallowed builtins in ignoreModules suppresses the bundler's friendly "you imported a Node builtin in your Workflow" build-time error (for the user's own Workflow code too). Runtime determinism is still enforced by the sandbox — a real fs call from Workflow code throws there — so the safety property is preserved.

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