Add the Python OpenAI Agents SDK integration guide - #5138
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
📖 Docs PR preview links
|
There was a problem hiding this comment.
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.
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>
797f812 to
adb055f
Compare
There was a problem hiding this comment.
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.Ifandorder.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
ReplaySafeTracerProviderdoes not wait for Workflow completion before exporting spans. It suppressesend()during replay (and for certain Workflow Task failures), whileSimpleSpanProcessorexports 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.
What does this PR do?
Adds
docs/develop/python/integrations/openai-agents.mdx, plus the sidebar entry, the SDK index link, and the integrations-gridhref.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:
Runner.runis redirected in place.WorkflowSafeMemorySession, so conversation history is Workflow state rebuilt fromresult.to_input_list(), andSQLiteSessionis unsupported. Long sessions get a Continue-as-New section instead.Agent.as_tool()works as-is, so there is noagentAsToolequivalent.temporal_worker_env_ref()flow is omitted until it ships in a Python SDK release.Three decisions worth a look:
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.keywordsfrontmatter, per AGENTS.md, even though the sibling integration pages still carry one.Verification
Ran
yarn snipsyncagainst the merged samples source. All 18 IDs resolve, every excerpt dedents to column 0, and the committed OpenAI Agents snippets are unchanged.yarn buildpasses.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: theog:urland GitHub edit-URL checks fail because the page isn't onmainyet, and the two/glossary#activityfragment-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