Repository navigation
Import python/openai_agents from sdk-python with full history (pilot plugin) - #2
Merged
Merged
Conversation
* Added openai_agents. * added tools and trace interceptor. * Lint error fixes * Lint error fixes * Missing docstrings added. * Fixed tool serialization. * Initial test implementation * Intercept test calls to LLM * Move to optional dependency * Linting * Fixing build errors * Fixing build errors * Fixing typo * Fake API key for test, skip below 3.11 * Tools test * Move activity to a method to allow model customization without monkey patch * Change overrides to context manager * Research workflow test * Customer service and agents as tools tests. These will currently fail without a change to type deserialization of agent responses * Fix up some imports * Remove unneeded print * Doc string improvement * Execute inside sandbox * 3.9 lint error * Add activity configuration to openai overrides and activity_as_tool * Update docstrings * Updating tests * Add experimental warnings * Remove runtime warnings * Test required import for build error * Fix import * Update open_ai_data_converter.py * Remove required import * Simplify custom data converter * Replace rebuild * Add passthrough type namespaces to data converter * Check activity count in customer_service test * cleanup dataconverter imports + doc build errors * add documentation * Fix model rebuild * update for OpenAI Agents SDK release 0.0.19 * lint fixes * fixed and elaborated on README * Update temporalio/contrib/openai_agents/README.md Co-authored-by: Spencer Judge <[email protected]> * Update temporalio/contrib/openai_agents/README.md Co-authored-by: Spencer Judge <[email protected]> * Update temporalio/contrib/openai_agents/README.md Co-authored-by: Dan Davison <[email protected]> * Update temporalio/contrib/openai_agents/README.md Co-authored-by: Dan Davison <[email protected]> * Update temporalio/contrib/openai_agents/README.md Co-authored-by: Dan Davison <[email protected]> * Update temporalio/contrib/openai_agents/README.md Co-authored-by: Dan Davison <[email protected]> * readme updates * Addressing PR feedback, mostly some new test validation * PR cleanup from feedback * Remove change from irrelevant file * PR cleanup * Add custom message for tool output failure * Remove commented code and unneeded sandbox statement --------- Co-authored-by: Maxim Fateev <[email protected]> Co-authored-by: Johann Schleier-Smith <[email protected]> Co-authored-by: Johann Schleier-Smith <[email protected]> Co-authored-by: Spencer Judge <[email protected]> Co-authored-by: Dan Davison <[email protected]> Migrated-From: temporalio/sdk-python@53d9ace
* Update versions for release * Remove rc from release * Add Slack link to OpenAI README --------- Co-authored-by: Dan Davison <[email protected]> Migrated-From: temporalio/sdk-python@9f62668
…ython#918) * Fixing issues with openai integration on python 3.9 * Restrict eval_type to python 3.9 Migrated-From: temporalio/sdk-python@40f1624
…-python#917) * Adding named params to openai activity configurations * Remove a few unused imports * Move model parameters into an object, remove activity id * Refer argument docs to , early check timeout * Removing example usage because of pydoctor errors Migrated-From: temporalio/sdk-python@4cf0697
…ralio/sdk-python#922) * Adding an end to end test which uses an openai service account * Lint * Add trace intercepter * Include data converter Migrated-From: temporalio/sdk-python@29599e5
…io/sdk-python#920) * Experimental CI entry to run tests with latest dependencies * Fix upgrade command * Further discriminate log names * Remove locked from matrix * Fixing problem with updated openai dependency * Lint * Move latest deps test to separate job * Fix openai test break * Pydantic validation fails anyway, so remove type ingore * CI cleanup Migrated-From: temporalio/sdk-python@8fc55e7
* Adding tests for guardrail samples * Fix lint * Remove | syntax Migrated-From: temporalio/sdk-python@5a95f8e
* Processing activity tool input through the function schema's pydantic model * Fix issues with multiple arguments * Undo prompt change * Add explicit application error for invalid json tool input * Change error return * Change error base class * Fix linting * Update core Migrated-From: temporalio/sdk-python@61d5072
…/sdk-python#930) * Adding replay and end to end tests for all existing tests * Experimental CI entry to run tests with latest dependencies (temporalio/sdk-python#920) * Experimental CI entry to run tests with latest dependencies * Fix upgrade command * Further discriminate log names * Remove locked from matrix * Fixing problem with updated openai dependency * Lint * Move latest deps test to separate job * Fix openai test break * Pydantic validation fails anyway, so remove type ingore * CI cleanup * Remove history write * Linting * Remove history output * Configure the data converter * Linting * Fix merge error Migrated-From: temporalio/sdk-python@47027fc
* Don't create fake parent span, use actual processor base class * Remove print Migrated-From: temporalio/sdk-python@83d2ae4
…rter/sandbox improvements (temporalio/sdk-python#936) Fixes temporalio/sdk-python#912 Migrated-From: temporalio/sdk-python@9d40e86
* Toying with context input to tools * Doc update * Remove import Migrated-From: temporalio/sdk-python@ecfb72f
* Set default model activity timeout to 60s * Make model activity params optional Migrated-From: temporalio/sdk-python@6fbc4c5
* WIP module layout overhaul * WIP. Mostly test model changes * Finish decorator definition and docstrings * Also tag activity_as_tool as a temporal tool * Remove temporal only tool restriction * Rearrange imports * Fix 3.9 typing * Addressing comments * Updating readme * Remove ellipsis * Fix linting * Reduce research workflow quantity, extend timeout Migrated-From: temporalio/sdk-python@61af3ea
* Remove wrapping function decorator * Linting Migrated-From: temporalio/sdk-python@3a27fe8
…ython#968) * Support for method activities conversion into tools * Fix test Migrated-From: temporalio/sdk-python@c37c69f
* Fixing tracing issues. Propagate span parentage, remove startActivity * Remove traceback * Add start traces with correct durations * Add tracing test * Remove cast * Remove flaky test check Migrated-From: temporalio/sdk-python@60f67d9
* Fix type errors * Do not make drive-by check for other type errors Migrated-From: temporalio/sdk-python@7c57a76
* Initial rough framework for plugins * Ensure plugin modification happen before any other initialization * Openai Agents plugin PoC * Remove extra import/exports * Format * Use local tuner for type inference * Add docstrings and fix merge issues * Remove tests duplicated by merge * Fix tests * Rename plugin + a few fixes * Lint Migrated-From: temporalio/sdk-python@0f3c577
* Update agents sdk dependency to latest. Add test for newly functional serialization scenarios * Linting * Attempt lint fix, it didn't happen locally * Attempt lint fix * Test cleanup Migrated-From: temporalio/sdk-python@9e7dc7a
…#982) * Add exception catching logic to model activity * Fix timeout * Retry after + fixes * Linting * Only set timeouts for default model provider Migrated-From: temporalio/sdk-python@fe82b07
…dk-python#985) * Add argument validation for the types of provided tools * Specifically check if it is a callable, as Union isn't supported in isinstance * Fix type check with typing.get_args * Fix check Migrated-From: temporalio/sdk-python@8b727e5
* Add test for chat completions model * lint Migrated-From: temporalio/sdk-python@f815886
* Add heartbeat test and fix bug * Reduce intervals for speed * Linting * Skip new test on time skipping server * Update timings Migrated-From: temporalio/sdk-python@d863f5c
* Making summary generation more robust, generally summarize as the last message type input * Remove assert * Remove unused imports * Extend timeout for test stability * Unit test summary, explicitly handle some edge cases * Small fix Migrated-From: temporalio/sdk-python@79f2900
Contributor
There was a problem hiding this comment.
🟡 Changes recommended
The offline suite is incomplete and the imported runtime has unresolved sandbox, tracing, caching, and concurrency defects.
Once you've addressed the issues Copilot identified, you can request another Copilot review.
Pull request overview
Imports the OpenAI Agents integration from the Python SDK with preserved history and packages it as an independently installable plugin.
Changes:
- Adds the
temporalio-openai-agentspackage and migration record. - Adds standalone metadata, dependency locking, build configuration, and transitional overlap safeguards.
- Migrates integration tests, replay histories, offline-test configuration, and provenance checks.
File summaries
| File | Description |
|---|---|
scripts/migrate/IMPORTS.md |
Records the history-preserving import. |
python/_template/tests/helpers/plugin_meta.py |
Updates Python 3.10 TOML compatibility handling. |
python/openai_agents/LICENSE |
Links the repository license. |
python/openai_agents/Makefile |
Uses shared Python plugin targets. |
python/openai_agents/README.md |
Documents usage and transition constraints. |
python/openai_agents/plugin.toml |
Defines plugin, CI, and release metadata. |
python/openai_agents/pyproject.toml |
Configures packaging, dependencies, and tooling. |
python/openai_agents/uv.lock |
Locks plugin dependencies. |
python/openai_agents/src/temporalio/contrib/openai_agents/__init__.py |
Exposes the public plugin API. |
python/openai_agents/src/temporalio/contrib/openai_agents/_errors.py |
Defines workflow errors. |
python/openai_agents/src/temporalio/contrib/openai_agents/_heartbeat_decorator.py |
Adds automatic activity heartbeats. |
python/openai_agents/src/temporalio/contrib/openai_agents/_invoke_model_activity.py |
Implements model activities and streaming. |
python/openai_agents/src/temporalio/contrib/openai_agents/_mcp.py |
Implements durable MCP adapters. |
python/openai_agents/src/temporalio/contrib/openai_agents/_model_parameters.py |
Defines model activity settings. |
python/openai_agents/src/temporalio/contrib/openai_agents/_openai_runner.py |
Adapts Agents runs for workflows. |
python/openai_agents/src/temporalio/contrib/openai_agents/_otel_trace_interceptor.py |
Propagates OpenTelemetry context. |
python/openai_agents/src/temporalio/contrib/openai_agents/_temporal_model_stub.py |
Routes model calls through activities. |
python/openai_agents/src/temporalio/contrib/openai_agents/_temporal_openai_agents.py |
Configures the Temporal plugin. |
python/openai_agents/src/temporalio/contrib/openai_agents/_temporal_trace_provider.py |
Provides replay-aware tracing. |
python/openai_agents/src/temporalio/contrib/openai_agents/_temporal_worker_env_ref.py |
Resolves allowlisted worker secrets. |
python/openai_agents/src/temporalio/contrib/openai_agents/_trace_interceptor.py |
Propagates Agents trace context. |
python/openai_agents/src/temporalio/contrib/openai_agents/py.typed |
Marks the package as typed. |
python/openai_agents/src/temporalio/contrib/openai_agents/testing.py |
Adds plugin testing utilities. |
python/openai_agents/src/temporalio/contrib/openai_agents/workflow.py |
Exposes workflow-side adapters. |
python/openai_agents/src/temporalio/contrib/openai_agents/sandbox/__init__.py |
Defines the sandbox package. |
python/openai_agents/src/temporalio/contrib/openai_agents/sandbox/_sandbox_client_provider.py |
Registers sandbox activities. |
python/openai_agents/src/temporalio/contrib/openai_agents/sandbox/_temporal_activity_models.py |
Defines sandbox payload models. |
python/openai_agents/src/temporalio/contrib/openai_agents/sandbox/_temporal_sandbox_client.py |
Implements the workflow sandbox client. |
python/openai_agents/src/temporalio/contrib/openai_agents/sandbox/_temporal_sandbox_session.py |
Routes sandbox session operations. |
python/openai_agents/src/temporalio/contrib/openai_agents/sandbox/_temporal_worker_env_value.py |
Resolves sandbox environment values. |
python/openai_agents/tests/__init__.py |
Pins the Temporal test server. |
python/openai_agents/tests/conftest.py |
Configures offline tests and provenance checks. |
python/openai_agents/tests/contrib/__init__.py |
Preserves the upstream test package layout. |
python/openai_agents/tests/contrib/openai_agents/__init__.py |
Defines the integration test package. |
python/openai_agents/tests/contrib/openai_agents/test_openai.py |
Covers core integration behavior. |
python/openai_agents/tests/contrib/openai_agents/test_openai_replay.py |
Verifies replay compatibility. |
python/openai_agents/tests/contrib/openai_agents/test_openai_sandbox.py |
Covers sandbox integration. |
python/openai_agents/tests/contrib/openai_agents/test_openai_sandbox_worker_env_value.py |
Covers sandbox secret resolution. |
python/openai_agents/tests/contrib/openai_agents/test_openai_streaming.py |
Covers streaming behavior. |
python/openai_agents/tests/contrib/openai_agents/test_openai_tool_secrets.py |
Covers hosted-tool secrets. |
python/openai_agents/tests/contrib/openai_agents/test_openai_tracing.py |
Covers tracing integration. |
python/openai_agents/tests/contrib/openai_agents/research_agents/__init__.py |
Defines the research fixture package. |
python/openai_agents/tests/contrib/openai_agents/research_agents/planner_agent.py |
Provides a planner fixture. |
python/openai_agents/tests/contrib/openai_agents/research_agents/printer.py |
Provides research progress rendering. |
python/openai_agents/tests/contrib/openai_agents/research_agents/research_manager.py |
Orchestrates research fixtures. |
python/openai_agents/tests/contrib/openai_agents/research_agents/search_agent.py |
Provides a search fixture. |
python/openai_agents/tests/contrib/openai_agents/research_agents/writer_agent.py |
Provides a report-writing fixture. |
python/openai_agents/tests/contrib/openai_agents/histories/agents-as-tools-workflow-history.json |
Adds an agent-tools replay history. |
python/openai_agents/tests/contrib/openai_agents/histories/customer-service-workflow-history.json |
Adds a customer-service replay history. |
python/openai_agents/tests/contrib/openai_agents/histories/hello-workflow-history.json |
Adds a basic replay history. |
python/openai_agents/tests/contrib/openai_agents/histories/input-guardrail-workflow-history.json |
Adds an input-guardrail history. |
python/openai_agents/tests/contrib/openai_agents/histories/output-guardrail-workflow-history.json |
Adds an output-guardrail history. |
python/openai_agents/tests/contrib/openai_agents/histories/research-workflow-history.json |
Adds a research replay history. |
python/openai_agents/tests/contrib/openai_agents/histories/tools-workflow-history.json |
Adds a tools replay history. |
python/openai_agents/tests/helpers/__init__.py |
Provides shared worker helpers. |
python/openai_agents/tests/helpers/nexus.py |
Provides Nexus test naming. |
python/openai_agents/tests/helpers/plugin_meta.py |
Loads plugin metadata in tests. |
python/openai_agents/tests/helpers/provenance.py |
Validates installed-package provenance. |
python/openai_agents/tests/test_installed_matches_source.py |
Compares installed and source files. |
Review details
- Files reviewed: 52/59 changed files
- Comments generated: 9
- Review effort level: Balanced
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
DABH
force-pushed
the
import/python-openai-agents
branch
2 times, most recently
from
September 2, 2026 17:46
e6c8b26 to
2c92faa
Compare
brianstrauch
reviewed
Sep 2, 2026
brianstrauch
reviewed
Sep 2, 2026
brianstrauch
reviewed
Sep 2, 2026
brianstrauch
reviewed
Sep 2, 2026
brianstrauch
reviewed
Sep 2, 2026
brianstrauch
reviewed
Sep 2, 2026
DABH
force-pushed
the
import/python-openai-agents
branch
2 times, most recently
from
September 2, 2026 23:49
690fb37 to
fe3aea6
Compare
DABH
force-pushed
the
import/python-openai-agents
branch
from
September 2, 2026 23:52
fe3aea6 to
aeca25f
Compare
brianstrauch
force-pushed
the
import/python-openai-agents
branch
from
September 3, 2026 17:55
aeca25f to
e22cacf
Compare
…e075c (history preserved; git-filter-repo 2.47.0)
Standalone distribution `temporalio-openai-agents` 1.0.0rc1 built with uv_build into the temporalio.contrib namespace (no parent __init__.py), depending on temporalio[opentelemetry,pydantic] 1.32+, openai-agents 0.19.x, openai, mcp, pydantic and typing-extensions exactly as the code imports them. plugin.toml carries the metadata CI and the release pipeline read; the LICENSE is a symlink to the root license; tests/ mirrors the upstream tree with package markers, the pruned conftest (offline record/replay, provenance guard) and vendored helpers. TRANSITION(sdk-cutover): allow-final stays false and the floor stays 1.32.0 until the SDK release that no longer bundles this module.
PyPI renders this file, so the three links to the sibling workflow_streams README become absolute sdk-python URLs, and an install section with the pre-cutover warning is added at the top. This is the only imported file the adaptation touches; expect a trivial conflict on re-sync if upstream edits these lines.
… plugin.toml The conftest and helpers are byte-identical to python/_template again. The plugin's offline settings are data in plugin.toml [offline]: the placeholder OPENAI_API_KEY for replay and the skips for the real-API arms of the upstream tests (policy: no real provider key anywhere), whose offline twins still run. LICENSE is a committed copy of the root license, kept identical by the conventions check.
brianstrauch
force-pushed
the
import/python-openai-agents
branch
from
September 3, 2026 19:33
e22cacf to
cfb19fa
Compare
brianstrauch
approved these changes
Sep 3, 2026
pingu1m
added a commit
to pingu1m/ai-integrations
that referenced
this pull request
Oct 31, 2026
…n parallel sub-agents All model calls share one Activity type and use the SDK sequence id, and replay compares only the Activity id and type, never the input. When a change reordered two parallel sub-agents' model calls, replay passed and each sub-agent silently received the other's recorded answer. Give a model call dispatched while another model call of the same run is in flight an Activity id built from the call it answers (deepagents.model:<hash>:<turn>, the hash covering the agent name and the whole non-system transcript in dumpd form, with a temporalio#2/#3 suffix for repeats). Sequential calls keep the sequence ids, as does any call whose identity cannot be built, and a caller-set activity_id is left alone. sdk-core's own id check then fails the replay with a nondeterminism error instead of crossing the results. Gated by workflow.patched ("deepagents.parallel-model-call-ids"), asked at a run's first overlapping model call, so runs that never overlap model calls record no marker and their histories do not change. Co-Authored-By: Claude Opus 5.5 <[email protected]>
sohom-cs
added a commit
to sohom-cs/ai-integrations
that referenced
this pull request
Nov 2, 2026
… parallel Two tests over three runs: run k makes k + 1 identical task calls, and every Activity returns a new value. In the first, the calls go one after another: the completed calls, including the "temporalio#1" and "temporalio#2" occurrences, come back from the cache in order, and each later run schedules an Activity for its extra call only. In the second, the calls start together: they are scheduled before any completes, get separate results, and keep their places after continue-as-new. Every run's history is replayed.
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
Imports
temporalio.contrib.openai_agentsfromtemporalio/sdk-python@d0e075c1(2026-09-01main) intopython/openai_agents/with its complete git history, then adds the packaging, metadata and test scaffolding that make it the standalone distributiontemporalio-openai-agents(version1.0.0rc1, GA maturity,allow-final = falseuntil the SDK cutover). Nothing is removed from sdk-python.Stacked on #1 (base branch
bootstrap); retarget tomainonce #1 merges.History
OpenAI agents support (#898)(2025-06-18). Every commit carries aMigrated-From: temporalio/sdk-python@<sha>trailer,#NNNreferences point attemporalio/sdk-python#NNN, no upstream tags imported.git log --followandgit blameon any imported file reach the original authors and dates; the import is recorded inscripts/migrate/IMPORTS.md.scripts/migrate/extract-sdk-python.sh; re-running it against the same upstream state is byte-identical (verified: same tip SHA across three runs), so a later re-sync is a plaingit mergeof new upstream commits.Adaptation (three commits on top of the merge; imported code is untouched except the README)
pyproject.toml(uv_build,module-name = "temporalio.contrib.openai_agents", dependencies declared exactly as imported, cooldown withtemporalioexempted),plugin.toml, two-lineMakefile,LICENSE -> ../../LICENSE,uv.lock,py.typed.tests/mirrors the upstream tree (tests/contrib/openai_agents/...) so re-syncs apply cleanly; pruned vendoredconftest.pywith offline record/replay and the provenance guard; package markers.TRANSITION(sdk-cutover)).Verified locally
make sync && make lint: ruff, pyright, mypy, basedpyright, pydocstyle all clean on the imported code.make build+check_wheel.py+ isolated smoke of wheel and sdist: pass (wheel ships no parent__init__.py, LICENSE andpy.typedpresent; provenance guard passes, SDK overlap reported as the expected pre-cutover warning).OPENAI_API_KEY: 214 passed, 3 skipped, 13 failed. The 13 are exactly the parametrized arms that call the OpenAI API (test_*[False],test_chat_completions_model, threetest_mcp_serverarms); they need cassettes recorded once with a real key (OPENAI_API_KEY=... make record), after which CI runs fully offline. Everything else, including all 7 replay-history tests, passes.Left for a human
cd python/openai_agents && OPENAI_API_KEY=<real key> make record, reviewtests/contrib/openai_agents/cassettes/for secrets (the conventions check also scans), commit.test_file_search_tool[False]references a vector store in a specific OpenAI account, so record from that account or add it toOFFLINE_SKIPS.@temporalio/ai-sdkrepo access; create environmentstestpypi/pypiwith tag policypython/*/v*; TestPyPI and PyPI pending trusted publishers fortemporalio-openai-agents(workflowrelease-python.yml).python/openai_agents/v1.0.0rc1after merge.