Skip to content

Add the Python OpenAI Agents SDK integration guide - #5138

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

Add the Python OpenAI Agents SDK integration guide#5138
brianstrauch wants to merge 2 commits into
mainfrom
docs/python-openai-agents

Conversation

@brianstrauch

@brianstrauch brianstrauch commented Aug 18, 2026

Copy link
Copy Markdown
Member

What does this PR do?

Adds docs/develop/python/integrations/openai-agents.mdx, plus the sidebar entry, the SDK index link, and the integrations-grid href.

Python is currently the only Temporal OpenAI Agents integration with no page on docs.temporal.io — both the SDK index and the grid send readers to the contrib README on GitHub, which is reference prose for SDK developers rather than a guide.

Notes to reviewers

Mirrors the TypeScript page's structure, adapted where the Python plugin genuinely differs:

  • The plugin goes on the Client, and Workers inherit it. There is no Temporal-specific runner — Runner.run is redirected in place.
  • Python has no WorkflowSafeMemorySession, so conversation history is Workflow state rebuilt from result.to_input_list(), and SQLiteSession is unsupported. Long sessions get a Continue-as-New section instead.
  • Agent.as_tool() works as-is, so there is no agentAsTool equivalent.
  • The Sandbox section has no TypeScript counterpart and is marked pre-release inline.
  • The unreleased temporal_worker_env_ref() flow is omitted until it ships in a Python SDK release.

Three decisions worth a look:

  1. No ReleaseNoteHeader. The contrib README marks individual features as pre-release or experimental, but not the integration as a whole, so those warnings live on the sections they apply to rather than at the top of the page.
  2. No keywords frontmatter, per AGENTS.md, even though the sibling integration pages still carry one.
  3. The feature-support matrix stays in the README rather than being mirrored here, where it would go stale.

Verification

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

  • yarn build passes.
  • vale --config .vale-ci.ini — 0 errors, 0 warnings, 0 suggestions.
  • yarn check:orphans — no orphaned pages, so the sidebar entry is wired correctly.
  • yarn check-links — the 4 failures touching this page are all expected: the og:url and GitHub edit-URL checks fail because the page isn't on main yet, and the two /glossary#activity fragment-redirects are a systemic class with ~3000 hits site-wide that the TypeScript page shares.

🤖 Generated with Claude Code

┆Attachments: EDU-6985 Add the Python OpenAI Agents SDK integration guide

Copilot AI balanced review requested due to automatic review settings August 18, 2026 22:28
@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

Adds a Python guide for the Temporal OpenAI Agents SDK integration and connects it to documentation navigation.

Changes:

  • Adds setup, tools, MCP, sandbox, streaming, and tracing guidance.
  • Links the guide from Python navigation and the SDK index.
  • Updates the integrations grid to use the internal guide.

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 5 comments.

File Description
docs/develop/python/integrations/openai-agents.mdx Adds the integration guide.
docs/develop/python/index.mdx Links the guide from the Python SDK index.
sidebars.js Adds sidebar navigation.
src/components/IntegrationsGrid/integrations-data.json Updates the integration card URL.

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

Comment thread docs/develop/python/integrations/openai-agents.mdx Outdated
Comment thread docs/develop/python/integrations/openai-agents.mdx Outdated
Comment thread docs/develop/python/integrations/openai-agents.mdx Outdated
Comment thread docs/develop/python/integrations/openai-agents.mdx
Comment thread docs/develop/python/integrations/openai-agents.mdx
Python was the only Temporal OpenAI Agents integration with no page on
docs.temporal.io: both the SDK index and the integrations grid sent
readers to the contrib README on GitHub, which is reference prose for SDK
developers rather than a guide.

Mirrors the structure of the TypeScript page, adapted where the Python
plugin genuinely differs:

- The plugin goes on the Client, and Workers inherit it. There is no
  Temporal-specific runner — Runner.run is redirected in place.
- Python has no WorkflowSafeMemorySession, so conversation history is
  Workflow state rebuilt from result.to_input_list(), and SQLiteSession is
  unsupported. Long sessions get a continue-as-new section instead.
- Agent.as_tool() works as-is, so there is no agentAsTool equivalent.
- Two sections have no TypeScript counterpart: Sandbox, and the
  temporal_worker_env_ref() secrets flow for hosted tools. Both are marked
  pre-release/experimental inline.

The page carries no ReleaseNoteHeader: the contrib README marks individual
features as pre-release or experimental but the integration as a whole is
not, so those warnings live on the sections they apply to.

The feature-support matrix stays in the README rather than being mirrored
here, where it would go stale.

Depends on the matching sample PR in temporalio/samples-python.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@brianstrauch
brianstrauch force-pushed the docs/python-openai-agents branch from 797f812 to adb055f Compare August 19, 2026 19:07
@brianstrauch
brianstrauch marked this pull request as ready for review August 19, 2026 19:07
@brianstrauch
brianstrauch requested a review from a team as a code owner August 19, 2026 19:07

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 4 out of 4 changed files in this pull request and generated no new comments.

Suppressed comments (4)

docs/develop/python/integrations/openai-agents.mdx:550

  • This unconditionally returns approve: True, so the action never pauses for a person and the section does not demonstrate the Signal/Update-backed approval it promises. Replace the source sample with an async callback that waits for a decision set by a Signal or Update handler, then refresh this Snipsync excerpt.
    result: MCPToolApprovalFunctionResult = {"approve": True}

docs/develop/python/integrations/openai-agents.mdx:290

  • Adjacent Python string literals concatenate without separators, so the actual instruction contains translate.If and order.You. Add trailing spaces in the samples source and rerun Snipsync so the agent receives the intended sentences.

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

            "You are a translation agent. You use the tools given to you to translate."
            "If asked for multiple translations, you call the relevant tools in order."
            "You never translate on your own, you always use the provided tools."

docs/develop/python/integrations/openai-agents.mdx:385

  • The dedicated Worker is not guaranteed to hold the connection for the entire Workflow run: the server-session Activity defaults to a one-hour start-to-close timeout. A Workflow that uses this default for longer than an hour loses the session, so document the limit and how to override server_session_config.
Register a `StatefulMCPServerProvider` instead. The plugin runs a dedicated Worker that holds the connection open for
the life of the Workflow run.

docs/develop/python/integrations/openai-agents.mdx:826

  • ReplaySafeTracerProvider does not wait for Workflow completion before exporting spans. It suppresses end() during replay (and for certain Workflow Task failures), while SimpleSpanProcessor exports other spans when they end. Describing completion-gated export gives readers the wrong telemetry timing.
The provider must come from `create_tracer_provider()`. It replays safely, exporting spans only when a Workflow actually
completes rather than on every replay, and generates deterministic span identifiers so they correlate across replays.

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