Skip to content

Move the OpenAI Agents samples to 2.0.0 and agent.asTool() - #534

Merged
campoy merged 6 commits into
mainfrom
openai-agents-native-as-tool
Nov 23, 2026
Merged

campoy merged 6 commits into
mainfrom
openai-agents-native-as-tool

Conversation

@campoy

@campoy campoy commented Oct 29, 2026 •

Copy link
Copy Markdown
Contributor

What was changed

The agent-patterns sample's agentsAsTools Workflow now uses the OpenAI Agents SDK's agent.asTool() instead of the integration's agentAsTool. The sample's README and the openai-agents README say the same.

temporalio/ai-integrations#270 shipped in @temporalio/openai-agents 2.0.0, so this PR now also moves the OpenAI Agents samples to 2.0.0:

  • @temporalio/openai-agents 2.0.0, with the peers it needs: @openai/agents-core and @openai/agents-openai ~0.22.0 and openai ^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.
  • The sandboxes Worker registers the Unix-local sandbox with OnHostSandboxClientProvider. On 2.0.0, SandboxClientProvider throws 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 with SandboxLost. The restart test now checks for that.
  • The hosted-tools Worker leaves openai out of the Workflow bundle (ignoreModules: ['openai']). The Workflow imports hosted tools from @openai/agents-openai, which loads openai 7, and that creates a FinalizationRegistry at load time. The Workflow sandbox doesn't allow it, so every Workflow Task failed.
  • The README asks for Node 22.12 or later, as 2.0.0 does.

I merged main into this branch first.

Why?

temporalio/ai-integrations#270 makes agent.asTool() work in Workflows and removes agentAsTool.

Checklist

  1. Closes: no issue.

  2. How was this tested:

  3. 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.

@CLAassistant

CLAassistant commented Oct 29, 2026 •

Copy link
Copy Markdown

CLA assistant check
All committers have signed the CLA.

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 campoy changed the title Use agent.asTool() in the OpenAI Agents agent-patterns sample Move the OpenAI Agents samples to 2.0.0 and agent.asTool() Nov 23, 2026
@campoy
campoy marked this pull request as ready for review November 23, 2026 19:49
@campoy
campoy requested review from a team as code owners November 23, 2026 19:49
@campoy
campoy requested a review from xumaple November 23, 2026 19:49

@xumaple xumaple left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@campoy
campoy merged commit 2124850 into main Nov 23, 2026
13 checks passed
@campoy
campoy deleted the openai-agents-native-as-tool branch November 23, 2026 23:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants