Skip to main content

Namespace: openaiAgentsWorkflow

Classes​

Interfaces​

References​

DEDICATED_WORKER_FAILURE_TYPE​

Re-exports DEDICATED_WORKER_FAILURE_TYPE

Functions​

activityAsTool​

▸ activityAsTool<TActivity>(definition, options?): FunctionTool

Wraps a Temporal Activity as an OpenAI Agents FunctionTool. When the agent invokes the tool, it schedules the named Activity via proxyActivities and returns the stringified result.

Type parameters​

NameType
TActivityextends (input: any) => Promise<any>

Parameters​

NameType
definitionActivityToolDefinition<TActivity>
options?ActivityAsToolOptions

Returns​

FunctionTool


agentAsTool​

▸ agentAsTool<TAgent>(agent, options): FunctionTool

Nested approval interruptions are not supported: invoke throws ApplicationFailure of type NestedAgentInterruption. Handle approvals at the top-level runner instead.

Type parameters​

NameType
TAgentextends Agent<any, any>

Parameters​

NameType
agentTAgent
optionsAgentAsToolOptions<TAgent>

Returns​

FunctionTool


nexusOperationAsTool​

▸ nexusOperationAsTool<TService, TOp>(operation, definition, options): FunctionTool

Wraps a Nexus Operation as an OpenAI Agents FunctionTool. When the agent invokes the tool, it calls the Operation through a Workflow-side Nexus client (createNexusServiceClient) and returns the stringified result.

This is the Nexus counterpart of activityAsTool: instead of scheduling a Temporal Activity, the tool invocation schedules a Nexus Operation against the configured endpoint and service.

Type parameters​

NameType
TServiceextends ServiceDefinition<OperationMap>
TOpextends OperationDefinition<any, any>

Parameters​

NameType
operationTOp
definitionNexusOperationToolDefinition<TOp>
optionsNexusOperationAsToolOptions<TService>

Returns​

FunctionTool


statefulMcpServer​

▸ statefulMcpServer(name, options?): StatefulTemporalMCPServer

Creates a stateful MCP server handle. Maintains a persistent MCP connection across the Workflow via a dedicated per-run Worker.

If the dedicated Worker fails (startup timeout or missed heartbeat), operations throw ApplicationFailure with type "DedicatedWorkerFailure".

Parameters​

NameTypeDescription
namestringServer name; must match the StatefulMCPServerProvider registered on the Worker side.
options?StatefulMcpServerOptions-

Returns​

StatefulTemporalMCPServer


statelessMcpServer​

▸ statelessMcpServer(name, options?): MCPServer

Parameters​

NameType
namestring
options?StatelessMcpServerOptions

Returns​

MCPServer


temporalSandboxClient​

▸ temporalSandboxClient(name, config?): TemporalSandboxClient

Creates a Workflow-side sandbox client for RunConfig.sandbox. All sandbox operations are dispatched as Activities to the SandboxClientProvider registered under the same name on the Worker.

When config is omitted, Activities use a five-minute start-to-close timeout. A supplied ActivityOptions object is used as-is without merging defaults.

Parameters​

NameTypeDescription
namestringProvider name; must match the SandboxClientProvider registered on the Worker side.
config?ActivityOptionsActivity options for every sandbox operation.

Returns​

TemporalSandboxClient


workerEnvValue​

▸ workerEnvValue(name): EnvValueReference

Returns a Manifest environment value that names a Worker environment variable instead of holding a credential. Only the variable name crosses into the Activity arguments that every sandbox operation records in Workflow history; the Worker reads the value from its own environment when the sandbox backend materializes the environment.

The name must be in the plugin's resolvableWorkerEnvVars allowlist — a sandbox environment value has no way to say "leave this one out", so any other name fails the Activity non-retryably with a WorkerEnvValueError, naming the variable. An allowlisted variable that is unset or empty reads as the empty string.

new Manifest({ environment: { DB_PASSWORD: workerEnvValue('WORKER_DB_PASSWORD') } })

Parameters​

NameType
namestring

Returns​

EnvValueReference