Skip to content

Move the AI integration samples to the GA packages - #429

Open
campoy wants to merge 11 commits into
mainfrom
ga-wave/ai-integrations-ga
Open

campoy wants to merge 11 commits into
mainfrom
ga-wave/ai-integrations-ga

Conversation

@campoy

@campoy campoy commented Nov 23, 2026 •

Copy link
Copy Markdown

What was changed

Moves the AI integration samples to the GA packages released on November 17 and 18:

Package Was Now
temporalio-openai-agents 1.0.0 2.0.0
temporalio-google-adk 0.0.1 1.0.0
temporalio-google-genai 0.1.0 1.0.0
temporalio-langgraph 0.1.0 1.0.0
temporalio-langsmith 0.1.1 1.0.0
temporalio-strands-agents 0.1.0 1.0.0 (also in bedrock_agentcore/strands_agent)
temporalio-deepagents 0.0.1 0.1.0

The bump alone breaks some samples, so this also fixes them:

  • OpenAI Agents sandbox: registers the Unix-local sandbox with OnHostSandboxClientProvider and a unique name per Worker process. On 2.0.0, SandboxClientProvider raises ValueError at startup for local backends. A 30-second schedule-to-start timeout bounds the wait for a lost Worker; a Worker that receives an operation for a missing sandbox raises SandboxLost.
  • Model providers: disables tracing with OPENAI_AGENTS_DISABLE_TRACING=1 in all four Workers, including the provider installed by the plugin. The LiteLLM Worker passes LiteLLM through the Workflow sandbox. Also drops "tools must be async". On 2.0.0, function tools run inline in the Workflow, sync or async. Model calls default to a 60-second timeout, so the custom-provider comment says to raise it for slow models instead of saying you must set one.
  • Google ADK: adds the plugin to the Client only. Passing it to the Worker too registers its Activities twice, and Worker(...) raises More than one activity named invoke_model.
  • Strands MCP: the factory returns mcp.Client, and the group installs temporalio-strands-agents[mcp] and mcp>=2. The AgentCore sample uses a new deployment Build ID for the incompatible plugin change.
  • Deep Agents: activity_as_tool takes activity_options, and tool_as_activity runs at module level in a tools.py imported under imports_passed_through(), including the external-storage sample. Called inside run, a fresh Worker fails the tool Activity. The continue-as-new sample adds TodoListMiddleware, because without it the run never continues as new.

The resolver moved some upstream packages too, and a few of those needed changes:

  • MCP SDK 2 (needed by the Strands mcp extra) removed mcp.server.fastmcp, so the five echo, tools and prompt servers now use MCPServer from mcp.server.mcpserver.
  • openai 3 (needed by temporalio-openai-agents 2.0.0) uses httpx2, so the openrouter group moves to openai>=3,<4 and its test mocks httpx2.
  • Langfuse explicitly installs httpx, which its OpenTelemetry instrumentor imports.
  • LiteLLM logging needs sandbox passthrough wherever its process-wide logging filter runs, including the shared test Clients and Worker entry-point tests.
  • Redis tests reset the connection pool after closing the fixture client, so its finalizer cannot import during another test's Worker startup.
  • google-adk 2.14 records token usage with counters, so the ADK metrics test counts those too.
  • external-storage can't share an environment with openai-agents or litellm anymore. openai 3 needs a litellm that needs boto3 1.43 or later, and aioboto3 15.5.0 pins aiobotocore==2.25.1, which needs a boto3 older than 1.40.62. So pyproject.toml declares a uv conflicts entry, poe test and poe lint-types skip that group, a new poe test-external-storage step runs its test in CI, and a separate mypy pass checks that environment. uv sync --group external-storage, as its README says, still works.

Why?

docs.temporal.io copies its integration snippets from these samples, and every integration page sends readers here. Today they run code from before the breaking changes, and a few snippets raise at startup on the new versions.

