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