/** * @experimental The OpenAI Agents plugin is an experimental feature; APIs may change without notice. */ import type { ModelProvider } from '@openai/agents-core'; import { SimplePlugin } from '@temporalio/plugin'; import type { BundleOptions, ReplayWorkerOptions, WorkerOptions } from '@temporalio/worker'; import type { SerializableModelActivityOptions } from '../common/model-activity-options'; import type { HostedToolCredentialsResolver } from './hosted-tool-credentials'; import type { StatelessMCPServerProvider } from './mcp-provider'; import type { SandboxClientProvider } from './sandbox-provider'; import type { StatefulMCPServerProvider } from './stateful-mcp-provider'; export type MCPServerProvider = StatelessMCPServerProvider | StatefulMCPServerProvider; /** * Options controlling trace interceptor behavior on both the Activity side * (directly) and the Workflow side (via header propagation). */ export interface OpenAIAgentsPluginInterceptorOptions { /** Wrap calls in `temporal:*` custom spans. @default false */ addTemporalSpans?: boolean; /** * Emit OTel spans for agent-SDK trace/span events. Orthogonal to * `addTemporalSpans`. @default false */ useOtelInstrumentation?: boolean; } export interface OpenAIAgentsPluginOptions { /** Model provider used to resolve model names to Model instances. */ modelProvider: ModelProvider; /** MCP server providers whose Activities will be auto-registered. */ mcpServerProviders?: MCPServerProvider[]; /** * Sandbox client providers whose Activities will be auto-registered. * Reference them from Workflows via `temporalSandboxClient(name)`. * * @experimental Sandbox support is experimental and may change without notice. */ sandboxClientProviders?: SandboxClientProvider[]; /** * Resolves credentials for the hosted tools an Agent declares — a hosted MCP * tool's `authorization` and `headers`, a shell or code interpreter tool's * domain secrets — so Workflow code can omit them and keep them out of * Workflow history. See {@link HostedToolCredentialsResolver}. * * @experimental Worker-side hosted tool credentials are experimental and may change without notice. */ hostedToolCredentials?: HostedToolCredentialsResolver; /** * Allowlist of Worker environment variable names this Worker will read on * behalf of a `workerEnvValue` in a sandbox `Manifest`. Names must match * exactly, except for the entry `'*'`, which allows every name. * * An allowlisted variable that is unset or empty reads as the empty string. A * name outside the allowlist fails the Activity non-retryably. * * @default [] — no name is readable. * @experimental Worker environment variable references are experimental and may change without notice. */ resolvableWorkerEnvVars?: readonly string[]; /** * Default Model Activity options (timeouts, retry, Task Queue, etc.). * Propagated to the Workflow via the `__openai_agents_config` header. */ modelParams?: SerializableModelActivityOptions; /** * Trace interceptor options. Propagated to the Workflow via the * `__openai_agents_config` header and applied to Activities directly. */ interceptorOptions?: OpenAIAgentsPluginInterceptorOptions; } /** * Temporal plugin integrating the OpenAI Agents SDK. Registers model * invocation Activities so Workflow-side ActivityBackedModel can delegate LLM * calls, and wires trace propagation between client/Workflow/Activity. * * @experimental The OpenAI Agents plugin is an experimental feature; APIs may change without notice. */ export declare class OpenAIAgentsPlugin extends SimplePlugin { constructor(options: OpenAIAgentsPluginOptions); configureWorker(options: WorkerOptions): WorkerOptions; configureReplayWorker(options: ReplayWorkerOptions): ReplayWorkerOptions; configureBundler(options: BundleOptions): BundleOptions; private injectSinks; }