Checklist

  1. Closes: no issue.

  2. How was this tested:

    • poe test: 250 passed, 2 skipped. poe test-external-storage: 2 passed. poe lint: ruff passes, and mypy finds no issues in 961 files, plus 14 in the external-storage environment.
    • bedrock_agentcore/strands_agent: poe lint and poe test pass (1 test), and its Worker starts.
    • Against temporal server start-dev, each of these Workers started and ran for 12 seconds without raising: the sandbox Worker, the Strands MCP Worker, all 6 ADK Workers and the 3 Deep Agents Workers. On main, the ADK basic Worker and the sandbox Worker raise the two errors above.
    • Continue-as-new, with a scripted model that leaves a pending todo and continue_as_new_after=1: without the middleware, the first run ends COMPLETED; with it, CONTINUED_AS_NEW.
    • Final Docker checks: Python 3.13 has 250 passed and 2 skipped; time-skipping mode has 195 passed and 57 skipped. Python 3.11.9 has 249 passed and 3 skipped. The final Python 3.13 full-suite log has no RestrictedWorkflowAccessError entries.
    • Both Langfuse instrumentation modes start in a clean environment containing only that group. Fresh GA tracing providers remain disabled after all four model-provider entry points, with a dummy OpenAI key set.
    • A no-model-call sandbox check verifies ownership with two Workers on one host and a schedule-to-start timeout after losing the owner.
    • Not run: anything that needs real model keys.
  3. Any docs updates needed? Yes. temporalio/documentation#5813 updates the adjacent prose and refreshes the ADK, local sandbox, Strands MCP, and Deep Agents snippets. It stays draft until this PR merges. The seven sample README prerequisites now say Temporal Python SDK 1.36.0 or later.

Not changed here: openai_agents/mcp_v2 (still on temporalio-openai-agents 1.0.0) and arize_tracing (on 1.1.0) have their own locks. The comments saying other groups still pin MCP v1 are now out of date.

Bump temporalio-openai-agents to 2.0.0, temporalio-google-adk,
temporalio-google-genai, temporalio-langgraph, temporalio-langsmith and
temporalio-strands-agents to 1.0.0, and temporalio-deepagents to 0.1.0.
The strands-agents group now installs the mcp extra and MCP SDK 2.

temporalio-openai-agents 2.0.0 needs openai 3. Every litellm release
that accepts openai 3 needs boto3 1.43 or later, and aioboto3 15.5 needs
boto3 older than 1.40.62. So the external-storage group can't share an
environment with the litellm and openai-agents groups anymore. Declare
that conflict, leave external-storage out of `poe test` and `poe lint`,
and run its test in its own `poe test-external-storage` step in CI.

openai 3 uses httpx2, so the OpenRouter group now needs openai 3 and its
activity test mocks with httpx2. Newer google-adk also records token
counters, which the metrics test now counts too.
MCP SDK 2 renames FastMCP to MCPServer and drops mcp.server.fastmcp.
The shared environment now has MCP SDK 2, which the Strands MCP tools need.
temporalio-openai-agents 2.0.0's SandboxClientProvider refuses the
Docker and Unix-local backends and raises ValueError at startup.
OnHostSandboxClientProvider sends every operation on a sandbox to the
Worker that created it. A restart in the middle of a step loses a local
sandbox, so the README and docstring no longer say it resumes.
Sync function tools work in Workflows in 2.0.0: they run inline, so
they must be fast and deterministic. Model Activities also get a
60-second start-to-close timeout by default, so a custom provider no
longer has to set one.
In temporalio-strands-agents 1.0.0, mcp_clients factories return an
mcp.Client, and a Strands MCPClient fails the Activity without retries.
Tools are listed in an Activity before each model call, not once at
Worker startup, so the docs in the sample say that now.
temporalio-deepagents 0.1.0's activity_as_tool takes activity_options
instead of start_to_close_timeout, so the react agent sample raised
TypeError. Also call tool_as_activity in a tools module imported under
imports_passed_through(): called inside run, the tool is registered only
once a run gets there, and a fresh Worker fails the tool Activity with
DeepAgentsUnknownTool.
run_deep_agent continues as new only while the turn has pending todos,
and create_deep_agent doesn't add the middleware that records them.
Without it, the sample returned after every turn. The snapshot carries
messages and state files, not a result cache, so the docs say that.
A Worker runs its Client's plugins, so passing the plugin to both
registered its Activities twice and Worker(...) raised
"ValueError: More than one activity named invoke_model".
@campoy
campoy requested review from a team as code owners November 23, 2026 18:20
@campoy
campoy requested a review from DABH November 23, 2026 20:19

