Skip to content

Pull TypeScript OpenAI Agents code from the samples repo - #5137

Open
brianstrauch wants to merge 2 commits into
mainfrom
docs/ts-openai-agents-snipsync
Open

Pull TypeScript OpenAI Agents code from the samples repo#5137
brianstrauch wants to merge 2 commits into
mainfrom
docs/ts-openai-agents-snipsync

Conversation

@brianstrauch

@brianstrauch brianstrauch commented Aug 18, 2026

Copy link
Copy Markdown
Member

What does this PR do?

Replaces the 16 hand-maintained inline TypeScript blocks on the OpenAI Agents SDK integration page with snipsync blocks backed by the openai-agents samples. Nothing verified those blocks, so they could drift from the SDK without any check failing.

Notes to reviewers

The markers upstream are scoped to exactly what each block shows, so no block needs selectedLines and none renders a leading // ... elision.

Tracing setup stays inline because the sample wraps the exporter, tracer provider, and plugin options in a tracing-mode switch that would make the extracted examples incomplete. The install commands also stay inline because they have no sample source.

Two sections are restructured, because the samples show in one place what the page showed in two:

  • MCP servers now registers both provider kinds in a single Worker snippet up front, and the stateless/stateful subsections cover only Workflow-side code.
  • Temporal orchestration spans would have duplicated the OpenTelemetry excerpt verbatim, so it's now prose pointing at that excerpt.

Some prose shifted to match the samples' identifiers rather than the invented ones the page used — helloWorld instead of haikuAgentWorkflow, and a note that the sample Worker sets useLocalActivity: true.

Verification

Ran yarn snipsync against the merged samples source. All 17 IDs resolve, every excerpt dedents to column 0, and the committed OpenAI Agents snippets are unchanged.

yarn build passes and vale --config .vale-ci.ini reports 0 errors/warnings on the page (one pre-existing sentence-case suggestion on the "Create a Hello World Workflow" heading, untouched here).

yarn check-links shows no new failure classes for this page — the /glossary#activity fragment-redirects it reports are systemic, with ~3000 hits site-wide.

🤖 Generated with Claude Code

┆Attachments: EDU-6984 Pull TypeScript OpenAI Agents code from the samples repo

Copilot AI balanced review requested due to automatic review settings August 18, 2026 22:25
@vercel

vercel Bot commented Aug 18, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
temporal-documentation Ready Ready Preview Aug 19, 2026 7:31pm

Request Review

@github-actions

Copy link
Copy Markdown
Contributor

📖 Docs PR preview links

Copilot AI 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.

Pull request overview

Replaces unverified inline TypeScript examples with Snipsync-managed excerpts from the samples repository.

Changes:

  • Converts 16 examples to synchronized sample excerpts.
  • Restructures MCP and tracing guidance around sample code.
  • Aligns identifiers and Local Activity guidance with runnable samples.

💡 Configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread docs/develop/typescript/integrations/openai-agents.mdx
Comment thread docs/develop/typescript/integrations/openai-agents.mdx Outdated
The guide hand-maintained 16 inline TypeScript blocks that no CI job
verified, so they could drift from the SDK without anything failing.
Replace them with snipsync blocks backed by the openai-agents samples.

The markers upstream are scoped to exactly what each block shows, so no
block needs selectedLines and none renders a leading elision.

Two blocks stay inline on purpose, because the tracing sample wraps both
calls in a tracing-mode switch that would obscure the API: the hosted
exporter registration and the tracer-provider setup. The install commands
stay inline too, having no sample source.

Two blocks are also restructured, because the samples show the same thing
in one place where the page showed it in two:

- MCP now registers both provider kinds in one Worker snippet up front,
  and the stateless and stateful sections cover only Workflow-side code.
- The orchestration-spans block, which would have duplicated the
  OpenTelemetry excerpt verbatim, is now prose pointing at it.

Depends on the matching marker PR in temporalio/samples-typescript.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@brianstrauch
brianstrauch marked this pull request as draft August 19, 2026 19:30
@brianstrauch
brianstrauch marked this pull request as ready for review August 19, 2026 19:41
@brianstrauch
brianstrauch requested a balanced review from Copilot August 19, 2026 19:42

Copilot AI 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.

Pull request overview

Copilot reviewed 1 out of 1 changed files in this pull request and generated no new comments.

Suppressed comments (2)

docs/develop/typescript/integrations/openai-agents.mdx:675

  • This identifies only the Worker configuration, but these options must also be set on the Client plugin: its interceptor injects addTemporalSpans and useOtelInstrumentation into the Workflow-start header. With the Client setup above, Client and Workflow orchestration spans remain disabled. Configure both plugin instances with these options, and register the replay-safe tracer provider in every process where useOtelInstrumentation: true is constructed.
Set `addTemporalSpans: true` to emit `temporal:*` agent-SDK spans for orchestration operations such as Workflow starts,
Signals, Queries, Updates, Activities, child Workflows, Nexus Operations, and Continue-As-New. It sits alongside
`useOtelInstrumentation` in `interceptorOptions`, as shown in the Worker above.

docs/develop/typescript/integrations/openai-agents.mdx:142

  • modelParams reach the Workflow only through the config header injected by the Client plugin. Because this Client instance omits modelParams, the useLocalActivity: true shown on the Worker does not take effect; model calls remain regular Activities, contrary to lines 125–126. Add modelParams: { useLocalActivity: true } to this Client plugin in the source sample and regenerate the snippet (or remove the Worker-side claim).

This issue also appears on line 673 of the same file.

  plugins: [new OpenAIAgentsPlugin({ modelProvider: new OpenAIProvider({ apiKey }) })],

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.

2 participants