Repository navigation
Move the OpenAI Agents samples to 2.0.0 and agent.asTool() - #534
Merged
Merged
Conversation
Bump @openai/agents-core and @openai/agents-openai to 0.22 and openai to 7, which 2.0.0 requires. Bump the Temporal SDK packages to 1.25 so the sample and the plugin share one copy. Register the Unix-local sandbox with OnHostSandboxClientProvider, since SandboxClientProvider refuses it in 2.0.0. A restarted Worker now loses its sandboxes, so the restart test checks for SandboxLost. Keep the openai client out of the hosted-tools Workflow bundle: openai 7 creates a FinalizationRegistry when it loads.
campoy
marked this pull request as ready for review
November 23, 2026 19:49
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What was changed
The agent-patterns sample's
agentsAsToolsWorkflow now uses the OpenAI Agents SDK'sagent.asTool()instead of the integration'sagentAsTool. The sample's README and theopenai-agentsREADME say the same.temporalio/ai-integrations#270 shipped in
@temporalio/openai-agents2.0.0, so this PR now also moves the OpenAI Agents samples to 2.0.0:@temporalio/openai-agents2.0.0, with the peers it needs:@openai/agents-coreand@openai/agents-openai~0.22.0andopenai^7.45.1. The@temporalio/*packages move to^1.25.0, because the plugin resolves the 1.25 Worker types and the build fails with TS2322 on 1.24.OnHostSandboxClientProvider. On 2.0.0,SandboxClientProviderthrows for local backends. Its README says which provider goes with which backend, and that a Worker restart loses a local sandbox and fails the run withSandboxLost. The restart test now checks for that.openaiout of the Workflow bundle (ignoreModules: ['openai']). The Workflow imports hosted tools from@openai/agents-openai, which loadsopenai7, and that creates aFinalizationRegistryat load time. The Workflow sandbox doesn't allow it, so every Workflow Task failed.I merged
maininto this branch first.Why?
temporalio/ai-integrations#270 makes
agent.asTool()work in Workflows and removesagentAsTool.Checklist
Closes: no issue.
How was this tested:
With the published
@temporalio/openai-agents1.24.0, the agent-patterns tests give 6 passing and 1 failing:agentsAsToolsreturns'Specialist answer: durable execution ensures reliability.', becauseagent.asTool()doesn't run the specialist on that version.With a build of Breaking: run TypeScript OpenAI Agents as written: agent.asTool() works, runConfig.model no longer overrides an agent's own model, agentAsTool is deprecated ai-integrations#270, installed from its packed tarball with every
@temporalio/*package pinned to 1.24.0 so there's one SDK copy, all 7 pass.pnpm run build,pnpm run lint(10 warnings, all in MCP server files this PR doesn't touch) andpnpm run format:checkpass.Breaking: run TypeScript OpenAI Agents as written: agent.asTool() works, runConfig.model no longer overrides an agent's own model, agentAsTool is deprecated ai-integrations#270 now also stops cloning agents. On its head,
e7f591a, installed the same way, all 43openai-agentssample tests pass. In the full run the MCP filesystem test timed out while its stdio server started in the container, and the next suite's setup failed after it; both suites pass when run alone.On 2.0.0 from npm:
npm run build,npm run lint(0 errors, the same 10 MCP warnings) andnpm run format:checkpass, andnpm testgives 43 passing. Before the hosted-tools fix it was 39 passing and 5 failing (three hosted-tool timeouts and two failures that followed them).The lockfile change also moves the langsmith sample's
openaito 7.62.0; its build passes and its 4 tests pass.Any docs updates needed? Yes. This PR updates both READMEs. The docs page update is Show agent.asTool() instead of agentAsTool on the TypeScript OpenAI Agents page documentation#5597, plus Fix TypeScript OpenAI Agents page for 2.0.0 documentation#5757 for the rest of 2.0.0. The sandbox prose there waits for this snippet to sync.