@DABH DABH 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.

Thanks for doing this! The bumps and the fixes for the breaking changes look right to me, and the claims I checked against the GA packages hold up. I left questions inline, mostly on runtime and docs paths that CI doesn't exercise. Outside the diff, seven READMEs still say these packages need Temporal 1.34.0, but the GA releases need 1.36.0.

Comment thread pyproject.toml
google-genai = ["temporalio-google-genai[mcp]>=0.1.0"]
google-genai = ["temporalio-google-genai[mcp]>=1.0.0"]
langfuse-tracing = [
"openai>=1.4.0",

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.

Should this group add httpx? With openai 3, httpx drops out of a uv sync --group langfuse-tracing env, and opentelemetry-instrumentation-openai-v2 imports it without declaring it, so LLM_INSTRUMENTATION=openai-v2 fails at startup with No module named 'httpx'.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Added httpx to langfuse-tracing and updated the lock. Both openinference and openai-v2 now start in a clean environment containing only that dependency group.

Comment thread pyproject.toml
openai-agents = [
"openai-agents[litellm] >= 0.14.1",
"temporalio-openai-agents >= 1.0.0",
"temporalio-openai-agents >= 2.0.0",

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.

With 2.0.0, does set_tracing_disabled(True) in the model_providers workers still do anything? The plugin installs a new trace provider when the Worker starts, so with OPENAI_API_KEY set those workers send spans to OpenAI, including prompts and completions. Would OPENAI_AGENTS_DISABLE_TRACING=1 work instead?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Replaced the call with OPENAI_AGENTS_DISABLE_TRACING=1 in all four model-provider Workers. With a dummy OPENAI_API_KEY set, a fresh GA trace provider created after each entry point returns NoOpTrace.

Comment on lines +38 to +40
OnHostSandboxClientProvider(
SANDBOX_PROVIDER, UnixLocalSandboxClient()
),

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.

Should this set worker_name, or should the comment say to run one worker per machine? It defaults to the hostname, so two run_worker.py processes on one machine share the local@<host> queue, and an operation picked up by the wrong one fails the run with SandboxLost.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Each Worker process now passes a fresh UUID as worker_name. A routing check with two Workers on the same host confirmed that sandbox operations stay with the owner.

Comment thread openai_agents/sandbox/README.md Outdated
Comment on lines +34 to +35
`SandboxClientProvider`. A worker restart in the middle of a step loses a
local sandbox, and the run fails with the non-retryable `SandboxLost`.

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.

Is this still true when the replacement worker has a different hostname? The next operation goes to the old local@<host> queue, and with no schedule_to_start_timeout the run waits there instead of failing. Should the sample pass one to temporal_sandbox_client()?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Added a 30-second schedule_to_start_timeout, keeping the five-minute start_to_close_timeout. The README and docstring now distinguish a missing owner from a missing sandbox; a lost-owner check with a shorter timeout produced SCHEDULE_TO_START rather than hanging.

dependencies = [
"temporalio>=1.36.0,<2",
"temporalio-strands-agents>=0.1.0",
"temporalio-strands-agents>=1.0.0",

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.

Should BUILD_ID in workflows.py and TEMPORAL_BUILD_ID in agentcore.json change with this? 1.0.0 schedules strands_get_model_config before the first model call, so a pinned run started on the old code hits a nondeterminism error if the new code deploys under the same build ID.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Changed both Build IDs to 1.1.0. The README also says to keep the previous Worker Deployment Version available for its pinned Workflows. The standalone sample’s lint and test tasks pass.

activity_options=ActivityConfig(start_to_close_timeout=timedelta(seconds=30)),
)
# A LangChain tool whose body does I/O, moved into an activity.
search_tool = tool_as_activity(web_search, start_to_close_timeout=timedelta(seconds=30))

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.

Worth a line saying plugin-wide DeepAgentsPlugin(tool_activity_options=...) won't reach tools wrapped at import? run_worker.py imports this module before it builds the plugin, so only the options passed here apply. Same for human_in_the_loop/tools.py.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Added a sentence to both tools modules explaining that options are captured when the tool is wrapped, before the sample creates the plugin. The wrapper timeouts stay explicit.

Comment on lines +55 to +59
# A GC finalizer that imports during sandbox validation can hit Python 3.11's
# import-lock bug (python/cpython#91351). Pause cyclic GC only for this
# synchronous constructor, then restore its previous state.
gc_enabled = gc.isenabled()
gc.disable()

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.

Would client.connection_pool.reset() after aclose() in the fixture fix this at the source? The finalizer that imports is redis-py's ConnectionPool.__del__, and it can run during any test's Worker(...), not just the ones built here.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

That fixes it. The fixture now resets the pool after closing the client, and the GC pause is gone. The full test task completed on Python 3.11.9 with 249 passed and 3 skipped; the final focused Redis and entry-point run also passed all 68 tests without sandbox access errors.

Comment thread pyproject.toml
Comment on lines +148 to +149
lint-types = "uv run --all-groups --no-group cloud-export-to-parquet --no-group external-storage scripts/run_root_tool.py mypy --check-untyped-defs --namespace-packages ."
test = "uv run --all-groups --no-group cloud-export-to-parquet --no-group external-storage pytest --ignore=tests/deepagents_plugin/external_storage_test.py"

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.

Could lint get a mypy pass with the external-storage group too? With ignore_missing_imports, dropping the group here turns the aioboto3, moto and S3 client types into Any. And since poe test now skips that test file without saying so, should the README mention poe test-external-storage?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

poe lint now includes a mypy pass in the external-storage environment, and the README lists both test commands. Both type checks pass: 961 files in the main environment and 14 in the external-storage environment.

Comment thread pyproject.toml Outdated
Comment on lines +118 to +120
# aioboto3 15.5 needs boto3 older than 1.40.62. temporalio-openai-agents 2 needs
# openai 3, and every litellm release that accepts openai 3 needs boto3 1.43 or
# later, so external-storage can't share an environment with these groups.

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.

The group pins aioboto3>=15.1.0,<15.2 and the lock has 15.1.0, so is 15.5 meant as "even the newest aioboto3"? Saying so would keep someone from raising the cap to fix the conflict.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Yes. The comment now states the group’s <15.2 pin first, then makes clear that 15.5 is the comparison showing that lifting the cap alone does not resolve the conflict. The cap is unchanged.

Comment on lines 24 to 27
client,
task_queue="google-adk-agents-basic",
workflows=[HelloWorldAgentWorkflow],
plugins=[plugin],
)

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.

Will the docs follow-up fix the prose next to this snippet? google-adk.mdx still says to pass the same plugin to both the Client and the Worker, which raises More than one activity named invoke_model. The MCPClient text in strands-agents.mdx and the SandboxClientProvider text in openai-agents.mdx have the same problem.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

The docs follow-up fixes all three prose paths and refreshes the related snippets, including the Deep Agents changes. It stays draft until this PR merges. I also updated all seven sample README prerequisites to Temporal Python SDK 1.36.0 or later.

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