From 4b03c060de4b74af93e6acff36130262912f793d Mon Sep 17 00:00:00 2001 From: Brian Strauch Date: Wed, 7 Oct 2026 21:18:01 -0700 Subject: [PATCH 01/13] Migrate AI integration samples to standalone packages --- bedrock_agentcore/strands_agent/README.md | 1 + .../strands_agent/agentcore_worker.py | 2 +- .../strands_agent/pyproject.toml | 3 +- bedrock_agentcore/strands_agent/starter.py | 2 +- bedrock_agentcore/strands_agent/uv.lock | 49 +- bedrock_agentcore/strands_agent/workflows.py | 4 +- deepagents_plugin/README.md | 12 +- .../continue_as_new/run_worker.py | 2 +- deepagents_plugin/continue_as_new/workflow.py | 2 +- .../filesystem_backend/run_worker.py | 2 +- .../filesystem_backend/workflow.py | 2 +- deepagents_plugin/hello_world/run_worker.py | 2 +- .../human_in_the_loop/run_worker.py | 2 +- .../human_in_the_loop/workflow.py | 2 +- deepagents_plugin/langsmith_tracing/README.md | 2 +- deepagents_plugin/langsmith_tracing/main.py | 4 +- deepagents_plugin/react_agent/run_worker.py | 2 +- deepagents_plugin/react_agent/workflow.py | 2 +- deepagents_plugin/streaming/run_worker.py | 2 +- deepagents_plugin/streaming/workflow.py | 2 +- deepagents_plugin/subagents/run_worker.py | 2 +- google_adk_agents/README.md | 5 +- .../run_multi_agent_workflow.py | 2 +- .../agent_patterns/run_worker.py | 2 +- .../workflows/multi_agent_workflow.py | 2 +- .../basic/run_hello_world_workflow.py | 2 +- google_adk_agents/basic/run_worker.py | 2 +- .../basic/workflows/hello_world_workflow.py | 2 +- .../chatbot/run_chatbot_workflow.py | 2 +- google_adk_agents/chatbot/run_worker.py | 2 +- .../chatbot/workflows/chatbot_workflow.py | 2 +- google_adk_agents/mcp/run_echo_workflow.py | 2 +- google_adk_agents/mcp/run_worker.py | 2 +- .../mcp/workflows/echo_workflow.py | 2 +- .../metrics/run_metrics_workflow.py | 2 +- google_adk_agents/metrics/run_worker.py | 2 +- .../metrics/workflows/metrics_workflow.py | 2 +- .../streaming/run_streaming_workflow.py | 2 +- google_adk_agents/streaming/run_worker.py | 2 +- .../streaming/workflows/streaming_workflow.py | 2 +- .../tools/run_weather_workflow.py | 2 +- google_adk_agents/tools/run_worker.py | 2 +- .../tools/workflows/weather_workflow.py | 6 +- google_genai/README.md | 6 +- google_genai/agents/run_worker.py | 2 +- google_genai/agents/workflow.py | 2 +- google_genai/chat/run_worker.py | 2 +- google_genai/chat/workflow.py | 2 +- google_genai/files/run_worker.py | 2 +- google_genai/files/workflow.py | 2 +- google_genai/hello_world/run_worker.py | 2 +- google_genai/hello_world/workflow.py | 2 +- google_genai/interactions/run_worker.py | 2 +- google_genai/interactions/workflow.py | 2 +- google_genai/mcp/run_worker.py | 2 +- google_genai/mcp/workflow.py | 2 +- google_genai/streaming/run_worker.py | 2 +- google_genai/streaming/workflow.py | 2 +- google_genai/structured_output/run_worker.py | 2 +- google_genai/structured_output/workflow.py | 2 +- google_genai/tools/run_worker.py | 2 +- google_genai/tools/workflow.py | 2 +- google_genai/vertex_ai/run_worker.py | 2 +- google_genai/vertex_ai/workflow.py | 2 +- langgraph_plugin/README.md | 6 +- .../continue_as_new/run_worker.py | 2 +- .../continue_as_new/workflow.py | 4 +- .../functional_api/control_flow/run_worker.py | 2 +- .../functional_api/control_flow/workflow.py | 2 +- .../functional_api/hello_world/run_worker.py | 2 +- .../functional_api/hello_world/workflow.py | 2 +- .../human_in_the_loop/run_worker.py | 2 +- .../human_in_the_loop/workflow.py | 2 +- .../functional_api/langsmith_tracing/main.py | 4 +- .../langsmith_tracing/workflow.py | 2 +- .../functional_api/react_agent/run_worker.py | 2 +- .../functional_api/react_agent/workflow.py | 2 +- .../graph_api/continue_as_new/run_worker.py | 2 +- .../graph_api/continue_as_new/workflow.py | 4 +- .../graph_api/hello_world/run_worker.py | 2 +- .../graph_api/hello_world/workflow.py | 2 +- .../graph_api/human_in_the_loop/run_worker.py | 2 +- .../graph_api/human_in_the_loop/workflow.py | 2 +- .../graph_api/langsmith_tracing/main.py | 4 +- .../graph_api/langsmith_tracing/workflow.py | 2 +- .../graph_api/react_agent/run_worker.py | 2 +- .../graph_api/react_agent/workflow.py | 2 +- .../graph_api/streaming/run_worker.py | 2 +- .../graph_api/streaming/workflow.py | 2 +- langsmith_tracing/README.md | 6 +- langsmith_tracing/basic/starter.py | 2 +- langsmith_tracing/basic/worker.py | 2 +- langsmith_tracing/chatbot/starter.py | 2 +- langsmith_tracing/chatbot/worker.py | 2 +- openai_agents/README.md | 3 +- pyproject.toml | 23 +- strands_plugin/README.md | 6 +- .../activity_interrupt/run_worker.py | 2 +- .../activity_interrupt/run_workflow.py | 2 +- strands_plugin/activity_interrupt/workflow.py | 4 +- strands_plugin/continue_as_new/run_worker.py | 2 +- .../continue_as_new/run_workflow.py | 2 +- strands_plugin/continue_as_new/workflow.py | 2 +- strands_plugin/hello_world/run_worker.py | 2 +- strands_plugin/hello_world/workflow.py | 2 +- strands_plugin/hooks/run_worker.py | 2 +- strands_plugin/hooks/workflow.py | 4 +- .../human_in_the_loop/run_worker.py | 2 +- strands_plugin/human_in_the_loop/workflow.py | 2 +- strands_plugin/mcp/run_worker.py | 2 +- strands_plugin/mcp/workflow.py | 2 +- strands_plugin/streaming/run_worker.py | 2 +- strands_plugin/streaming/workflow.py | 2 +- .../structured_output/run_worker.py | 2 +- .../structured_output/run_workflow.py | 2 +- strands_plugin/structured_output/workflow.py | 2 +- strands_plugin/tools/README.md | 2 +- strands_plugin/tools/run_worker.py | 2 +- strands_plugin/tools/workflow.py | 4 +- tests/deepagents_plugin/conftest.py | 14 +- .../deepagents_plugin/continue_as_new_test.py | 4 +- .../filesystem_backend_test.py | 4 +- tests/deepagents_plugin/hello_world_test.py | 4 +- .../human_in_the_loop_test.py | 4 +- tests/deepagents_plugin/react_agent_test.py | 4 +- tests/deepagents_plugin/streaming_test.py | 4 +- tests/deepagents_plugin/subagents_test.py | 4 +- .../google_adk_agents/agent_patterns_test.py | 2 +- tests/google_adk_agents/basic_test.py | 2 +- tests/google_adk_agents/chatbot_test.py | 2 +- tests/google_adk_agents/mcp_test.py | 2 +- tests/google_adk_agents/metrics_test.py | 2 +- tests/google_adk_agents/streaming_test.py | 2 +- tests/google_adk_agents/tools_test.py | 2 +- tests/google_genai/chat_test.py | 2 +- tests/google_genai/hello_world_test.py | 2 +- tests/google_genai/mcp_test.py | 4 +- tests/google_genai/streaming_test.py | 2 +- tests/google_genai/structured_output_test.py | 2 +- tests/google_genai/tools_test.py | 2 +- .../langgraph_plugin/continue_as_new_test.py | 2 +- .../functional_continue_as_new_test.py | 2 +- .../functional_control_flow_test.py | 2 +- .../functional_hello_world_test.py | 2 +- .../functional_human_in_the_loop_test.py | 2 +- .../functional_react_agent_test.py | 2 +- tests/langgraph_plugin/hello_world_test.py | 2 +- .../human_in_the_loop_test.py | 2 +- tests/langgraph_plugin/react_agent_test.py | 2 +- tests/langgraph_plugin/streaming_test.py | 2 +- tests/langsmith_tracing/test_basic.py | 2 +- tests/langsmith_tracing/test_chatbot.py | 2 +- tests/strands_plugin/_mock_model.py | 2 +- .../strands_plugin/activity_interrupt_test.py | 2 +- tests/strands_plugin/continue_as_new_test.py | 2 +- tests/strands_plugin/hello_world_test.py | 2 +- tests/strands_plugin/hooks_test.py | 2 +- .../strands_plugin/human_in_the_loop_test.py | 2 +- tests/strands_plugin/mcp_test.py | 2 +- tests/strands_plugin/streaming_test.py | 2 +- .../strands_plugin/structured_output_test.py | 2 +- tests/strands_plugin/tools_test.py | 2 +- uv.lock | 423 +++++++++++++----- 163 files changed, 556 insertions(+), 339 deletions(-) diff --git a/bedrock_agentcore/strands_agent/README.md b/bedrock_agentcore/strands_agent/README.md index 08ee65723..4303ed1cc 100644 --- a/bedrock_agentcore/strands_agent/README.md +++ b/bedrock_agentcore/strands_agent/README.md @@ -8,6 +8,7 @@ It combines three things: - The [Temporal Strands plugin](https://docs.temporal.io/develop/python/integrations/strands-agents), + installed as the standalone `temporalio-strands-agents` package (requires Temporal 1.34.0 or later), which runs the agent inside a Workflow and turns every model call into a Temporal Activity -- so model invocations get durable retries, timeouts, and crash recovery. diff --git a/bedrock_agentcore/strands_agent/agentcore_worker.py b/bedrock_agentcore/strands_agent/agentcore_worker.py index 12502ca1a..450e69728 100644 --- a/bedrock_agentcore/strands_agent/agentcore_worker.py +++ b/bedrock_agentcore/strands_agent/agentcore_worker.py @@ -25,7 +25,7 @@ from bedrock_agentcore.runtime import BedrockAgentCoreApp from temporalio.client import Client from temporalio.common import VersioningBehavior -from temporalio.contrib.strands import StrandsPlugin +from temporalio.strands_agents import StrandsPlugin from temporalio.worker import ( ActivityInboundInterceptor, ExecuteActivityInput, diff --git a/bedrock_agentcore/strands_agent/pyproject.toml b/bedrock_agentcore/strands_agent/pyproject.toml index 133b935de..9cb221cea 100644 --- a/bedrock_agentcore/strands_agent/pyproject.toml +++ b/bedrock_agentcore/strands_agent/pyproject.toml @@ -7,7 +7,8 @@ requires-python = ">=3.10" readme = "README.md" license = "MIT" dependencies = [ - "temporalio[strands-agents,pydantic]>=1.32.0,<2", + "temporalio>=1.34.0,<2", + "temporalio-strands-agents>=0.1.0", "strands-agents>=1.39.0", "bedrock-agentcore>=1.9.1", "strands-agents-tools>=0.5.2", diff --git a/bedrock_agentcore/strands_agent/starter.py b/bedrock_agentcore/strands_agent/starter.py index 2e1a0352f..431832426 100644 --- a/bedrock_agentcore/strands_agent/starter.py +++ b/bedrock_agentcore/strands_agent/starter.py @@ -2,8 +2,8 @@ import sys from temporalio.client import Client -from temporalio.contrib.strands import StrandsPlugin from temporalio.envconfig import ClientConfig +from temporalio.strands_agents import StrandsPlugin from workflows import TASK_QUEUE, StrandsAgentWorkflow diff --git a/bedrock_agentcore/strands_agent/uv.lock b/bedrock_agentcore/strands_agent/uv.lock index f6e65f58b..fe9374747 100644 --- a/bedrock_agentcore/strands_agent/uv.lock +++ b/bedrock_agentcore/strands_agent/uv.lock @@ -1,5 +1,5 @@ version = 1 -revision = 3 +revision = 5 requires-python = ">=3.10" resolution-markers = [ "python_full_version >= '3.15'", @@ -2471,7 +2471,7 @@ wheels = [ [[package]] name = "temporalio" -version = "1.32.0" +version = "1.34.0" source = { registry = "https://pypi.org/simple" } dependencies = [ { name = "nexus-rpc" }, @@ -2480,23 +2480,15 @@ dependencies = [ { name = "types-protobuf" }, { name = "typing-extensions" }, ] -sdist = { url = "https://files.pythonhosted.org/packages/1b/d8/18cf5bbbcc4b4c884d7723c9b54bf8d1d2556d9fbef3e99599dd3db12034/temporalio-1.32.0.tar.gz", hash = "sha256:2cfa50ec7ebdab66902b80c3a09da3258883d68540811ebfbf44f7f293a4d7d0", size = 2997642, upload-time = "2026-08-24T21:24:37.631Z" } +sdist = { url = "https://files.pythonhosted.org/packages/13/85/9ece6f400552ed21951c8c5c534056e7d015cb065e3384470ec23ac24f28/temporalio-1.34.0.tar.gz", hash = "sha256:6453cb20e18df485e16578b22c82a9c4bcb1cf7eedd94147dfd373551d80f5b6", size = 3163890, upload-time = "2026-09-30T20:22:56.056Z" } wheels = [ - { url = "https://files.pythonhosted.org/packages/37/0b/adad9dcd8b96c760cd04dcc75f0a0f136aabdb78c4b180219589749469a4/temporalio-1.32.0-cp310-abi3-macosx_10_12_x86_64.whl", hash = "sha256:47c128732e5d49235c9daeeb084d55093cee5ebc200ccc3afaeb4468f08d809e", size = 13796063, upload-time = "2026-08-24T21:24:16.638Z" }, - { url = "https://files.pythonhosted.org/packages/d0/84/6cc96518a2aff3ce9fb132479811bb29db563fbcdc947c279df8f089721a/temporalio-1.32.0-cp310-abi3-macosx_11_0_arm64.whl", hash = "sha256:e78a209dc5ef3303bc6a3033fe11ffd813b778e4b176ec18d20386d65952daa9", size = 13467827, upload-time = "2026-08-24T21:24:19.731Z" }, - { url = "https://files.pythonhosted.org/packages/92/d0/720e5e9bb51ae1af6b9fea4d5c56d6ac6e94fbf4c8b86a6b0b318b6aef1e/temporalio-1.32.0-cp310-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:a86be3a6d237ea6cc2d632015a5df4cead2aa3143b9601721428b53b87df81e2", size = 13854003, upload-time = "2026-08-24T21:24:22.743Z" }, - { url = "https://files.pythonhosted.org/packages/e9/6b/8c8973ad314efc8c124e9a0f602ae96533c7e624b3cde7fcc9704aa46dd2/temporalio-1.32.0-cp310-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:4dd44a60ba54901560011a32f085353c0f5e7dac6b8d7a7e0c7c4ba508c6bf5d", size = 14193177, upload-time = "2026-08-24T21:24:25.849Z" }, - { url = "https://files.pythonhosted.org/packages/5b/ad/7496f8424a6ccc9b6ce6c629f9375744e8a439e9a692bd27b4f77b99977a/temporalio-1.32.0-cp310-abi3-musllinux_1_2_aarch64.whl", hash = "sha256:6a7100b1f1bf781f8f1800f89bb787b3dd7ce883e78603442d0c7a40e1143a86", size = 13920043, upload-time = "2026-08-24T21:24:28.667Z" }, - { url = "https://files.pythonhosted.org/packages/5b/16/73fa24d69e70035323217e87d33cb3df6415e1906db07b2112c9a6b09e33/temporalio-1.32.0-cp310-abi3-musllinux_1_2_x86_64.whl", hash = "sha256:311abb9f0650f4ad9f24944ef16d8ed47954ddc3075c1e8c73dcd968d70ccdce", size = 14309243, upload-time = "2026-08-24T21:24:31.727Z" }, - { url = "https://files.pythonhosted.org/packages/07/72/4a49f38f294f9cc1ba15c0b5272adfa7d2a0da38e924ed7f0b1ea2e5bbc9/temporalio-1.32.0-cp310-abi3-win_amd64.whl", hash = "sha256:158386bcd9a6dce1ab63d732fc967c5a5830e15c3012ffaa4b8772bdac099e0f", size = 15196754, upload-time = "2026-08-24T21:24:34.931Z" }, -] - -[package.optional-dependencies] -pydantic = [ - { name = "pydantic" }, -] -strands-agents = [ - { name = "strands-agents" }, + { url = "https://files.pythonhosted.org/packages/3c/71/e55380e7820819357afada375d4e5c33d141bb94a08fda35aa0551b4369b/temporalio-1.34.0-cp310-abi3-macosx_10_12_x86_64.whl", hash = "sha256:87118447ad13e1062b79bfc8b44b1695e8328ac9c6be1776e426e87b501b135a", size = 14064102, upload-time = "2026-09-30T20:22:35.601Z" }, + { url = "https://files.pythonhosted.org/packages/db/78/356c8e2f0ec1678b757d4c5e8a1b0b1c65b15b8afb2335ad2944c158ea10/temporalio-1.34.0-cp310-abi3-macosx_11_0_arm64.whl", hash = "sha256:023fff9cd9dd21860061e003880dcf95250700f5afab96c030c9cb258504dab8", size = 13763219, upload-time = "2026-09-30T20:22:38.774Z" }, + { url = "https://files.pythonhosted.org/packages/e9/00/4a4b4e018c4c12b4691211aca1d97db8707ed4c9e31f40dcf09784c9913d/temporalio-1.34.0-cp310-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:cdb6e2fb525ea5635afa4a3f1ae4c992c16dbe29dc92939a85153baeb69d95a2", size = 14121901, upload-time = "2026-09-30T20:22:41.428Z" }, + { url = "https://files.pythonhosted.org/packages/c1/20/b032d4a0df51d466fd929d8205e1288e83d97a890f021479f43af9bd6f9b/temporalio-1.34.0-cp310-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:540761f738bdfe5cb5bd7240b659e116a0b5094b94282aef09b8d8c2d66e9c52", size = 14457183, upload-time = "2026-09-30T20:22:44.215Z" }, + { url = "https://files.pythonhosted.org/packages/b6/0d/b08ffeca93bbc29200a5bd85a45cca3c6be0a123de605ecd1798b617df4f/temporalio-1.34.0-cp310-abi3-musllinux_1_2_aarch64.whl", hash = "sha256:87647f87f42ecd45efb675642e2ec8ca34aa42359f5968f31f5391f1db5ebcbe", size = 14179836, upload-time = "2026-09-30T20:22:47.474Z" }, + { url = "https://files.pythonhosted.org/packages/81/55/acde4d1b7c9f23434e263752ef0a3ef58adeb3b95ef8472607414798dfaa/temporalio-1.34.0-cp310-abi3-musllinux_1_2_x86_64.whl", hash = "sha256:71caa4b9061628b22a457c87c3b16da40f7ac6ac1a26ece9aa1ee6b4934404d7", size = 14570248, upload-time = "2026-09-30T20:22:50.569Z" }, + { url = "https://files.pythonhosted.org/packages/cc/c5/6bdc3b02ec483093a71e9f887e8a50ae20fcc79e0578ed7435a81d4271b1/temporalio-1.34.0-cp310-abi3-win_amd64.whl", hash = "sha256:03bd86561188c18d88425178bc690fe0791104b78566dcebd98f59cbdbce0952", size = 15415684, upload-time = "2026-09-30T20:22:53.342Z" }, ] [[package]] @@ -2507,7 +2499,8 @@ dependencies = [ { name = "bedrock-agentcore" }, { name = "strands-agents" }, { name = "strands-agents-tools" }, - { name = "temporalio", extra = ["pydantic", "strands-agents"] }, + { name = "temporalio" }, + { name = "temporalio-strands-agents" }, ] [package.dev-dependencies] @@ -2524,7 +2517,8 @@ requires-dist = [ { name = "bedrock-agentcore", specifier = ">=1.9.1" }, { name = "strands-agents", specifier = ">=1.39.0" }, { name = "strands-agents-tools", specifier = ">=0.5.2" }, - { name = "temporalio", extras = ["strands-agents", "pydantic"], specifier = ">=1.32.0,<2" }, + { name = "temporalio", specifier = ">=1.34.0,<2" }, + { name = "temporalio-strands-agents", specifier = ">=0.1.0" }, ] [package.metadata.requires-dev] @@ -2536,6 +2530,21 @@ dev = [ { name = "ruff", specifier = ">=0.5.0,<0.6" }, ] +[[package]] +name = "temporalio-strands-agents" +version = "0.1.0" +source = { registry = "https://pypi.org/simple" } +dependencies = [ + { name = "botocore" }, + { name = "mcp" }, + { name = "strands-agents" }, + { name = "temporalio" }, +] +sdist = { url = "https://files.pythonhosted.org/packages/35/ab/2b2a30df8ef357546e14a151ab114869da541405d99da513a74b9c4fc89f/temporalio_strands_agents-0.1.0.tar.gz", hash = "sha256:1da8ac046004bb83f12cd3c87df278f4c71ee11c2abecfb791928e22c22c3f75", size = 36060, upload-time = "2026-10-07T22:52:50.223Z" } +wheels = [ + { url = "https://files.pythonhosted.org/packages/f5/52/2d8e3126bbfc88f6cf8cbbacf98550ea509e3796885420344b1f49a7eb2d/temporalio_strands_agents-0.1.0-py3-none-any.whl", hash = "sha256:3227ae604e845feeab0f0868fc301d44b299585935dfb42c47d9910234f74e9f", size = 36680, upload-time = "2026-10-07T22:52:49.072Z" }, +] + [[package]] name = "tenacity" version = "9.1.4" diff --git a/bedrock_agentcore/strands_agent/workflows.py b/bedrock_agentcore/strands_agent/workflows.py index 9ad70576d..4d500f3a7 100644 --- a/bedrock_agentcore/strands_agent/workflows.py +++ b/bedrock_agentcore/strands_agent/workflows.py @@ -1,8 +1,8 @@ from datetime import timedelta from temporalio import workflow -from temporalio.contrib.strands import TemporalAgent -from temporalio.contrib.strands.workflow import activity_as_tool +from temporalio.strands_agents import TemporalAgent +from temporalio.strands_agents.workflow import activity_as_tool TASK_QUEUE = "agentcore-strands-task-queue" DEPLOYMENT_NAME = "agentcore-strands-agent-python" diff --git a/deepagents_plugin/README.md b/deepagents_plugin/README.md index 96dfcbf08..7f5d435b9 100644 --- a/deepagents_plugin/README.md +++ b/deepagents_plugin/README.md @@ -1,13 +1,13 @@ # Deep Agents Samples -These samples demonstrate the [Temporal Deep Agents plugin](https://github.com/temporalio/sdk-python/tree/main/temporalio/contrib/deepagents), +These samples demonstrate the [Temporal Deep Agents plugin](https://github.com/temporalio/ai-integrations/tree/main/python/deepagents), which makes [LangChain Deep Agents](https://github.com/langchain-ai/deepagents) durable. Build your agent with `create_deep_agent(...)` inside a `@workflow.defn` and add `DeepAgentsPlugin()` to your client — each LLM call and each I/O tool/backend operation becomes a Temporal Activity, while the agent's control loop runs (and deterministically replays) inside the Workflow. -> **Experimental.** The `temporalio.contrib.deepagents` plugin is experimental +> **Experimental.** The `temporalio.deepagents` plugin is experimental > and its API may change. `DeepAgentsPlugin` is a **client-level** plugin: add it to `Client.connect(...)` @@ -40,9 +40,9 @@ one side. uv sync --group deepagents ``` - > The group installs the `temporalio[deepagents]` extra (released in - > `temporalio` 1.32.0) plus the Anthropic provider package. Requires - > Python >= 3.11 — on older interpreters the group resolves to nothing + > The group installs the standalone `temporalio-deepagents` and + > `temporalio-langsmith` packages plus the Anthropic provider package. Requires + > Temporal 1.34.0 or later and Python >= 3.11 — on older interpreters the group resolves to nothing > and the samples are skipped. 2. Configure a model provider. The samples use @@ -112,6 +112,6 @@ uv run deepagents_plugin/langsmith_tracing/main.py ## Related -- [Temporal Deep Agents plugin](https://github.com/temporalio/sdk-python/tree/main/temporalio/contrib/deepagents) +- [Temporal Deep Agents plugin](https://github.com/temporalio/ai-integrations/tree/main/python/deepagents) - [LangChain Deep Agents](https://github.com/langchain-ai/deepagents) - [langgraph_plugin](../langgraph_plugin) — for agents built directly as LangGraph graphs diff --git a/deepagents_plugin/continue_as_new/run_worker.py b/deepagents_plugin/continue_as_new/run_worker.py index c9a7e8747..5c4ab2f43 100644 --- a/deepagents_plugin/continue_as_new/run_worker.py +++ b/deepagents_plugin/continue_as_new/run_worker.py @@ -4,7 +4,7 @@ import os from temporalio.client import Client -from temporalio.contrib.deepagents import DeepAgentsPlugin +from temporalio.deepagents import DeepAgentsPlugin from temporalio.worker import Worker from deepagents_plugin.continue_as_new.workflow import LongResearchAgent diff --git a/deepagents_plugin/continue_as_new/workflow.py b/deepagents_plugin/continue_as_new/workflow.py index d56aa6578..9b1ae337c 100644 --- a/deepagents_plugin/continue_as_new/workflow.py +++ b/deepagents_plugin/continue_as_new/workflow.py @@ -25,7 +25,7 @@ from deepagents import create_deep_agent from temporalio import workflow -from temporalio.contrib.deepagents import run_deep_agent +from temporalio.deepagents import run_deep_agent @workflow.defn diff --git a/deepagents_plugin/filesystem_backend/run_worker.py b/deepagents_plugin/filesystem_backend/run_worker.py index 722fc1584..89fb0ba37 100644 --- a/deepagents_plugin/filesystem_backend/run_worker.py +++ b/deepagents_plugin/filesystem_backend/run_worker.py @@ -4,7 +4,7 @@ import os from temporalio.client import Client -from temporalio.contrib.deepagents import DeepAgentsPlugin +from temporalio.deepagents import DeepAgentsPlugin from temporalio.worker import Worker from deepagents_plugin.filesystem_backend.workflow import FilesystemAgent diff --git a/deepagents_plugin/filesystem_backend/workflow.py b/deepagents_plugin/filesystem_backend/workflow.py index 67e43775e..49f3d04c1 100644 --- a/deepagents_plugin/filesystem_backend/workflow.py +++ b/deepagents_plugin/filesystem_backend/workflow.py @@ -20,7 +20,7 @@ from deepagents import create_deep_agent from deepagents.backends import FilesystemBackend from temporalio import workflow -from temporalio.contrib.deepagents import TemporalBackend +from temporalio.deepagents import TemporalBackend @workflow.defn diff --git a/deepagents_plugin/hello_world/run_worker.py b/deepagents_plugin/hello_world/run_worker.py index 442f0af4b..680c8c161 100644 --- a/deepagents_plugin/hello_world/run_worker.py +++ b/deepagents_plugin/hello_world/run_worker.py @@ -11,7 +11,7 @@ import os from temporalio.client import Client -from temporalio.contrib.deepagents import DeepAgentsPlugin +from temporalio.deepagents import DeepAgentsPlugin from temporalio.worker import Worker from deepagents_plugin.hello_world.workflow import HelloWorldAgent diff --git a/deepagents_plugin/human_in_the_loop/run_worker.py b/deepagents_plugin/human_in_the_loop/run_worker.py index 1eced08df..3f156300b 100644 --- a/deepagents_plugin/human_in_the_loop/run_worker.py +++ b/deepagents_plugin/human_in_the_loop/run_worker.py @@ -4,7 +4,7 @@ import os from temporalio.client import Client -from temporalio.contrib.deepagents import DeepAgentsPlugin +from temporalio.deepagents import DeepAgentsPlugin from temporalio.worker import Worker from deepagents_plugin.human_in_the_loop.workflow import HumanInTheLoopAgent diff --git a/deepagents_plugin/human_in_the_loop/workflow.py b/deepagents_plugin/human_in_the_loop/workflow.py index fa16f2540..b625a5483 100644 --- a/deepagents_plugin/human_in_the_loop/workflow.py +++ b/deepagents_plugin/human_in_the_loop/workflow.py @@ -26,7 +26,7 @@ from langgraph.checkpoint.memory import InMemorySaver from langgraph.types import Command from temporalio import workflow -from temporalio.contrib.deepagents import tool_as_activity +from temporalio.deepagents import tool_as_activity @workflow.defn diff --git a/deepagents_plugin/langsmith_tracing/README.md b/deepagents_plugin/langsmith_tracing/README.md index fe82bdf9e..0fd89205a 100644 --- a/deepagents_plugin/langsmith_tracing/README.md +++ b/deepagents_plugin/langsmith_tracing/README.md @@ -12,7 +12,7 @@ API keys). ## What This Sample Demonstrates -- Composing `DeepAgentsPlugin` with `temporalio.contrib.langsmith.LangSmithPlugin` +- Composing `DeepAgentsPlugin` with `temporalio.langsmith.LangSmithPlugin` - Order-independent plugin registration ## Running the Sample diff --git a/deepagents_plugin/langsmith_tracing/main.py b/deepagents_plugin/langsmith_tracing/main.py index 555ebc0d1..41b39f11a 100644 --- a/deepagents_plugin/langsmith_tracing/main.py +++ b/deepagents_plugin/langsmith_tracing/main.py @@ -13,8 +13,8 @@ import os from temporalio.client import Client -from temporalio.contrib.deepagents import DeepAgentsPlugin -from temporalio.contrib.langsmith import LangSmithPlugin +from temporalio.deepagents import DeepAgentsPlugin +from temporalio.langsmith import LangSmithPlugin from temporalio.worker import Worker from deepagents_plugin.langsmith_tracing.workflow import TracedAgent diff --git a/deepagents_plugin/react_agent/run_worker.py b/deepagents_plugin/react_agent/run_worker.py index 531375f76..70aee22f3 100644 --- a/deepagents_plugin/react_agent/run_worker.py +++ b/deepagents_plugin/react_agent/run_worker.py @@ -11,7 +11,7 @@ import os from temporalio.client import Client -from temporalio.contrib.deepagents import DeepAgentsPlugin +from temporalio.deepagents import DeepAgentsPlugin from temporalio.worker import Worker from deepagents_plugin.react_agent.workflow import ReactAgent, get_weather diff --git a/deepagents_plugin/react_agent/workflow.py b/deepagents_plugin/react_agent/workflow.py index dfa3c57c6..2a80dad72 100644 --- a/deepagents_plugin/react_agent/workflow.py +++ b/deepagents_plugin/react_agent/workflow.py @@ -23,7 +23,7 @@ from langchain_core.tools import tool from temporalio import activity, workflow -from temporalio.contrib.deepagents import ( +from temporalio.deepagents import ( activity_as_tool, create_temporal_deep_agent, tool_as_activity, diff --git a/deepagents_plugin/streaming/run_worker.py b/deepagents_plugin/streaming/run_worker.py index 024a9e1c4..807c96fe0 100644 --- a/deepagents_plugin/streaming/run_worker.py +++ b/deepagents_plugin/streaming/run_worker.py @@ -9,7 +9,7 @@ import os from temporalio.client import Client -from temporalio.contrib.deepagents import DeepAgentsPlugin +from temporalio.deepagents import DeepAgentsPlugin from temporalio.worker import Worker from deepagents_plugin.streaming.workflow import STREAMING_TOPIC, StreamingWorkflow diff --git a/deepagents_plugin/streaming/workflow.py b/deepagents_plugin/streaming/workflow.py index 3cb0910d3..a69d62b4d 100644 --- a/deepagents_plugin/streaming/workflow.py +++ b/deepagents_plugin/streaming/workflow.py @@ -15,8 +15,8 @@ # @@@SNIPSTART python-deepagents-streaming-workflow from langchain_core.messages import HumanMessage from temporalio import workflow -from temporalio.contrib.deepagents import TemporalModel from temporalio.contrib.workflow_streams import WorkflowStream +from temporalio.deepagents import TemporalModel STREAMING_TOPIC = "model-chunks" diff --git a/deepagents_plugin/subagents/run_worker.py b/deepagents_plugin/subagents/run_worker.py index c5abb5636..fe16443c9 100644 --- a/deepagents_plugin/subagents/run_worker.py +++ b/deepagents_plugin/subagents/run_worker.py @@ -4,7 +4,7 @@ import os from temporalio.client import Client -from temporalio.contrib.deepagents import DeepAgentsPlugin +from temporalio.deepagents import DeepAgentsPlugin from temporalio.worker import Worker from deepagents_plugin.subagents.workflow import SubagentsWorkflow diff --git a/google_adk_agents/README.md b/google_adk_agents/README.md index da21d39e6..18f8f0cbb 100644 --- a/google_adk_agents/README.md +++ b/google_adk_agents/README.md @@ -5,7 +5,7 @@ change prior to General Availability. This directory contains samples demonstrating how to run [Google ADK](https://google.github.io/adk-docs/) agents durably inside Temporal -workflows using `temporalio.contrib.google_adk_agents`. Each scenario is a +workflows using `temporalio.google_adk`. Each scenario is a self-contained subdirectory with its own worker, workflow starter, workflow and activity packages, and README. @@ -27,7 +27,8 @@ model turn is durable and observable. ``` temporal server start-dev ``` -- Dependencies installed via `uv sync --group google-adk` +- Dependencies installed via `uv sync --group google-adk`, including the standalone + `temporalio-google-adk[mcp]` package (requires Temporal 1.34.0 or later) - Google API key set as an environment variable: `export GOOGLE_API_KEY=your_key_here` diff --git a/google_adk_agents/agent_patterns/run_multi_agent_workflow.py b/google_adk_agents/agent_patterns/run_multi_agent_workflow.py index 0ff13edc1..2bf0c87da 100644 --- a/google_adk_agents/agent_patterns/run_multi_agent_workflow.py +++ b/google_adk_agents/agent_patterns/run_multi_agent_workflow.py @@ -2,7 +2,7 @@ import os from temporalio.client import Client -from temporalio.contrib.google_adk_agents import GoogleAdkPlugin +from temporalio.google_adk import GoogleAdkPlugin from google_adk_agents.agent_patterns.workflows.multi_agent_workflow import ( MultiAgentWorkflow, diff --git a/google_adk_agents/agent_patterns/run_worker.py b/google_adk_agents/agent_patterns/run_worker.py index 48eb6e030..57835fa38 100644 --- a/google_adk_agents/agent_patterns/run_worker.py +++ b/google_adk_agents/agent_patterns/run_worker.py @@ -4,7 +4,7 @@ import os from temporalio.client import Client -from temporalio.contrib.google_adk_agents import GoogleAdkPlugin +from temporalio.google_adk import GoogleAdkPlugin from temporalio.worker import Worker from google_adk_agents.agent_patterns.workflows.multi_agent_workflow import ( diff --git a/google_adk_agents/agent_patterns/workflows/multi_agent_workflow.py b/google_adk_agents/agent_patterns/workflows/multi_agent_workflow.py index 749477973..be7f2e7d6 100644 --- a/google_adk_agents/agent_patterns/workflows/multi_agent_workflow.py +++ b/google_adk_agents/agent_patterns/workflows/multi_agent_workflow.py @@ -5,7 +5,7 @@ from google.adk.sessions import InMemorySessionService from google.genai import types from temporalio import workflow -from temporalio.contrib.google_adk_agents import TemporalModel +from temporalio.google_adk import TemporalModel from temporalio.workflow import ActivityConfig diff --git a/google_adk_agents/basic/run_hello_world_workflow.py b/google_adk_agents/basic/run_hello_world_workflow.py index c7fa34697..709b1e22b 100644 --- a/google_adk_agents/basic/run_hello_world_workflow.py +++ b/google_adk_agents/basic/run_hello_world_workflow.py @@ -2,7 +2,7 @@ import os from temporalio.client import Client -from temporalio.contrib.google_adk_agents import GoogleAdkPlugin +from temporalio.google_adk import GoogleAdkPlugin from google_adk_agents.basic.workflows.hello_world_workflow import ( HelloWorldAgentWorkflow, diff --git a/google_adk_agents/basic/run_worker.py b/google_adk_agents/basic/run_worker.py index 4044b4baa..9fa770c08 100644 --- a/google_adk_agents/basic/run_worker.py +++ b/google_adk_agents/basic/run_worker.py @@ -4,7 +4,7 @@ import os from temporalio.client import Client -from temporalio.contrib.google_adk_agents import GoogleAdkPlugin +from temporalio.google_adk import GoogleAdkPlugin from temporalio.worker import Worker from google_adk_agents.basic.workflows.hello_world_workflow import ( diff --git a/google_adk_agents/basic/workflows/hello_world_workflow.py b/google_adk_agents/basic/workflows/hello_world_workflow.py index eee43d5d7..3e6a6d948 100644 --- a/google_adk_agents/basic/workflows/hello_world_workflow.py +++ b/google_adk_agents/basic/workflows/hello_world_workflow.py @@ -3,7 +3,7 @@ from google.adk.utils.context_utils import Aclosing from google.genai import types from temporalio import workflow -from temporalio.contrib.google_adk_agents import TemporalModel +from temporalio.google_adk import TemporalModel # @@@SNIPSTART google-adk-agents-basic-hello-world-agent-workflow diff --git a/google_adk_agents/chatbot/run_chatbot_workflow.py b/google_adk_agents/chatbot/run_chatbot_workflow.py index 00d841f3b..4ca8072cb 100644 --- a/google_adk_agents/chatbot/run_chatbot_workflow.py +++ b/google_adk_agents/chatbot/run_chatbot_workflow.py @@ -2,7 +2,7 @@ import os from temporalio.client import Client -from temporalio.contrib.google_adk_agents import GoogleAdkPlugin +from temporalio.google_adk import GoogleAdkPlugin from google_adk_agents.chatbot.workflows.chatbot_workflow import ( ChatbotAgentWorkflow, diff --git a/google_adk_agents/chatbot/run_worker.py b/google_adk_agents/chatbot/run_worker.py index c199835ff..b3d93e35b 100644 --- a/google_adk_agents/chatbot/run_worker.py +++ b/google_adk_agents/chatbot/run_worker.py @@ -4,7 +4,7 @@ import os from temporalio.client import Client -from temporalio.contrib.google_adk_agents import GoogleAdkPlugin +from temporalio.google_adk import GoogleAdkPlugin from temporalio.worker import Worker from google_adk_agents.chatbot.workflows.chatbot_workflow import ( diff --git a/google_adk_agents/chatbot/workflows/chatbot_workflow.py b/google_adk_agents/chatbot/workflows/chatbot_workflow.py index 5019c2e0b..bdd1b6f6e 100644 --- a/google_adk_agents/chatbot/workflows/chatbot_workflow.py +++ b/google_adk_agents/chatbot/workflows/chatbot_workflow.py @@ -5,7 +5,7 @@ from google.adk.utils.context_utils import Aclosing from google.genai import types from temporalio import workflow -from temporalio.contrib.google_adk_agents import TemporalModel +from temporalio.google_adk import TemporalModel # @@@SNIPSTART google-adk-agents-chatbot-agent-workflow diff --git a/google_adk_agents/mcp/run_echo_workflow.py b/google_adk_agents/mcp/run_echo_workflow.py index d6a8c8b5d..af4bc6d29 100644 --- a/google_adk_agents/mcp/run_echo_workflow.py +++ b/google_adk_agents/mcp/run_echo_workflow.py @@ -2,7 +2,7 @@ import os from temporalio.client import Client -from temporalio.contrib.google_adk_agents import GoogleAdkPlugin +from temporalio.google_adk import GoogleAdkPlugin from google_adk_agents.mcp.workflows.echo_workflow import EchoMcpWorkflow diff --git a/google_adk_agents/mcp/run_worker.py b/google_adk_agents/mcp/run_worker.py index 8c8f6c2a2..fa6489426 100644 --- a/google_adk_agents/mcp/run_worker.py +++ b/google_adk_agents/mcp/run_worker.py @@ -4,7 +4,7 @@ import os from temporalio.client import Client -from temporalio.contrib.google_adk_agents import ( +from temporalio.google_adk import ( GoogleAdkPlugin, TemporalMcpToolSetProvider, ) diff --git a/google_adk_agents/mcp/workflows/echo_workflow.py b/google_adk_agents/mcp/workflows/echo_workflow.py index d3104f704..2d2c3b2ee 100644 --- a/google_adk_agents/mcp/workflows/echo_workflow.py +++ b/google_adk_agents/mcp/workflows/echo_workflow.py @@ -4,7 +4,7 @@ from google.adk.utils.context_utils import Aclosing from google.genai import types from temporalio import workflow -from temporalio.contrib.google_adk_agents import TemporalMcpToolSet, TemporalModel +from temporalio.google_adk import TemporalMcpToolSet, TemporalModel from google_adk_agents.mcp.toolsets import echo_toolset diff --git a/google_adk_agents/metrics/run_metrics_workflow.py b/google_adk_agents/metrics/run_metrics_workflow.py index 63c8d8104..6663c99d8 100644 --- a/google_adk_agents/metrics/run_metrics_workflow.py +++ b/google_adk_agents/metrics/run_metrics_workflow.py @@ -1,7 +1,7 @@ import asyncio from temporalio.client import Client -from temporalio.contrib.google_adk_agents import GoogleAdkPlugin +from temporalio.google_adk import GoogleAdkPlugin from google_adk_agents.metrics.workflows.metrics_workflow import MetricsWorkflow diff --git a/google_adk_agents/metrics/run_worker.py b/google_adk_agents/metrics/run_worker.py index 6ec00f12d..85bacdab0 100644 --- a/google_adk_agents/metrics/run_worker.py +++ b/google_adk_agents/metrics/run_worker.py @@ -11,7 +11,7 @@ async def main() -> None: from google.adk.models import LLMRegistry from prometheus_client import start_http_server from temporalio.client import Client - from temporalio.contrib.google_adk_agents import GoogleAdkPlugin + from temporalio.google_adk import GoogleAdkPlugin from temporalio.worker import Worker from google_adk_agents.metrics.models.local_metrics_model import LocalMetricsModel diff --git a/google_adk_agents/metrics/workflows/metrics_workflow.py b/google_adk_agents/metrics/workflows/metrics_workflow.py index 7c9aa8fe6..3013fa153 100644 --- a/google_adk_agents/metrics/workflows/metrics_workflow.py +++ b/google_adk_agents/metrics/workflows/metrics_workflow.py @@ -3,7 +3,7 @@ from google.adk.utils.context_utils import Aclosing from google.genai import types from temporalio import workflow -from temporalio.contrib.google_adk_agents import TemporalModel +from temporalio.google_adk import TemporalModel from google_adk_agents.metrics.models.local_metrics_model import MODEL_NAME diff --git a/google_adk_agents/streaming/run_streaming_workflow.py b/google_adk_agents/streaming/run_streaming_workflow.py index b371e96e6..71785b6ba 100644 --- a/google_adk_agents/streaming/run_streaming_workflow.py +++ b/google_adk_agents/streaming/run_streaming_workflow.py @@ -4,8 +4,8 @@ from google.adk.models.llm_response import LlmResponse from temporalio.client import Client -from temporalio.contrib.google_adk_agents import GoogleAdkPlugin from temporalio.contrib.workflow_streams import WorkflowStreamClient +from temporalio.google_adk import GoogleAdkPlugin from google_adk_agents.streaming.workflows.streaming_workflow import ( StreamingAgentWorkflow, diff --git a/google_adk_agents/streaming/run_worker.py b/google_adk_agents/streaming/run_worker.py index cbf8f76af..25d51cce2 100644 --- a/google_adk_agents/streaming/run_worker.py +++ b/google_adk_agents/streaming/run_worker.py @@ -4,7 +4,7 @@ import os from temporalio.client import Client -from temporalio.contrib.google_adk_agents import GoogleAdkPlugin +from temporalio.google_adk import GoogleAdkPlugin from temporalio.worker import Worker from google_adk_agents.streaming.workflows.streaming_workflow import ( diff --git a/google_adk_agents/streaming/workflows/streaming_workflow.py b/google_adk_agents/streaming/workflows/streaming_workflow.py index 1a5d76149..4567c6763 100644 --- a/google_adk_agents/streaming/workflows/streaming_workflow.py +++ b/google_adk_agents/streaming/workflows/streaming_workflow.py @@ -3,8 +3,8 @@ from google.adk.runners import InMemoryRunner from google.genai import types from temporalio import workflow -from temporalio.contrib.google_adk_agents import TemporalModel from temporalio.contrib.workflow_streams import WorkflowStream +from temporalio.google_adk import TemporalModel # @@@SNIPSTART google-adk-agents-streaming-streaming-agent-workflow diff --git a/google_adk_agents/tools/run_weather_workflow.py b/google_adk_agents/tools/run_weather_workflow.py index e775a0db1..6ce1a20c3 100644 --- a/google_adk_agents/tools/run_weather_workflow.py +++ b/google_adk_agents/tools/run_weather_workflow.py @@ -2,7 +2,7 @@ import os from temporalio.client import Client -from temporalio.contrib.google_adk_agents import GoogleAdkPlugin +from temporalio.google_adk import GoogleAdkPlugin from google_adk_agents.tools.workflows.weather_workflow import WeatherAgentWorkflow diff --git a/google_adk_agents/tools/run_worker.py b/google_adk_agents/tools/run_worker.py index 71aee072e..572f7ffb9 100644 --- a/google_adk_agents/tools/run_worker.py +++ b/google_adk_agents/tools/run_worker.py @@ -4,7 +4,7 @@ import os from temporalio.client import Client -from temporalio.contrib.google_adk_agents import GoogleAdkPlugin +from temporalio.google_adk import GoogleAdkPlugin from temporalio.worker import Worker from google_adk_agents.tools.activities.weather_activity import get_weather diff --git a/google_adk_agents/tools/workflows/weather_workflow.py b/google_adk_agents/tools/workflows/weather_workflow.py index 0d0874ad1..c99816191 100644 --- a/google_adk_agents/tools/workflows/weather_workflow.py +++ b/google_adk_agents/tools/workflows/weather_workflow.py @@ -1,12 +1,12 @@ from datetime import timedelta -import temporalio.contrib.google_adk_agents.workflow +import temporalio.google_adk.workflow from google.adk import Agent from google.adk.runners import InMemoryRunner from google.adk.utils.context_utils import Aclosing from google.genai import types from temporalio import workflow -from temporalio.contrib.google_adk_agents import TemporalModel +from temporalio.google_adk import TemporalModel from google_adk_agents.tools.activities.weather_activity import get_weather @@ -18,7 +18,7 @@ class WeatherAgentWorkflow: async def run(self, prompt: str) -> str: # activity_as_tool runs the tool call as a real Temporal activity, so it's # retryable and shows up in history. - weather_tool = temporalio.contrib.google_adk_agents.workflow.activity_as_tool( + weather_tool = temporalio.google_adk.workflow.activity_as_tool( get_weather, start_to_close_timeout=timedelta(seconds=60) ) diff --git a/google_genai/README.md b/google_genai/README.md index 4b49b0e96..5bfdc9f8e 100644 --- a/google_genai/README.md +++ b/google_genai/README.md @@ -1,6 +1,6 @@ # Google GenAI Samples -These samples demonstrate the [Temporal Google GenAI plugin](https://github.com/temporalio/sdk-python/tree/main/temporalio/contrib/google_genai), which runs the [Google Gemini SDK](https://googleapis.github.io/python-genai/) inside Temporal Workflows. Workflows construct a `TemporalAsyncClient`, and every Gemini API call — `generate_content`, tool calls, streaming, files, interactions, agents — runs as a Temporal Activity. You get durable execution, Temporal-managed retries and timeouts, and your credentials never enter the workflow or its event history. +These samples demonstrate the [Temporal Google GenAI plugin](https://github.com/temporalio/ai-integrations/tree/main/python/google_genai), which runs the [Google Gemini SDK](https://googleapis.github.io/python-genai/) inside Temporal Workflows. Workflows construct a `TemporalAsyncClient`, and every Gemini API call — `generate_content`, tool calls, streaming, files, interactions, agents — runs as a Temporal Activity. You get durable execution, Temporal-managed retries and timeouts, and your credentials never enter the workflow or its event history. ## Samples @@ -25,6 +25,8 @@ These samples demonstrate the [Temporal Google GenAI plugin](https://github.com/ uv sync --group google-genai ``` + This installs the standalone `temporalio-google-genai[mcp]` package, which requires Temporal 1.34.0 or later. + 2. Configure credentials. Most samples use the Gemini Developer API and read an API key from the environment: ```bash @@ -72,5 +74,5 @@ uv run google_genai/tools/run_workflow.py ## Related -- [Temporal Google GenAI plugin docs](https://github.com/temporalio/sdk-python/tree/main/temporalio/contrib/google_genai) +- [Temporal Google GenAI plugin docs](https://github.com/temporalio/ai-integrations/tree/main/python/google_genai) - [Google Gemini SDK (`google-genai`)](https://googleapis.github.io/python-genai/) diff --git a/google_genai/agents/run_worker.py b/google_genai/agents/run_worker.py index 1bd294ba1..1071ab38f 100644 --- a/google_genai/agents/run_worker.py +++ b/google_genai/agents/run_worker.py @@ -6,7 +6,7 @@ from google import genai from temporalio.client import Client -from temporalio.contrib.google_genai import GoogleGenAIPlugin +from temporalio.google_genai import GoogleGenAIPlugin from temporalio.worker import Worker from google_genai.agents.workflow import AgentsWorkflow diff --git a/google_genai/agents/workflow.py b/google_genai/agents/workflow.py index 59277e97a..5bd4d3383 100644 --- a/google_genai/agents/workflow.py +++ b/google_genai/agents/workflow.py @@ -7,7 +7,7 @@ from typing import Any from temporalio import workflow -from temporalio.contrib.google_genai import TemporalAsyncClient +from temporalio.google_genai import TemporalAsyncClient # @@@SNIPSTART python-google-genai-agents-workflow diff --git a/google_genai/chat/run_worker.py b/google_genai/chat/run_worker.py index 3bd56f679..a4ba2155d 100644 --- a/google_genai/chat/run_worker.py +++ b/google_genai/chat/run_worker.py @@ -6,7 +6,7 @@ from google import genai from temporalio.client import Client -from temporalio.contrib.google_genai import GoogleGenAIPlugin +from temporalio.google_genai import GoogleGenAIPlugin from temporalio.worker import Worker from google_genai.chat.workflow import ChatWorkflow diff --git a/google_genai/chat/workflow.py b/google_genai/chat/workflow.py index e1558f233..49544e904 100644 --- a/google_genai/chat/workflow.py +++ b/google_genai/chat/workflow.py @@ -6,7 +6,7 @@ """ from temporalio import workflow -from temporalio.contrib.google_genai import TemporalAsyncClient +from temporalio.google_genai import TemporalAsyncClient # @@@SNIPSTART python-google-genai-chat-workflow diff --git a/google_genai/files/run_worker.py b/google_genai/files/run_worker.py index 5e843ed4b..dce0bcd4f 100644 --- a/google_genai/files/run_worker.py +++ b/google_genai/files/run_worker.py @@ -6,7 +6,7 @@ from google import genai from temporalio.client import Client -from temporalio.contrib.google_genai import GoogleGenAIPlugin +from temporalio.google_genai import GoogleGenAIPlugin from temporalio.worker import Worker from google_genai.files.workflow import FilesWorkflow diff --git a/google_genai/files/workflow.py b/google_genai/files/workflow.py index ab4f9a71e..546eb9994 100644 --- a/google_genai/files/workflow.py +++ b/google_genai/files/workflow.py @@ -9,7 +9,7 @@ from google.genai import types from temporalio import workflow -from temporalio.contrib.google_genai import TemporalAsyncClient +from temporalio.google_genai import TemporalAsyncClient # @@@SNIPSTART python-google-genai-files-workflow diff --git a/google_genai/hello_world/run_worker.py b/google_genai/hello_world/run_worker.py index 422a1b541..a2d42330f 100644 --- a/google_genai/hello_world/run_worker.py +++ b/google_genai/hello_world/run_worker.py @@ -6,7 +6,7 @@ from google import genai from temporalio.client import Client -from temporalio.contrib.google_genai import GoogleGenAIPlugin +from temporalio.google_genai import GoogleGenAIPlugin from temporalio.worker import Worker from google_genai.hello_world.workflow import HelloWorldWorkflow diff --git a/google_genai/hello_world/workflow.py b/google_genai/hello_world/workflow.py index c9664580f..14de4a062 100644 --- a/google_genai/hello_world/workflow.py +++ b/google_genai/hello_world/workflow.py @@ -6,7 +6,7 @@ """ from temporalio import workflow -from temporalio.contrib.google_genai import TemporalAsyncClient +from temporalio.google_genai import TemporalAsyncClient # @@@SNIPSTART python-google-genai-hello-world-workflow diff --git a/google_genai/interactions/run_worker.py b/google_genai/interactions/run_worker.py index 36539f29f..511a7514d 100644 --- a/google_genai/interactions/run_worker.py +++ b/google_genai/interactions/run_worker.py @@ -6,7 +6,7 @@ from google import genai from temporalio.client import Client -from temporalio.contrib.google_genai import GoogleGenAIPlugin +from temporalio.google_genai import GoogleGenAIPlugin from temporalio.worker import Worker from google_genai.interactions.workflow import InteractionsWorkflow diff --git a/google_genai/interactions/workflow.py b/google_genai/interactions/workflow.py index 5c2270946..2c6a52ace 100644 --- a/google_genai/interactions/workflow.py +++ b/google_genai/interactions/workflow.py @@ -9,7 +9,7 @@ from typing import Any from temporalio import workflow -from temporalio.contrib.google_genai import TemporalAsyncClient +from temporalio.google_genai import TemporalAsyncClient # @@@SNIPSTART python-google-genai-interactions-workflow diff --git a/google_genai/mcp/run_worker.py b/google_genai/mcp/run_worker.py index 821c3555b..90df323e2 100644 --- a/google_genai/mcp/run_worker.py +++ b/google_genai/mcp/run_worker.py @@ -16,7 +16,7 @@ from mcp import ClientSession, StdioServerParameters from mcp.client.stdio import stdio_client from temporalio.client import Client -from temporalio.contrib.google_genai import GoogleGenAIPlugin +from temporalio.google_genai import GoogleGenAIPlugin from temporalio.worker import Worker from google_genai.mcp.workflow import McpWorkflow diff --git a/google_genai/mcp/workflow.py b/google_genai/mcp/workflow.py index 207e0a061..ebfd39907 100644 --- a/google_genai/mcp/workflow.py +++ b/google_genai/mcp/workflow.py @@ -10,7 +10,7 @@ from google.genai import types from temporalio import workflow -from temporalio.contrib.google_genai import ( +from temporalio.google_genai import ( TemporalAsyncClient, TemporalMcpClientSession, ) diff --git a/google_genai/streaming/run_worker.py b/google_genai/streaming/run_worker.py index 399242c14..c5718fe10 100644 --- a/google_genai/streaming/run_worker.py +++ b/google_genai/streaming/run_worker.py @@ -6,7 +6,7 @@ from google import genai from temporalio.client import Client -from temporalio.contrib.google_genai import GoogleGenAIPlugin +from temporalio.google_genai import GoogleGenAIPlugin from temporalio.worker import Worker from google_genai.streaming.workflow import StreamingWorkflow diff --git a/google_genai/streaming/workflow.py b/google_genai/streaming/workflow.py index ebf657012..cd2982cb6 100644 --- a/google_genai/streaming/workflow.py +++ b/google_genai/streaming/workflow.py @@ -11,8 +11,8 @@ from datetime import timedelta from temporalio import workflow -from temporalio.contrib.google_genai import TemporalAsyncClient from temporalio.contrib.workflow_streams import WorkflowStream +from temporalio.google_genai import TemporalAsyncClient # A subscriber that crashes before signaling should not pin the workflow open. FINISH_TIMEOUT = timedelta(minutes=5) diff --git a/google_genai/structured_output/run_worker.py b/google_genai/structured_output/run_worker.py index 3b0b2f2fb..974492e02 100644 --- a/google_genai/structured_output/run_worker.py +++ b/google_genai/structured_output/run_worker.py @@ -6,7 +6,7 @@ from google import genai from temporalio.client import Client -from temporalio.contrib.google_genai import GoogleGenAIPlugin +from temporalio.google_genai import GoogleGenAIPlugin from temporalio.worker import Worker from google_genai.structured_output.workflow import StructuredOutputWorkflow diff --git a/google_genai/structured_output/workflow.py b/google_genai/structured_output/workflow.py index b80a75598..9ed3681fa 100644 --- a/google_genai/structured_output/workflow.py +++ b/google_genai/structured_output/workflow.py @@ -9,8 +9,8 @@ from google.genai import types from pydantic import BaseModel from temporalio import workflow -from temporalio.contrib.google_genai import TemporalAsyncClient from temporalio.exceptions import ApplicationError +from temporalio.google_genai import TemporalAsyncClient # @@@SNIPSTART python-google-genai-structured-output-workflow diff --git a/google_genai/tools/run_worker.py b/google_genai/tools/run_worker.py index 05951fa34..67c6ea02e 100644 --- a/google_genai/tools/run_worker.py +++ b/google_genai/tools/run_worker.py @@ -5,7 +5,7 @@ from google import genai from temporalio.client import Client -from temporalio.contrib.google_genai import GoogleGenAIPlugin +from temporalio.google_genai import GoogleGenAIPlugin from temporalio.worker import Worker from google_genai.tools.workflow import ToolsWorkflow, get_weather diff --git a/google_genai/tools/workflow.py b/google_genai/tools/workflow.py index 7c7e73e23..68b9bd428 100644 --- a/google_genai/tools/workflow.py +++ b/google_genai/tools/workflow.py @@ -13,7 +13,7 @@ from google.genai import types from temporalio import activity, workflow -from temporalio.contrib.google_genai import TemporalAsyncClient, activity_as_tool +from temporalio.google_genai import TemporalAsyncClient, activity_as_tool from temporalio.workflow import ActivityConfig diff --git a/google_genai/vertex_ai/run_worker.py b/google_genai/vertex_ai/run_worker.py index 1952a1a4d..79636c972 100644 --- a/google_genai/vertex_ai/run_worker.py +++ b/google_genai/vertex_ai/run_worker.py @@ -10,7 +10,7 @@ from google import genai from temporalio.client import Client -from temporalio.contrib.google_genai import GoogleGenAIPlugin +from temporalio.google_genai import GoogleGenAIPlugin from temporalio.worker import Worker from google_genai.vertex_ai.workflow import VertexAIWorkflow diff --git a/google_genai/vertex_ai/workflow.py b/google_genai/vertex_ai/workflow.py index 31e35aff5..b2c2c926a 100644 --- a/google_genai/vertex_ai/workflow.py +++ b/google_genai/vertex_ai/workflow.py @@ -8,7 +8,7 @@ """ from temporalio import workflow -from temporalio.contrib.google_genai import TemporalAsyncClient +from temporalio.google_genai import TemporalAsyncClient # @@@SNIPSTART python-google-genai-vertex-ai-workflow diff --git a/langgraph_plugin/README.md b/langgraph_plugin/README.md index 8bb8d2c51..4445d2e73 100644 --- a/langgraph_plugin/README.md +++ b/langgraph_plugin/README.md @@ -1,6 +1,6 @@ # LangGraph Plugin Samples -These samples demonstrate the [Temporal LangGraph plugin](https://github.com/temporalio/sdk-python/tree/main/temporalio/contrib/langgraph), which runs LangGraph workflows as durable Temporal workflows. Each LangGraph graph node (Graph API) or `@task` (Functional API) executes directly inside a workflow or as a Temporal activity with automatic retries, timeouts, and crash recovery. +These samples demonstrate the [Temporal LangGraph plugin](https://github.com/temporalio/ai-integrations/tree/main/python/langgraph), which runs LangGraph workflows as durable Temporal workflows. Each LangGraph graph node (Graph API) or `@task` (Functional API) executes directly inside a workflow or as a Temporal activity with automatic retries, timeouts, and crash recovery. Samples are organized by API style: @@ -27,6 +27,8 @@ Samples are organized by API style: uv sync --group langgraph ``` + This installs the standalone `temporalio-langgraph` and `temporalio-langsmith` packages, which require Temporal 1.34.0 or later. + 2. Start a local dev server with the [Temporal CLI](https://docs.temporal.io/cli): ```bash @@ -72,4 +74,4 @@ uv run langgraph_plugin//langsmith_tracing/main.py ## Related -- [Temporal LangGraph plugin docs](https://github.com/temporalio/sdk-python/tree/main/temporalio/contrib/langgraph) +- [Temporal LangGraph plugin docs](https://github.com/temporalio/ai-integrations/tree/main/python/langgraph) diff --git a/langgraph_plugin/functional_api/continue_as_new/run_worker.py b/langgraph_plugin/functional_api/continue_as_new/run_worker.py index a6b6a9d76..035d897e7 100644 --- a/langgraph_plugin/functional_api/continue_as_new/run_worker.py +++ b/langgraph_plugin/functional_api/continue_as_new/run_worker.py @@ -4,7 +4,7 @@ import os from temporalio.client import Client -from temporalio.contrib.langgraph import LangGraphPlugin +from temporalio.langgraph import LangGraphPlugin from temporalio.worker import Worker from langgraph_plugin.functional_api.continue_as_new.workflow import ( diff --git a/langgraph_plugin/functional_api/continue_as_new/workflow.py b/langgraph_plugin/functional_api/continue_as_new/workflow.py index 9810c05ed..946a086ab 100644 --- a/langgraph_plugin/functional_api/continue_as_new/workflow.py +++ b/langgraph_plugin/functional_api/continue_as_new/workflow.py @@ -11,8 +11,8 @@ from langgraph.func import entrypoint, task from temporalio import workflow -from temporalio.contrib.langgraph import cache -from temporalio.contrib.langgraph import entrypoint as temporal_entrypoint +from temporalio.langgraph import cache +from temporalio.langgraph import entrypoint as temporal_entrypoint @task diff --git a/langgraph_plugin/functional_api/control_flow/run_worker.py b/langgraph_plugin/functional_api/control_flow/run_worker.py index 0a73c19f3..0eadcfd40 100644 --- a/langgraph_plugin/functional_api/control_flow/run_worker.py +++ b/langgraph_plugin/functional_api/control_flow/run_worker.py @@ -4,7 +4,7 @@ import os from temporalio.client import Client -from temporalio.contrib.langgraph import LangGraphPlugin +from temporalio.langgraph import LangGraphPlugin from temporalio.worker import Worker from langgraph_plugin.functional_api.control_flow.workflow import ( diff --git a/langgraph_plugin/functional_api/control_flow/workflow.py b/langgraph_plugin/functional_api/control_flow/workflow.py index 383af0076..ab4a38f66 100644 --- a/langgraph_plugin/functional_api/control_flow/workflow.py +++ b/langgraph_plugin/functional_api/control_flow/workflow.py @@ -10,7 +10,7 @@ from langgraph.func import entrypoint, task from temporalio import workflow -from temporalio.contrib.langgraph import entrypoint as temporal_entrypoint +from temporalio.langgraph import entrypoint as temporal_entrypoint @task diff --git a/langgraph_plugin/functional_api/hello_world/run_worker.py b/langgraph_plugin/functional_api/hello_world/run_worker.py index 7039ee027..3ea0d1073 100644 --- a/langgraph_plugin/functional_api/hello_world/run_worker.py +++ b/langgraph_plugin/functional_api/hello_world/run_worker.py @@ -4,7 +4,7 @@ import os from temporalio.client import Client -from temporalio.contrib.langgraph import LangGraphPlugin +from temporalio.langgraph import LangGraphPlugin from temporalio.worker import Worker from langgraph_plugin.functional_api.hello_world.workflow import ( diff --git a/langgraph_plugin/functional_api/hello_world/workflow.py b/langgraph_plugin/functional_api/hello_world/workflow.py index 36552806d..644fead61 100644 --- a/langgraph_plugin/functional_api/hello_world/workflow.py +++ b/langgraph_plugin/functional_api/hello_world/workflow.py @@ -7,7 +7,7 @@ from langgraph.func import entrypoint, task from temporalio import workflow -from temporalio.contrib.langgraph import entrypoint as temporal_entrypoint +from temporalio.langgraph import entrypoint as temporal_entrypoint @task diff --git a/langgraph_plugin/functional_api/human_in_the_loop/run_worker.py b/langgraph_plugin/functional_api/human_in_the_loop/run_worker.py index c8f84b492..13d279afe 100644 --- a/langgraph_plugin/functional_api/human_in_the_loop/run_worker.py +++ b/langgraph_plugin/functional_api/human_in_the_loop/run_worker.py @@ -4,7 +4,7 @@ import os from temporalio.client import Client -from temporalio.contrib.langgraph import LangGraphPlugin +from temporalio.langgraph import LangGraphPlugin from temporalio.worker import Worker from langgraph_plugin.functional_api.human_in_the_loop.workflow import ( diff --git a/langgraph_plugin/functional_api/human_in_the_loop/workflow.py b/langgraph_plugin/functional_api/human_in_the_loop/workflow.py index 45f91931d..9ef80bfc9 100644 --- a/langgraph_plugin/functional_api/human_in_the_loop/workflow.py +++ b/langgraph_plugin/functional_api/human_in_the_loop/workflow.py @@ -13,7 +13,7 @@ from langgraph.func import entrypoint, task from langgraph.types import Command, interrupt from temporalio import workflow -from temporalio.contrib.langgraph import entrypoint as temporal_entrypoint +from temporalio.langgraph import entrypoint as temporal_entrypoint @task diff --git a/langgraph_plugin/functional_api/langsmith_tracing/main.py b/langgraph_plugin/functional_api/langsmith_tracing/main.py index 0d29afb76..90024d6c9 100644 --- a/langgraph_plugin/functional_api/langsmith_tracing/main.py +++ b/langgraph_plugin/functional_api/langsmith_tracing/main.py @@ -8,8 +8,8 @@ import os from temporalio.client import Client -from temporalio.contrib.langgraph import LangGraphPlugin -from temporalio.contrib.langsmith import LangSmithPlugin +from temporalio.langgraph import LangGraphPlugin +from temporalio.langsmith import LangSmithPlugin from temporalio.worker import Worker from langgraph_plugin.functional_api.langsmith_tracing.workflow import ( diff --git a/langgraph_plugin/functional_api/langsmith_tracing/workflow.py b/langgraph_plugin/functional_api/langsmith_tracing/workflow.py index ddea44bcb..06945cbe8 100644 --- a/langgraph_plugin/functional_api/langsmith_tracing/workflow.py +++ b/langgraph_plugin/functional_api/langsmith_tracing/workflow.py @@ -18,7 +18,7 @@ from langgraph.func import entrypoint, task from langsmith import traceable from temporalio import workflow -from temporalio.contrib.langgraph import entrypoint as temporal_entrypoint +from temporalio.langgraph import entrypoint as temporal_entrypoint @traceable(name="format_prompt", run_type="prompt") diff --git a/langgraph_plugin/functional_api/react_agent/run_worker.py b/langgraph_plugin/functional_api/react_agent/run_worker.py index 465e90ad4..eef5d4e76 100644 --- a/langgraph_plugin/functional_api/react_agent/run_worker.py +++ b/langgraph_plugin/functional_api/react_agent/run_worker.py @@ -4,7 +4,7 @@ import os from temporalio.client import Client -from temporalio.contrib.langgraph import LangGraphPlugin +from temporalio.langgraph import LangGraphPlugin from temporalio.worker import Worker from langgraph_plugin.functional_api.react_agent.workflow import ( diff --git a/langgraph_plugin/functional_api/react_agent/workflow.py b/langgraph_plugin/functional_api/react_agent/workflow.py index c61048671..c7106c8b7 100644 --- a/langgraph_plugin/functional_api/react_agent/workflow.py +++ b/langgraph_plugin/functional_api/react_agent/workflow.py @@ -8,7 +8,7 @@ from langgraph.func import entrypoint, task from temporalio import workflow -from temporalio.contrib.langgraph import entrypoint as temporal_entrypoint +from temporalio.langgraph import entrypoint as temporal_entrypoint @task diff --git a/langgraph_plugin/graph_api/continue_as_new/run_worker.py b/langgraph_plugin/graph_api/continue_as_new/run_worker.py index 653874a6b..64761778d 100644 --- a/langgraph_plugin/graph_api/continue_as_new/run_worker.py +++ b/langgraph_plugin/graph_api/continue_as_new/run_worker.py @@ -4,7 +4,7 @@ import os from temporalio.client import Client -from temporalio.contrib.langgraph import LangGraphPlugin +from temporalio.langgraph import LangGraphPlugin from temporalio.worker import Worker from langgraph_plugin.graph_api.continue_as_new.workflow import ( diff --git a/langgraph_plugin/graph_api/continue_as_new/workflow.py b/langgraph_plugin/graph_api/continue_as_new/workflow.py index 1475e63f7..ccfc06b9a 100644 --- a/langgraph_plugin/graph_api/continue_as_new/workflow.py +++ b/langgraph_plugin/graph_api/continue_as_new/workflow.py @@ -11,8 +11,8 @@ from langgraph.graph import START, StateGraph from temporalio import workflow -from temporalio.contrib.langgraph import cache -from temporalio.contrib.langgraph import graph as temporal_graph +from temporalio.langgraph import cache +from temporalio.langgraph import graph as temporal_graph from typing_extensions import TypedDict diff --git a/langgraph_plugin/graph_api/hello_world/run_worker.py b/langgraph_plugin/graph_api/hello_world/run_worker.py index bf2ece96f..446a26f60 100644 --- a/langgraph_plugin/graph_api/hello_world/run_worker.py +++ b/langgraph_plugin/graph_api/hello_world/run_worker.py @@ -4,7 +4,7 @@ import os from temporalio.client import Client -from temporalio.contrib.langgraph import LangGraphPlugin +from temporalio.langgraph import LangGraphPlugin from temporalio.worker import Worker from langgraph_plugin.graph_api.hello_world.workflow import ( diff --git a/langgraph_plugin/graph_api/hello_world/workflow.py b/langgraph_plugin/graph_api/hello_world/workflow.py index 84eafe679..e7ca9df03 100644 --- a/langgraph_plugin/graph_api/hello_world/workflow.py +++ b/langgraph_plugin/graph_api/hello_world/workflow.py @@ -7,7 +7,7 @@ from langgraph.graph import START, StateGraph from temporalio import workflow -from temporalio.contrib.langgraph import graph as temporal_graph +from temporalio.langgraph import graph as temporal_graph from typing_extensions import TypedDict diff --git a/langgraph_plugin/graph_api/human_in_the_loop/run_worker.py b/langgraph_plugin/graph_api/human_in_the_loop/run_worker.py index 2090366c3..554dec05a 100644 --- a/langgraph_plugin/graph_api/human_in_the_loop/run_worker.py +++ b/langgraph_plugin/graph_api/human_in_the_loop/run_worker.py @@ -4,7 +4,7 @@ import os from temporalio.client import Client -from temporalio.contrib.langgraph import LangGraphPlugin +from temporalio.langgraph import LangGraphPlugin from temporalio.worker import Worker from langgraph_plugin.graph_api.human_in_the_loop.workflow import ( diff --git a/langgraph_plugin/graph_api/human_in_the_loop/workflow.py b/langgraph_plugin/graph_api/human_in_the_loop/workflow.py index c407758e3..d0fa00b3c 100644 --- a/langgraph_plugin/graph_api/human_in_the_loop/workflow.py +++ b/langgraph_plugin/graph_api/human_in_the_loop/workflow.py @@ -11,7 +11,7 @@ from langgraph.graph import START, StateGraph from langgraph.types import Command, interrupt from temporalio import workflow -from temporalio.contrib.langgraph import graph as temporal_graph +from temporalio.langgraph import graph as temporal_graph from typing_extensions import TypedDict diff --git a/langgraph_plugin/graph_api/langsmith_tracing/main.py b/langgraph_plugin/graph_api/langsmith_tracing/main.py index 71294f4ad..a5f1c0180 100644 --- a/langgraph_plugin/graph_api/langsmith_tracing/main.py +++ b/langgraph_plugin/graph_api/langsmith_tracing/main.py @@ -8,8 +8,8 @@ import os from temporalio.client import Client -from temporalio.contrib.langgraph import LangGraphPlugin -from temporalio.contrib.langsmith import LangSmithPlugin +from temporalio.langgraph import LangGraphPlugin +from temporalio.langsmith import LangSmithPlugin from temporalio.worker import Worker from langgraph_plugin.graph_api.langsmith_tracing.workflow import ( diff --git a/langgraph_plugin/graph_api/langsmith_tracing/workflow.py b/langgraph_plugin/graph_api/langsmith_tracing/workflow.py index 50649f314..3fa6a5328 100644 --- a/langgraph_plugin/graph_api/langsmith_tracing/workflow.py +++ b/langgraph_plugin/graph_api/langsmith_tracing/workflow.py @@ -18,7 +18,7 @@ from langgraph.graph import START, StateGraph from langsmith import traceable from temporalio import workflow -from temporalio.contrib.langgraph import graph as temporal_graph +from temporalio.langgraph import graph as temporal_graph from typing_extensions import TypedDict diff --git a/langgraph_plugin/graph_api/react_agent/run_worker.py b/langgraph_plugin/graph_api/react_agent/run_worker.py index 04532a325..5c8812b5d 100644 --- a/langgraph_plugin/graph_api/react_agent/run_worker.py +++ b/langgraph_plugin/graph_api/react_agent/run_worker.py @@ -4,7 +4,7 @@ import os from temporalio.client import Client -from temporalio.contrib.langgraph import LangGraphPlugin +from temporalio.langgraph import LangGraphPlugin from temporalio.worker import Worker from langgraph_plugin.graph_api.react_agent.workflow import ( diff --git a/langgraph_plugin/graph_api/react_agent/workflow.py b/langgraph_plugin/graph_api/react_agent/workflow.py index 1bcae10d7..e9a4f0c8a 100644 --- a/langgraph_plugin/graph_api/react_agent/workflow.py +++ b/langgraph_plugin/graph_api/react_agent/workflow.py @@ -14,7 +14,7 @@ from langgraph.graph import END, START, StateGraph from temporalio import workflow -from temporalio.contrib.langgraph import graph as temporal_graph +from temporalio.langgraph import graph as temporal_graph class AgentState(TypedDict): diff --git a/langgraph_plugin/graph_api/streaming/run_worker.py b/langgraph_plugin/graph_api/streaming/run_worker.py index 46e0090ee..c170ca960 100644 --- a/langgraph_plugin/graph_api/streaming/run_worker.py +++ b/langgraph_plugin/graph_api/streaming/run_worker.py @@ -4,7 +4,7 @@ import os from temporalio.client import Client -from temporalio.contrib.langgraph import LangGraphPlugin +from temporalio.langgraph import LangGraphPlugin from temporalio.worker import Worker from langgraph_plugin.graph_api.streaming.workflow import ( diff --git a/langgraph_plugin/graph_api/streaming/workflow.py b/langgraph_plugin/graph_api/streaming/workflow.py index 6eeea2025..374835900 100644 --- a/langgraph_plugin/graph_api/streaming/workflow.py +++ b/langgraph_plugin/graph_api/streaming/workflow.py @@ -20,8 +20,8 @@ from langgraph.config import get_stream_writer from langgraph.graph import START, StateGraph from temporalio import workflow -from temporalio.contrib.langgraph import graph as temporal_graph from temporalio.contrib.workflow_streams import WorkflowStream +from temporalio.langgraph import graph as temporal_graph from typing_extensions import TypedDict diff --git a/langsmith_tracing/README.md b/langsmith_tracing/README.md index 127a80593..1f67b45e7 100644 --- a/langsmith_tracing/README.md +++ b/langsmith_tracing/README.md @@ -1,6 +1,6 @@ # LangSmith Tracing -This sample demonstrates [LangSmith](https://smith.langchain.com/) tracing integration with Temporal workflows using the [`LangSmithPlugin`](https://python.temporal.io/temporalio.contrib.langsmith.html). +This sample demonstrates [LangSmith](https://smith.langchain.com/) tracing integration with Temporal workflows using the [`LangSmithPlugin`](https://github.com/temporalio/ai-integrations/tree/main/python/langsmith). Two examples are included: @@ -15,6 +15,8 @@ Install dependencies: uv sync --group langsmith-tracing ``` +This installs the standalone `temporalio-langsmith` package, which requires Temporal 1.34.0 or later. + Set environment variables: ```bash @@ -44,6 +46,6 @@ Set `add_temporal_runs=True` to also create LangSmith runs for Temporal operatio ## Further Reading - [LangSmith documentation](https://docs.smith.langchain.com/) -- [Temporal Python SDK LangSmith plugin](https://python.temporal.io/temporalio.contrib.langsmith.html) +- [Temporal Python SDK LangSmith plugin](https://github.com/temporalio/ai-integrations/tree/main/python/langsmith) - [LangSmith `@traceable` guide](https://docs.smith.langchain.com/observability/how-to/annotate-code) - [LangSmith `wrap_openai` guide](https://docs.smith.langchain.com/observability/how-to/trace-with-openai) diff --git a/langsmith_tracing/basic/starter.py b/langsmith_tracing/basic/starter.py index 4a2a103a4..f818d3faa 100644 --- a/langsmith_tracing/basic/starter.py +++ b/langsmith_tracing/basic/starter.py @@ -5,8 +5,8 @@ from langsmith import traceable from temporalio.client import Client -from temporalio.contrib.langsmith import LangSmithPlugin from temporalio.envconfig import ClientConfig +from temporalio.langsmith import LangSmithPlugin from langsmith_tracing.basic.workflows import BasicLLMWorkflow diff --git a/langsmith_tracing/basic/worker.py b/langsmith_tracing/basic/worker.py index 941b28c57..888028199 100644 --- a/langsmith_tracing/basic/worker.py +++ b/langsmith_tracing/basic/worker.py @@ -5,8 +5,8 @@ import sys from temporalio.client import Client -from temporalio.contrib.langsmith import LangSmithPlugin from temporalio.envconfig import ClientConfig +from temporalio.langsmith import LangSmithPlugin from temporalio.worker import Worker from langsmith_tracing.basic.activities import call_openai diff --git a/langsmith_tracing/chatbot/starter.py b/langsmith_tracing/chatbot/starter.py index 4d67e794f..1d5b1e3d0 100644 --- a/langsmith_tracing/chatbot/starter.py +++ b/langsmith_tracing/chatbot/starter.py @@ -7,9 +7,9 @@ from langsmith import traceable from temporalio.client import Client -from temporalio.contrib.langsmith import LangSmithPlugin from temporalio.contrib.pydantic import pydantic_data_converter from temporalio.envconfig import ClientConfig +from temporalio.langsmith import LangSmithPlugin from langsmith_tracing.chatbot.workflows import ChatbotWorkflow diff --git a/langsmith_tracing/chatbot/worker.py b/langsmith_tracing/chatbot/worker.py index b2bd2c981..dc839597e 100644 --- a/langsmith_tracing/chatbot/worker.py +++ b/langsmith_tracing/chatbot/worker.py @@ -5,9 +5,9 @@ import sys from temporalio.client import Client -from temporalio.contrib.langsmith import LangSmithPlugin from temporalio.contrib.pydantic import pydantic_data_converter from temporalio.envconfig import ClientConfig +from temporalio.langsmith import LangSmithPlugin from temporalio.worker import Worker from langsmith_tracing.chatbot.activities import call_openai diff --git a/openai_agents/README.md b/openai_agents/README.md index ba563fe43..c0b792255 100644 --- a/openai_agents/README.md +++ b/openai_agents/README.md @@ -5,7 +5,8 @@ This directory contains samples demonstrating how to use the [OpenAI Agents SDK](https://github.com/openai/openai-agents-python) with Temporal's durable execution engine. These samples are adapted from the [OpenAI Agents SDK examples](https://github.com/openai/openai-agents-python/tree/main/examples) and extended with Temporal's durability and orchestration capabilities. -See the [module documentation](https://github.com/temporalio/sdk-python/blob/main/temporalio/contrib/openai_agents/README.md) for more information. +The integration is installed as the standalone `temporalio-openai-agents` package. +See the [module documentation](https://github.com/temporalio/ai-integrations/tree/main/python/openai_agents) for more information. ## Overview diff --git a/pyproject.toml b/pyproject.toml index c84d72e41..ba35108a2 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -6,7 +6,7 @@ authors = [{ name = "Temporal Technologies Inc", email = "sdk@temporal.io" }] requires-python = ">=3.10" readme = "README.md" license = "MIT" -dependencies = ["temporalio>=1.32.0,<2", "protobuf>=5.29.6,<6"] +dependencies = ["temporalio>=1.34.0,<2", "protobuf>=5.29.6,<6"] [project.urls] Homepage = "https://github.com/temporalio/samples-python" @@ -29,11 +29,12 @@ dev = [ ] bedrock = ["boto3>=1.34.92,<2"] deepagents = [ - "temporalio[deepagents,langsmith]>=1.32.0 ; python_version >= '3.11'", + "temporalio-deepagents>=0.0.1 ; python_version >= '3.11'", + "temporalio-langsmith>=0.1.0 ; python_version >= '3.11'", "langchain-anthropic>=1.4.7,<2 ; python_version >= '3.11'", ] dsl = ["pyyaml>=6.0.1,<7", "types-pyyaml>=6.0.12,<7", "dacite>=1.8.1,<2"] -encryption = ["cryptography>=38.0.1,<39", "aiohttp>=3.13.3,<4"] +encryption = ["cryptography>=41.0.5", "aiohttp>=3.13.3,<4"] external-storage = [ "aioboto3>=15.1.0,<15.2", "aiohttp>=3.13.3,<4", @@ -43,15 +44,13 @@ external-storage = [ external-storage-redis = ["redis>=5.0.0,<8"] gevent = ["gevent>=25.4.2 ; python_version >= '3.8'"] google-adk = [ - "temporalio[google-adk,opentelemetry]>=1.32.0,<2", + "temporalio-google-adk[mcp]>=0.0.1", + "temporalio[opentelemetry]>=1.34.0,<2", "google-adk>=2.2.0,<3", "opentelemetry-exporter-prometheus>=0.48b0", "prometheus-client>=0.21", ] -google-genai = [ - "mcp>=1.0.0", - "temporalio[google-genai,pydantic]>=1.32.0", -] +google-genai = ["temporalio-google-genai[mcp]>=0.1.0"] langfuse-tracing = [ "openai>=1.4.0", "temporalio[opentelemetry]>=1.32.0,<2", @@ -63,13 +62,15 @@ langfuse-tracing = [ langsmith-tracing = [ "openai>=1.4.0", "langsmith>=0.7.0", - "temporalio[pydantic,langsmith]>=1.32.0", + "temporalio-langsmith>=0.1.0", + "temporalio[pydantic]>=1.34.0,<2", ] langgraph = [ "langgraph>=1.1.3", "langchain>=0.3.0", "langchain-anthropic>=0.3.0", - "temporalio[langgraph,langsmith]>=1.32.0", + "temporalio-langgraph>=0.1.0", + "temporalio-langsmith>=0.1.0", ] litellm = ["litellm>=1.85.0,<2"] nexus = ["nexus-rpc>=1.1.0,<2"] @@ -89,7 +90,7 @@ strands-agents = [ "strands-agents-tools>=0.5.2", "mcp>=1.0.0", "boto3>=1.34.92,<2", - "temporalio[strands-agents,pydantic]>=1.32.0", + "temporalio-strands-agents>=0.1.0", ] trio-async = ["trio>=0.28.0,<0.29", "trio-asyncio>=0.15.0,<0.16"] cloud-export-to-parquet = [ diff --git a/strands_plugin/README.md b/strands_plugin/README.md index 3fb4e2de7..2636a1fdf 100644 --- a/strands_plugin/README.md +++ b/strands_plugin/README.md @@ -1,6 +1,6 @@ # Strands Agents Samples -These samples demonstrate the [Temporal Strands plugin](https://github.com/temporalio/sdk-python/tree/main/temporalio/contrib/strands), which runs [Strands Agents](https://strandsagents.com/) inside Temporal Workflows. Model invocations, tool calls, and MCP tool calls all execute as Temporal Activities, so you get durable execution, Temporal-managed retries, and timeouts. +These samples demonstrate the [Temporal Strands plugin](https://github.com/temporalio/ai-integrations/tree/main/python/strands_agents), which runs [Strands Agents](https://strandsagents.com/) inside Temporal Workflows. Model invocations, tool calls, and MCP tool calls all execute as Temporal Activities, so you get durable execution, Temporal-managed retries, and timeouts. ## Samples @@ -24,6 +24,8 @@ These samples demonstrate the [Temporal Strands plugin](https://github.com/tempo uv sync --group strands-agents ``` + This installs the standalone `temporalio-strands-agents` package, which requires Temporal 1.34.0 or later. + 2. Configure AWS credentials. The samples use the plugin's default `BedrockModel()`, which picks up the standard AWS SDK credential chain. Make sure the credentials grant access to a Bedrock model in your selected region (e.g., `us-west-2`). ```bash @@ -74,5 +76,5 @@ uv run strands_plugin/tools/run_workflow.py ## Related -- [Temporal Strands plugin docs](https://github.com/temporalio/sdk-python/tree/main/temporalio/contrib/strands) +- [Temporal Strands plugin docs](https://github.com/temporalio/ai-integrations/tree/main/python/strands_agents) - [Strands Agents](https://strandsagents.com/) diff --git a/strands_plugin/activity_interrupt/run_worker.py b/strands_plugin/activity_interrupt/run_worker.py index bfbf96003..43b669ad3 100644 --- a/strands_plugin/activity_interrupt/run_worker.py +++ b/strands_plugin/activity_interrupt/run_worker.py @@ -5,7 +5,7 @@ import os from temporalio.client import Client -from temporalio.contrib.strands import StrandsPlugin +from temporalio.strands_agents import StrandsPlugin from temporalio.worker import Worker from strands_plugin.activity_interrupt.workflow import ( diff --git a/strands_plugin/activity_interrupt/run_workflow.py b/strands_plugin/activity_interrupt/run_workflow.py index 7125c8237..c3aae5b34 100644 --- a/strands_plugin/activity_interrupt/run_workflow.py +++ b/strands_plugin/activity_interrupt/run_workflow.py @@ -4,7 +4,7 @@ import os from temporalio.client import Client -from temporalio.contrib.strands import StrandsPlugin +from temporalio.strands_agents import StrandsPlugin from strands_plugin.activity_interrupt.workflow import ActivityInterruptWorkflow diff --git a/strands_plugin/activity_interrupt/workflow.py b/strands_plugin/activity_interrupt/workflow.py index bf815630b..28e6b07bb 100644 --- a/strands_plugin/activity_interrupt/workflow.py +++ b/strands_plugin/activity_interrupt/workflow.py @@ -14,8 +14,8 @@ from strands.interrupt import Interrupt, InterruptException from strands.types.interrupt import InterruptResponseContent from temporalio import activity, workflow -from temporalio.contrib.strands import TemporalAgent -from temporalio.contrib.strands.workflow import activity_as_tool +from temporalio.strands_agents import TemporalAgent +from temporalio.strands_agents.workflow import activity_as_tool # Tracks names that have been approved out-of-band. In a real system, this # would be a row in a policy database; the human reviewer flips a flag during diff --git a/strands_plugin/continue_as_new/run_worker.py b/strands_plugin/continue_as_new/run_worker.py index 6cd092e4d..348ec9ac7 100644 --- a/strands_plugin/continue_as_new/run_worker.py +++ b/strands_plugin/continue_as_new/run_worker.py @@ -4,7 +4,7 @@ import os from temporalio.client import Client -from temporalio.contrib.strands import StrandsPlugin +from temporalio.strands_agents import StrandsPlugin from temporalio.worker import Worker from strands_plugin.continue_as_new.workflow import ChatWorkflow diff --git a/strands_plugin/continue_as_new/run_workflow.py b/strands_plugin/continue_as_new/run_workflow.py index 2a98f4212..b64bf31f2 100644 --- a/strands_plugin/continue_as_new/run_workflow.py +++ b/strands_plugin/continue_as_new/run_workflow.py @@ -4,7 +4,7 @@ import os from temporalio.client import Client -from temporalio.contrib.strands import StrandsPlugin +from temporalio.strands_agents import StrandsPlugin from strands_plugin.continue_as_new.workflow import ChatInput, ChatWorkflow diff --git a/strands_plugin/continue_as_new/workflow.py b/strands_plugin/continue_as_new/workflow.py index 223a5c429..909a187b0 100644 --- a/strands_plugin/continue_as_new/workflow.py +++ b/strands_plugin/continue_as_new/workflow.py @@ -13,7 +13,7 @@ from strands.types.content import Messages from temporalio import workflow -from temporalio.contrib.strands import TemporalAgent +from temporalio.strands_agents import TemporalAgent @dataclass diff --git a/strands_plugin/hello_world/run_worker.py b/strands_plugin/hello_world/run_worker.py index 17b9ed9da..4f2edfa2e 100644 --- a/strands_plugin/hello_world/run_worker.py +++ b/strands_plugin/hello_world/run_worker.py @@ -5,7 +5,7 @@ import os from temporalio.client import Client -from temporalio.contrib.strands import StrandsPlugin +from temporalio.strands_agents import StrandsPlugin from temporalio.worker import Worker from strands_plugin.hello_world.workflow import HelloWorldWorkflow diff --git a/strands_plugin/hello_world/workflow.py b/strands_plugin/hello_world/workflow.py index 4ee98d9d0..5308366b4 100644 --- a/strands_plugin/hello_world/workflow.py +++ b/strands_plugin/hello_world/workflow.py @@ -4,7 +4,7 @@ from datetime import timedelta from temporalio import workflow -from temporalio.contrib.strands import TemporalAgent +from temporalio.strands_agents import TemporalAgent @workflow.defn diff --git a/strands_plugin/hooks/run_worker.py b/strands_plugin/hooks/run_worker.py index e03a1b9d1..740f7685e 100644 --- a/strands_plugin/hooks/run_worker.py +++ b/strands_plugin/hooks/run_worker.py @@ -4,7 +4,7 @@ import os from temporalio.client import Client -from temporalio.contrib.strands import StrandsPlugin +from temporalio.strands_agents import StrandsPlugin from temporalio.worker import Worker from strands_plugin.hooks.workflow import HooksWorkflow, persist_tool_call diff --git a/strands_plugin/hooks/workflow.py b/strands_plugin/hooks/workflow.py index 2535cc249..22fde6a4f 100644 --- a/strands_plugin/hooks/workflow.py +++ b/strands_plugin/hooks/workflow.py @@ -15,8 +15,8 @@ from strands.hooks import HookProvider, HookRegistry from strands.hooks.events import AfterToolCallEvent from temporalio import activity, workflow -from temporalio.contrib.strands import TemporalAgent -from temporalio.contrib.strands.workflow import activity_as_hook +from temporalio.strands_agents import TemporalAgent +from temporalio.strands_agents.workflow import activity_as_hook # @@@SNIPSTART python-strands-hooks-activity diff --git a/strands_plugin/human_in_the_loop/run_worker.py b/strands_plugin/human_in_the_loop/run_worker.py index 13f4ee3a5..0a0ae8f15 100644 --- a/strands_plugin/human_in_the_loop/run_worker.py +++ b/strands_plugin/human_in_the_loop/run_worker.py @@ -4,7 +4,7 @@ import os from temporalio.client import Client -from temporalio.contrib.strands import StrandsPlugin +from temporalio.strands_agents import StrandsPlugin from temporalio.worker import Worker from strands_plugin.human_in_the_loop.workflow import HumanInTheLoopWorkflow diff --git a/strands_plugin/human_in_the_loop/workflow.py b/strands_plugin/human_in_the_loop/workflow.py index edeec98b0..de63b9961 100644 --- a/strands_plugin/human_in_the_loop/workflow.py +++ b/strands_plugin/human_in_the_loop/workflow.py @@ -12,7 +12,7 @@ from strands.hooks.events import BeforeToolCallEvent from strands.types.interrupt import InterruptResponseContent from temporalio import workflow -from temporalio.contrib.strands import TemporalAgent +from temporalio.strands_agents import TemporalAgent @tool diff --git a/strands_plugin/mcp/run_worker.py b/strands_plugin/mcp/run_worker.py index 772870e87..176768798 100644 --- a/strands_plugin/mcp/run_worker.py +++ b/strands_plugin/mcp/run_worker.py @@ -14,7 +14,7 @@ from mcp import StdioServerParameters, stdio_client from strands.tools.mcp.mcp_client import MCPClient from temporalio.client import Client -from temporalio.contrib.strands import StrandsPlugin +from temporalio.strands_agents import StrandsPlugin from temporalio.worker import Worker from strands_plugin.mcp.workflow import MCPWorkflow diff --git a/strands_plugin/mcp/workflow.py b/strands_plugin/mcp/workflow.py index d83689c6a..73d77eefb 100644 --- a/strands_plugin/mcp/workflow.py +++ b/strands_plugin/mcp/workflow.py @@ -10,7 +10,7 @@ from datetime import timedelta from temporalio import workflow -from temporalio.contrib.strands import TemporalAgent, TemporalMCPClient +from temporalio.strands_agents import TemporalAgent, TemporalMCPClient @workflow.defn diff --git a/strands_plugin/streaming/run_worker.py b/strands_plugin/streaming/run_worker.py index d009de1e4..99a726679 100644 --- a/strands_plugin/streaming/run_worker.py +++ b/strands_plugin/streaming/run_worker.py @@ -4,7 +4,7 @@ import os from temporalio.client import Client -from temporalio.contrib.strands import StrandsPlugin +from temporalio.strands_agents import StrandsPlugin from temporalio.worker import Worker from strands_plugin.streaming.workflow import StreamingWorkflow diff --git a/strands_plugin/streaming/workflow.py b/strands_plugin/streaming/workflow.py index 416f6e6e2..fda65e2f4 100644 --- a/strands_plugin/streaming/workflow.py +++ b/strands_plugin/streaming/workflow.py @@ -10,8 +10,8 @@ from datetime import timedelta from temporalio import workflow -from temporalio.contrib.strands import TemporalAgent from temporalio.contrib.workflow_streams import WorkflowStream +from temporalio.strands_agents import TemporalAgent @workflow.defn diff --git a/strands_plugin/structured_output/run_worker.py b/strands_plugin/structured_output/run_worker.py index 032526f5d..93dc300a2 100644 --- a/strands_plugin/structured_output/run_worker.py +++ b/strands_plugin/structured_output/run_worker.py @@ -4,7 +4,7 @@ import os from temporalio.client import Client -from temporalio.contrib.strands import StrandsPlugin +from temporalio.strands_agents import StrandsPlugin from temporalio.worker import Worker from strands_plugin.structured_output.workflow import StructuredOutputWorkflow diff --git a/strands_plugin/structured_output/run_workflow.py b/strands_plugin/structured_output/run_workflow.py index 9116ae6a9..4e6ff988e 100644 --- a/strands_plugin/structured_output/run_workflow.py +++ b/strands_plugin/structured_output/run_workflow.py @@ -4,7 +4,7 @@ import os from temporalio.client import Client -from temporalio.contrib.strands import StrandsPlugin +from temporalio.strands_agents import StrandsPlugin from strands_plugin.structured_output.workflow import StructuredOutputWorkflow diff --git a/strands_plugin/structured_output/workflow.py b/strands_plugin/structured_output/workflow.py index 3ee6a7a60..169bede80 100644 --- a/strands_plugin/structured_output/workflow.py +++ b/strands_plugin/structured_output/workflow.py @@ -11,7 +11,7 @@ from pydantic import BaseModel, Field from temporalio import workflow -from temporalio.contrib.strands import TemporalAgent +from temporalio.strands_agents import TemporalAgent class PersonInfo(BaseModel): diff --git a/strands_plugin/tools/README.md b/strands_plugin/tools/README.md index 13fc32d84..be2175035 100644 --- a/strands_plugin/tools/README.md +++ b/strands_plugin/tools/README.md @@ -13,7 +13,7 @@ A single prompt exercises all three. The resulting Temporal history shows an `in ## What This Sample Demonstrates - Three coexisting tool surfaces on one agent -- `activity_as_tool` (from `temporalio.contrib.strands.workflow`) carrying per-tool activity options (timeouts) +- `activity_as_tool` (from `temporalio.strands_agents.workflow`) carrying per-tool activity options (timeouts) - Wrapping `strands_tools` tools so runtime host access happens in an activity ## Running the Sample diff --git a/strands_plugin/tools/run_worker.py b/strands_plugin/tools/run_worker.py index bffa83e31..41089d01e 100644 --- a/strands_plugin/tools/run_worker.py +++ b/strands_plugin/tools/run_worker.py @@ -5,7 +5,7 @@ import os from temporalio.client import Client -from temporalio.contrib.strands import StrandsPlugin +from temporalio.strands_agents import StrandsPlugin from temporalio.worker import Worker from strands_plugin.tools.workflow import ( diff --git a/strands_plugin/tools/workflow.py b/strands_plugin/tools/workflow.py index 34aecd3cb..7bd75858a 100644 --- a/strands_plugin/tools/workflow.py +++ b/strands_plugin/tools/workflow.py @@ -15,8 +15,8 @@ from strands.types.tools import ToolUse from strands_tools import environment # type: ignore[import-untyped] from temporalio import activity, workflow -from temporalio.contrib.strands import TemporalAgent -from temporalio.contrib.strands.workflow import activity_as_tool +from temporalio.strands_agents import TemporalAgent +from temporalio.strands_agents.workflow import activity_as_tool @tool diff --git a/tests/deepagents_plugin/conftest.py b/tests/deepagents_plugin/conftest.py index 5392477a5..23ef2dcdf 100644 --- a/tests/deepagents_plugin/conftest.py +++ b/tests/deepagents_plugin/conftest.py @@ -1,8 +1,8 @@ """Collection guard for the Deep Agents plugin tests. -The plugin ships as the `temporalio[deepagents]` extra (temporalio >= -1.32.0), which the `deepagents` dependency group installs on Python >= 3.11. -These test modules import `temporalio.contrib.deepagents` at module load, +The plugin ships as the standalone `temporalio-deepagents` package, which +the `deepagents` dependency group installs on Python >= 3.11. +These test modules import `temporalio.deepagents` at module load, which would raise `ImportError` during collection whenever the plugin's runtime deps are absent — an interpreter below 3.11 (where the group resolves to nothing) or an environment synced without the group — failing @@ -15,8 +15,8 @@ 3.11+ environment synced with the group — the canonical CI run included. The guard performs a real (guarded) import rather than `find_spec`: the -subpackage can exist on disk while its runtime deps do not — e.g. a -plugin-carrying `temporalio` build installed without its extra deps — and +subpackage can exist on disk while its runtime deps do not — e.g. the +standalone plugin installed without its dependencies — and only an actual import proves the test modules can load. The version check runs first so the import is never attempted on interpreters the plugin does not support. When the guard is active, `pytest_report_header` announces it @@ -30,7 +30,7 @@ _plugin_available = False if sys.version_info >= (3, 11): try: - import temporalio.contrib.deepagents # noqa: F401 + import temporalio.deepagents # noqa: F401 _plugin_available = True except ImportError: @@ -44,7 +44,7 @@ def pytest_report_header(config) -> str | None: """Make the guard visible in the pytest header instead of silent.""" if collect_ignore_glob: return ( - "deepagents_plugin: temporalio.contrib.deepagents not importable " + "deepagents_plugin: temporalio.deepagents not importable " "on this interpreter/environment; sample tests NOT collected " "(see tests/deepagents_plugin/conftest.py)" ) diff --git a/tests/deepagents_plugin/continue_as_new_test.py b/tests/deepagents_plugin/continue_as_new_test.py index 0a2420d44..d274140df 100644 --- a/tests/deepagents_plugin/continue_as_new_test.py +++ b/tests/deepagents_plugin/continue_as_new_test.py @@ -3,8 +3,8 @@ from temporalio import workflow from temporalio.client import Client, WorkflowExecutionStatus -from temporalio.contrib.deepagents import DeepAgentsPlugin, run_deep_agent -from temporalio.contrib.deepagents.testing import mock_model_provider +from temporalio.deepagents import DeepAgentsPlugin, run_deep_agent +from temporalio.deepagents.testing import mock_model_provider from temporalio.worker import Worker from deepagents_plugin.continue_as_new.workflow import LongResearchAgent diff --git a/tests/deepagents_plugin/filesystem_backend_test.py b/tests/deepagents_plugin/filesystem_backend_test.py index f7e8712de..c11b051b4 100644 --- a/tests/deepagents_plugin/filesystem_backend_test.py +++ b/tests/deepagents_plugin/filesystem_backend_test.py @@ -2,8 +2,8 @@ from langchain_core.messages import AIMessage from temporalio.client import Client -from temporalio.contrib.deepagents import DeepAgentsPlugin -from temporalio.contrib.deepagents.testing import mock_model_provider +from temporalio.deepagents import DeepAgentsPlugin +from temporalio.deepagents.testing import mock_model_provider from temporalio.worker import Worker from deepagents_plugin.filesystem_backend.workflow import FilesystemAgent diff --git a/tests/deepagents_plugin/hello_world_test.py b/tests/deepagents_plugin/hello_world_test.py index 4c6c46a0a..34adb6deb 100644 --- a/tests/deepagents_plugin/hello_world_test.py +++ b/tests/deepagents_plugin/hello_world_test.py @@ -1,8 +1,8 @@ import uuid from temporalio.client import Client -from temporalio.contrib.deepagents import DeepAgentsPlugin -from temporalio.contrib.deepagents.testing import mock_model_provider +from temporalio.deepagents import DeepAgentsPlugin +from temporalio.deepagents.testing import mock_model_provider from temporalio.worker import Worker from deepagents_plugin.hello_world.workflow import HelloWorldAgent diff --git a/tests/deepagents_plugin/human_in_the_loop_test.py b/tests/deepagents_plugin/human_in_the_loop_test.py index bf137d359..94d073b1d 100644 --- a/tests/deepagents_plugin/human_in_the_loop_test.py +++ b/tests/deepagents_plugin/human_in_the_loop_test.py @@ -4,8 +4,8 @@ import pytest from langchain_core.messages import AIMessage from temporalio.client import Client, WorkflowUpdateFailedError -from temporalio.contrib.deepagents import DeepAgentsPlugin -from temporalio.contrib.deepagents.testing import mock_model_provider +from temporalio.deepagents import DeepAgentsPlugin +from temporalio.deepagents.testing import mock_model_provider from temporalio.worker import Worker from deepagents_plugin.human_in_the_loop.workflow import HumanInTheLoopAgent diff --git a/tests/deepagents_plugin/react_agent_test.py b/tests/deepagents_plugin/react_agent_test.py index a5b52ed90..b571b6e79 100644 --- a/tests/deepagents_plugin/react_agent_test.py +++ b/tests/deepagents_plugin/react_agent_test.py @@ -2,8 +2,8 @@ from langchain_core.messages import AIMessage from temporalio.client import Client -from temporalio.contrib.deepagents import DeepAgentsPlugin -from temporalio.contrib.deepagents.testing import mock_model_provider +from temporalio.deepagents import DeepAgentsPlugin +from temporalio.deepagents.testing import mock_model_provider from temporalio.worker import Worker from deepagents_plugin.react_agent.workflow import ReactAgent, get_weather diff --git a/tests/deepagents_plugin/streaming_test.py b/tests/deepagents_plugin/streaming_test.py index 5cd82ffe9..32e9fe743 100644 --- a/tests/deepagents_plugin/streaming_test.py +++ b/tests/deepagents_plugin/streaming_test.py @@ -4,9 +4,9 @@ from langchain_core.load import load from temporalio.client import Client -from temporalio.contrib.deepagents import DeepAgentsPlugin -from temporalio.contrib.deepagents.testing import mock_model_provider from temporalio.contrib.workflow_streams import WorkflowStreamClient +from temporalio.deepagents import DeepAgentsPlugin +from temporalio.deepagents.testing import mock_model_provider from temporalio.worker import Worker from deepagents_plugin.streaming.workflow import STREAMING_TOPIC, StreamingWorkflow diff --git a/tests/deepagents_plugin/subagents_test.py b/tests/deepagents_plugin/subagents_test.py index f76a582e8..d702d9a54 100644 --- a/tests/deepagents_plugin/subagents_test.py +++ b/tests/deepagents_plugin/subagents_test.py @@ -2,8 +2,8 @@ from langchain_core.messages import AIMessage from temporalio.client import Client -from temporalio.contrib.deepagents import DeepAgentsPlugin -from temporalio.contrib.deepagents.testing import mock_model_provider +from temporalio.deepagents import DeepAgentsPlugin +from temporalio.deepagents.testing import mock_model_provider from temporalio.worker import Worker from deepagents_plugin.subagents.workflow import SubagentsWorkflow diff --git a/tests/google_adk_agents/agent_patterns_test.py b/tests/google_adk_agents/agent_patterns_test.py index d9a3c2592..9fc3840a4 100644 --- a/tests/google_adk_agents/agent_patterns_test.py +++ b/tests/google_adk_agents/agent_patterns_test.py @@ -2,7 +2,7 @@ import pytest from temporalio.client import Client -from temporalio.contrib.google_adk_agents import GoogleAdkPlugin +from temporalio.google_adk import GoogleAdkPlugin from temporalio.worker import Worker from google_adk_agents.agent_patterns.workflows.multi_agent_workflow import ( diff --git a/tests/google_adk_agents/basic_test.py b/tests/google_adk_agents/basic_test.py index a1354e4bb..d98861951 100644 --- a/tests/google_adk_agents/basic_test.py +++ b/tests/google_adk_agents/basic_test.py @@ -2,7 +2,7 @@ import pytest from temporalio.client import Client -from temporalio.contrib.google_adk_agents import GoogleAdkPlugin +from temporalio.google_adk import GoogleAdkPlugin from temporalio.worker import Worker from google_adk_agents.basic.workflows.hello_world_workflow import ( diff --git a/tests/google_adk_agents/chatbot_test.py b/tests/google_adk_agents/chatbot_test.py index af01dc826..e18550aee 100644 --- a/tests/google_adk_agents/chatbot_test.py +++ b/tests/google_adk_agents/chatbot_test.py @@ -3,7 +3,7 @@ import pytest from google.adk.models.llm_request import LlmRequest from temporalio.client import Client -from temporalio.contrib.google_adk_agents import GoogleAdkPlugin +from temporalio.google_adk import GoogleAdkPlugin from temporalio.worker import Worker from google_adk_agents.chatbot.workflows.chatbot_workflow import ( diff --git a/tests/google_adk_agents/mcp_test.py b/tests/google_adk_agents/mcp_test.py index ae8729d0b..e86fbdacf 100644 --- a/tests/google_adk_agents/mcp_test.py +++ b/tests/google_adk_agents/mcp_test.py @@ -2,7 +2,7 @@ import pytest from temporalio.client import Client -from temporalio.contrib.google_adk_agents import ( +from temporalio.google_adk import ( GoogleAdkPlugin, TemporalMcpToolSetProvider, ) diff --git a/tests/google_adk_agents/metrics_test.py b/tests/google_adk_agents/metrics_test.py index 2cd7f4fc1..4e39a7422 100644 --- a/tests/google_adk_agents/metrics_test.py +++ b/tests/google_adk_agents/metrics_test.py @@ -4,7 +4,7 @@ from google.adk.models import BaseLlm, LLMRegistry from opentelemetry.sdk.metrics.export import HistogramDataPoint, InMemoryMetricReader from temporalio.client import Client -from temporalio.contrib.google_adk_agents import GoogleAdkPlugin +from temporalio.google_adk import GoogleAdkPlugin from temporalio.worker import Replayer, Worker from google_adk_agents.metrics.models.local_metrics_model import ( diff --git a/tests/google_adk_agents/streaming_test.py b/tests/google_adk_agents/streaming_test.py index 5c1d78a87..2d295ce38 100644 --- a/tests/google_adk_agents/streaming_test.py +++ b/tests/google_adk_agents/streaming_test.py @@ -5,8 +5,8 @@ import pytest from google.adk.models.llm_response import LlmResponse from temporalio.client import Client -from temporalio.contrib.google_adk_agents import GoogleAdkPlugin from temporalio.contrib.workflow_streams import WorkflowStreamClient +from temporalio.google_adk import GoogleAdkPlugin from temporalio.worker import Worker from google_adk_agents.streaming.workflows.streaming_workflow import ( diff --git a/tests/google_adk_agents/tools_test.py b/tests/google_adk_agents/tools_test.py index d80817e35..fd1f8ae97 100644 --- a/tests/google_adk_agents/tools_test.py +++ b/tests/google_adk_agents/tools_test.py @@ -2,7 +2,7 @@ import pytest from temporalio.client import Client -from temporalio.contrib.google_adk_agents import GoogleAdkPlugin +from temporalio.google_adk import GoogleAdkPlugin from temporalio.worker import Worker from google_adk_agents.tools.activities.weather_activity import get_weather diff --git a/tests/google_genai/chat_test.py b/tests/google_genai/chat_test.py index 504a630b4..89973fa3a 100644 --- a/tests/google_genai/chat_test.py +++ b/tests/google_genai/chat_test.py @@ -1,7 +1,7 @@ import uuid from temporalio.client import Client -from temporalio.contrib.google_genai.testing import GeminiTestServer, text_response +from temporalio.google_genai.testing import GeminiTestServer, text_response from temporalio.worker import Worker from google_genai.chat.workflow import ChatWorkflow diff --git a/tests/google_genai/hello_world_test.py b/tests/google_genai/hello_world_test.py index c612885c1..862185c12 100644 --- a/tests/google_genai/hello_world_test.py +++ b/tests/google_genai/hello_world_test.py @@ -1,7 +1,7 @@ import uuid from temporalio.client import Client -from temporalio.contrib.google_genai.testing import GeminiTestServer, text_response +from temporalio.google_genai.testing import GeminiTestServer, text_response from temporalio.worker import Worker from google_genai.hello_world.workflow import HelloWorldWorkflow diff --git a/tests/google_genai/mcp_test.py b/tests/google_genai/mcp_test.py index e5913ad1c..f6b66d6be 100644 --- a/tests/google_genai/mcp_test.py +++ b/tests/google_genai/mcp_test.py @@ -10,8 +10,8 @@ from mcp import ClientSession, StdioServerParameters from mcp.client.stdio import stdio_client from temporalio.client import Client -from temporalio.contrib.google_genai import GoogleGenAIPlugin -from temporalio.contrib.google_genai.testing import ( +from temporalio.google_genai import GoogleGenAIPlugin +from temporalio.google_genai.testing import ( function_call_response, text_response, ) diff --git a/tests/google_genai/streaming_test.py b/tests/google_genai/streaming_test.py index dec695586..28a4d2490 100644 --- a/tests/google_genai/streaming_test.py +++ b/tests/google_genai/streaming_test.py @@ -3,8 +3,8 @@ from google.genai import types from temporalio.client import Client -from temporalio.contrib.google_genai.testing import GeminiTestServer, text_response from temporalio.contrib.workflow_streams import WorkflowStreamClient +from temporalio.google_genai.testing import GeminiTestServer, text_response from temporalio.worker import Worker from google_genai.streaming.workflow import StreamingWorkflow diff --git a/tests/google_genai/structured_output_test.py b/tests/google_genai/structured_output_test.py index 6e93c2ede..eecc7ea30 100644 --- a/tests/google_genai/structured_output_test.py +++ b/tests/google_genai/structured_output_test.py @@ -2,7 +2,7 @@ import uuid from temporalio.client import Client -from temporalio.contrib.google_genai.testing import GeminiTestServer, text_response +from temporalio.google_genai.testing import GeminiTestServer, text_response from temporalio.worker import Worker from google_genai.structured_output.workflow import ( diff --git a/tests/google_genai/tools_test.py b/tests/google_genai/tools_test.py index b657fd1fd..119763c0b 100644 --- a/tests/google_genai/tools_test.py +++ b/tests/google_genai/tools_test.py @@ -1,7 +1,7 @@ import uuid from temporalio.client import Client -from temporalio.contrib.google_genai.testing import ( +from temporalio.google_genai.testing import ( GeminiTestServer, function_call_response, text_response, diff --git a/tests/langgraph_plugin/continue_as_new_test.py b/tests/langgraph_plugin/continue_as_new_test.py index 71392f5f7..7b438fce5 100644 --- a/tests/langgraph_plugin/continue_as_new_test.py +++ b/tests/langgraph_plugin/continue_as_new_test.py @@ -2,7 +2,7 @@ from datetime import timedelta from temporalio.client import Client -from temporalio.contrib.langgraph import LangGraphPlugin +from temporalio.langgraph import LangGraphPlugin from temporalio.worker import Worker from langgraph_plugin.graph_api.continue_as_new.workflow import ( diff --git a/tests/langgraph_plugin/functional_continue_as_new_test.py b/tests/langgraph_plugin/functional_continue_as_new_test.py index 9d627d629..b3e9c6a57 100644 --- a/tests/langgraph_plugin/functional_continue_as_new_test.py +++ b/tests/langgraph_plugin/functional_continue_as_new_test.py @@ -4,7 +4,7 @@ import pytest from temporalio.client import Client -from temporalio.contrib.langgraph import LangGraphPlugin +from temporalio.langgraph import LangGraphPlugin from temporalio.worker import Worker from langgraph_plugin.functional_api.continue_as_new.workflow import ( diff --git a/tests/langgraph_plugin/functional_control_flow_test.py b/tests/langgraph_plugin/functional_control_flow_test.py index a8fd337af..30f03873e 100644 --- a/tests/langgraph_plugin/functional_control_flow_test.py +++ b/tests/langgraph_plugin/functional_control_flow_test.py @@ -3,7 +3,7 @@ import pytest from temporalio.client import Client -from temporalio.contrib.langgraph import LangGraphPlugin +from temporalio.langgraph import LangGraphPlugin from temporalio.worker import Worker from langgraph_plugin.functional_api.control_flow.workflow import ( diff --git a/tests/langgraph_plugin/functional_hello_world_test.py b/tests/langgraph_plugin/functional_hello_world_test.py index 4603ddbad..f275017e9 100644 --- a/tests/langgraph_plugin/functional_hello_world_test.py +++ b/tests/langgraph_plugin/functional_hello_world_test.py @@ -3,7 +3,7 @@ import pytest from temporalio.client import Client -from temporalio.contrib.langgraph import LangGraphPlugin +from temporalio.langgraph import LangGraphPlugin from temporalio.worker import Worker from langgraph_plugin.functional_api.hello_world.workflow import ( diff --git a/tests/langgraph_plugin/functional_human_in_the_loop_test.py b/tests/langgraph_plugin/functional_human_in_the_loop_test.py index 33b4677f5..f88679451 100644 --- a/tests/langgraph_plugin/functional_human_in_the_loop_test.py +++ b/tests/langgraph_plugin/functional_human_in_the_loop_test.py @@ -4,7 +4,7 @@ import pytest from temporalio.client import Client -from temporalio.contrib.langgraph import LangGraphPlugin +from temporalio.langgraph import LangGraphPlugin from temporalio.worker import Worker from langgraph_plugin.functional_api.human_in_the_loop.workflow import ( diff --git a/tests/langgraph_plugin/functional_react_agent_test.py b/tests/langgraph_plugin/functional_react_agent_test.py index 088cd5c47..f816eba16 100644 --- a/tests/langgraph_plugin/functional_react_agent_test.py +++ b/tests/langgraph_plugin/functional_react_agent_test.py @@ -3,7 +3,7 @@ import pytest from temporalio.client import Client -from temporalio.contrib.langgraph import LangGraphPlugin +from temporalio.langgraph import LangGraphPlugin from temporalio.worker import Worker from langgraph_plugin.functional_api.react_agent.workflow import ( diff --git a/tests/langgraph_plugin/hello_world_test.py b/tests/langgraph_plugin/hello_world_test.py index 430989e57..1ce93b26a 100644 --- a/tests/langgraph_plugin/hello_world_test.py +++ b/tests/langgraph_plugin/hello_world_test.py @@ -1,7 +1,7 @@ import uuid from temporalio.client import Client -from temporalio.contrib.langgraph import LangGraphPlugin +from temporalio.langgraph import LangGraphPlugin from temporalio.worker import Worker from langgraph_plugin.graph_api.hello_world.workflow import ( diff --git a/tests/langgraph_plugin/human_in_the_loop_test.py b/tests/langgraph_plugin/human_in_the_loop_test.py index ad81e492c..dd57e837d 100644 --- a/tests/langgraph_plugin/human_in_the_loop_test.py +++ b/tests/langgraph_plugin/human_in_the_loop_test.py @@ -4,7 +4,7 @@ import pytest from temporalio.client import Client -from temporalio.contrib.langgraph import LangGraphPlugin +from temporalio.langgraph import LangGraphPlugin from temporalio.worker import Worker from langgraph_plugin.graph_api.human_in_the_loop.workflow import ( diff --git a/tests/langgraph_plugin/react_agent_test.py b/tests/langgraph_plugin/react_agent_test.py index e9db3ec6a..66a3c49dd 100644 --- a/tests/langgraph_plugin/react_agent_test.py +++ b/tests/langgraph_plugin/react_agent_test.py @@ -1,7 +1,7 @@ import uuid from temporalio.client import Client -from temporalio.contrib.langgraph import LangGraphPlugin +from temporalio.langgraph import LangGraphPlugin from temporalio.worker import Worker from langgraph_plugin.graph_api.react_agent.workflow import ( diff --git a/tests/langgraph_plugin/streaming_test.py b/tests/langgraph_plugin/streaming_test.py index 80c5047b8..eaf05b4fc 100644 --- a/tests/langgraph_plugin/streaming_test.py +++ b/tests/langgraph_plugin/streaming_test.py @@ -3,8 +3,8 @@ from typing import Any from temporalio.client import Client -from temporalio.contrib.langgraph import LangGraphPlugin from temporalio.contrib.workflow_streams import WorkflowStreamClient +from temporalio.langgraph import LangGraphPlugin from temporalio.worker import Worker from langgraph_plugin.graph_api.streaming.workflow import ( diff --git a/tests/langsmith_tracing/test_basic.py b/tests/langsmith_tracing/test_basic.py index cef49054a..f97164741 100644 --- a/tests/langsmith_tracing/test_basic.py +++ b/tests/langsmith_tracing/test_basic.py @@ -3,7 +3,7 @@ from temporalio import activity from temporalio.client import Client -from temporalio.contrib.langsmith import LangSmithPlugin +from temporalio.langsmith import LangSmithPlugin from temporalio.testing import WorkflowEnvironment from temporalio.worker import Worker diff --git a/tests/langsmith_tracing/test_chatbot.py b/tests/langsmith_tracing/test_chatbot.py index 88d98202a..24a6945a2 100644 --- a/tests/langsmith_tracing/test_chatbot.py +++ b/tests/langsmith_tracing/test_chatbot.py @@ -4,7 +4,7 @@ from temporalio import activity from temporalio.client import Client -from temporalio.contrib.langsmith import LangSmithPlugin +from temporalio.langsmith import LangSmithPlugin from temporalio.testing import WorkflowEnvironment from temporalio.worker import Worker diff --git a/tests/strands_plugin/_mock_model.py b/tests/strands_plugin/_mock_model.py index 9f97bedbc..f3072e471 100644 --- a/tests/strands_plugin/_mock_model.py +++ b/tests/strands_plugin/_mock_model.py @@ -11,7 +11,7 @@ from collections.abc import AsyncIterable from typing import Any -import temporalio.contrib.strands._plugin as _plugin_module +import temporalio.strands_agents._plugin as _plugin_module from strands.models import Model from strands.types.streaming import StreamEvent diff --git a/tests/strands_plugin/activity_interrupt_test.py b/tests/strands_plugin/activity_interrupt_test.py index 27e265239..255d0f3fa 100644 --- a/tests/strands_plugin/activity_interrupt_test.py +++ b/tests/strands_plugin/activity_interrupt_test.py @@ -2,7 +2,7 @@ import pytest from temporalio.client import Client -from temporalio.contrib.strands import StrandsPlugin +from temporalio.strands_agents import StrandsPlugin from temporalio.worker import Worker from strands_plugin.activity_interrupt.workflow import ( diff --git a/tests/strands_plugin/continue_as_new_test.py b/tests/strands_plugin/continue_as_new_test.py index 45c141710..b13a127b1 100644 --- a/tests/strands_plugin/continue_as_new_test.py +++ b/tests/strands_plugin/continue_as_new_test.py @@ -3,7 +3,7 @@ import pytest from temporalio.client import Client, WorkflowExecutionStatus -from temporalio.contrib.strands import StrandsPlugin +from temporalio.strands_agents import StrandsPlugin from temporalio.testing import WorkflowEnvironment from temporalio.worker import Worker diff --git a/tests/strands_plugin/hello_world_test.py b/tests/strands_plugin/hello_world_test.py index 5110ec759..0486d672a 100644 --- a/tests/strands_plugin/hello_world_test.py +++ b/tests/strands_plugin/hello_world_test.py @@ -2,7 +2,7 @@ import pytest from temporalio.client import Client -from temporalio.contrib.strands import StrandsPlugin +from temporalio.strands_agents import StrandsPlugin from temporalio.worker import Worker from strands_plugin.hello_world.workflow import HelloWorldWorkflow diff --git a/tests/strands_plugin/hooks_test.py b/tests/strands_plugin/hooks_test.py index 72d9bff52..a5baad7a7 100644 --- a/tests/strands_plugin/hooks_test.py +++ b/tests/strands_plugin/hooks_test.py @@ -2,7 +2,7 @@ import pytest from temporalio.client import Client -from temporalio.contrib.strands import StrandsPlugin +from temporalio.strands_agents import StrandsPlugin from temporalio.worker import Worker from strands_plugin.hooks.workflow import HooksWorkflow, persist_tool_call diff --git a/tests/strands_plugin/human_in_the_loop_test.py b/tests/strands_plugin/human_in_the_loop_test.py index 53cd5e844..a08927a91 100644 --- a/tests/strands_plugin/human_in_the_loop_test.py +++ b/tests/strands_plugin/human_in_the_loop_test.py @@ -2,7 +2,7 @@ import pytest from temporalio.client import Client -from temporalio.contrib.strands import StrandsPlugin +from temporalio.strands_agents import StrandsPlugin from temporalio.worker import Worker from strands_plugin.human_in_the_loop.workflow import HumanInTheLoopWorkflow diff --git a/tests/strands_plugin/mcp_test.py b/tests/strands_plugin/mcp_test.py index 9480f81d9..9dbd1168c 100644 --- a/tests/strands_plugin/mcp_test.py +++ b/tests/strands_plugin/mcp_test.py @@ -2,7 +2,7 @@ import pytest from temporalio.client import Client -from temporalio.contrib.strands import StrandsPlugin +from temporalio.strands_agents import StrandsPlugin from temporalio.worker import Worker from strands_plugin.mcp.run_worker import _make_echo_client diff --git a/tests/strands_plugin/streaming_test.py b/tests/strands_plugin/streaming_test.py index 1a57aefda..9ffc640f0 100644 --- a/tests/strands_plugin/streaming_test.py +++ b/tests/strands_plugin/streaming_test.py @@ -5,8 +5,8 @@ import pytest from strands.types.streaming import StreamEvent from temporalio.client import Client -from temporalio.contrib.strands import StrandsPlugin from temporalio.contrib.workflow_streams import WorkflowStreamClient +from temporalio.strands_agents import StrandsPlugin from temporalio.worker import Worker from strands_plugin.streaming.workflow import StreamingWorkflow diff --git a/tests/strands_plugin/structured_output_test.py b/tests/strands_plugin/structured_output_test.py index fba1f10c1..634ca7312 100644 --- a/tests/strands_plugin/structured_output_test.py +++ b/tests/strands_plugin/structured_output_test.py @@ -2,7 +2,7 @@ import pytest from temporalio.client import Client -from temporalio.contrib.strands import StrandsPlugin +from temporalio.strands_agents import StrandsPlugin from temporalio.worker import Worker from strands_plugin.structured_output.workflow import ( diff --git a/tests/strands_plugin/tools_test.py b/tests/strands_plugin/tools_test.py index 5aa36f883..feeee60ed 100644 --- a/tests/strands_plugin/tools_test.py +++ b/tests/strands_plugin/tools_test.py @@ -2,7 +2,7 @@ import pytest from temporalio.client import Client -from temporalio.contrib.strands import StrandsPlugin +from temporalio.strands_agents import StrandsPlugin from temporalio.worker import Worker from strands_plugin.tools.workflow import ( diff --git a/uv.lock b/uv.lock index 36f5bbb6c..65e7c0931 100644 --- a/uv.lock +++ b/uv.lock @@ -1,5 +1,5 @@ version = 1 -revision = 3 +revision = 5 requires-python = ">=3.10" resolution-markers = [ "python_full_version >= '3.15'", @@ -299,7 +299,8 @@ version = "4.13.0" source = { registry = "https://pypi.org/simple" } dependencies = [ { name = "exceptiongroup", marker = "python_full_version < '3.11'" }, - { name = "idna" }, + { name = "idna", version = "3.15", source = { registry = "https://pypi.org/simple" }, marker = "python_full_version < '3.11'" }, + { name = "idna", version = "3.20", source = { registry = "https://pypi.org/simple" }, marker = "python_full_version >= '3.11'" }, { name = "typing-extensions", marker = "python_full_version < '3.13'" }, ] sdist = { url = "https://files.pythonhosted.org/packages/19/14/2c5dd9f512b66549ae92767a9c7b330ae88e1932ca57876909410251fe13/anyio-4.13.0.tar.gz", hash = "sha256:334b70e641fd2221c1505b3890c69882fe4a2df910cba14d97019b90b24439dc", size = 231622, upload-time = "2026-03-24T12:59:09.671Z" } @@ -674,25 +675,72 @@ wheels = [ [[package]] name = "cryptography" -version = "38.0.4" +version = "50.0.2" source = { registry = "https://pypi.org/simple" } dependencies = [ - { name = "cffi" }, + { name = "cffi", marker = "platform_python_implementation != 'PyPy'" }, + { name = "typing-extensions", marker = "python_full_version < '3.11'" }, ] -sdist = { url = "https://files.pythonhosted.org/packages/e3/3f/41186b1f2fd86a542d399175f6b8e43f82cd4dfa51235a0b030a042b811a/cryptography-38.0.4.tar.gz", hash = "sha256:175c1a818b87c9ac80bb7377f5520b7f31b3ef2a0004e2420319beadedb67290", size = 599786, upload-time = "2022-11-27T19:02:47.023Z" } -wheels = [ - { url = "https://files.pythonhosted.org/packages/75/7a/2ea7dd2202638cf1053aaa8fbbaddded0b78c78832b3d03cafa0416a6c84/cryptography-38.0.4-cp36-abi3-macosx_10_10_universal2.whl", hash = "sha256:2fa36a7b2cc0998a3a4d5af26ccb6273f3df133d61da2ba13b3286261e7efb70", size = 5393399, upload-time = "2022-11-27T19:01:41.672Z" }, - { url = "https://files.pythonhosted.org/packages/52/1b/49ebc2b59e9126f1f378ae910e98704d54a3f48b78e2d6d6c8cfe6fbe06f/cryptography-38.0.4-cp36-abi3-macosx_10_10_x86_64.whl", hash = "sha256:1f13ddda26a04c06eb57119caf27a524ccae20533729f4b1e4a69b54e07035eb", size = 2845386, upload-time = "2022-11-27T19:01:46.627Z" }, - { url = "https://files.pythonhosted.org/packages/6d/47/929f07e12ebbcfedddb95397c49677dd82bb5a0bb648582b10d5f65e321c/cryptography-38.0.4-cp36-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.manylinux_2_24_aarch64.whl", hash = "sha256:2ec2a8714dd005949d4019195d72abed84198d877112abb5a27740e217e0ea8d", size = 3646085, upload-time = "2022-11-27T19:03:08.155Z" }, - { url = "https://files.pythonhosted.org/packages/32/ed/d7de730e1452ed714f2f8eee123669d4819080e03ec523b131d9b709d060/cryptography-38.0.4-cp36-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:50a1494ed0c3f5b4d07650a68cd6ca62efe8b596ce743a5c94403e6f11bf06c1", size = 3970064, upload-time = "2022-11-27T19:03:10.965Z" }, - { url = "https://files.pythonhosted.org/packages/63/d4/66b3b4ffe51b47a065b5a5a00e6a4c8aa6cdfa4f2453adfa0aac77fd3511/cryptography-38.0.4-cp36-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:a10498349d4c8eab7357a8f9aa3463791292845b79597ad1b98a543686fb1ec8", size = 4147583, upload-time = "2022-11-27T19:02:22.123Z" }, - { url = "https://files.pythonhosted.org/packages/12/9c/e44f95e71aedc5fefe3425df662dd17c6f94fbf68470b56c4873c43f27d2/cryptography-38.0.4-cp36-abi3-manylinux_2_24_x86_64.whl", hash = "sha256:10652dd7282de17990b88679cb82f832752c4e8237f0c714be518044269415db", size = 4048952, upload-time = "2022-11-27T19:01:55.976Z" }, - { url = "https://files.pythonhosted.org/packages/a2/8f/6c52b1f9d650863e8f67edbe062c04f1c8455579eaace1593d8fe469319a/cryptography-38.0.4-cp36-abi3-manylinux_2_28_aarch64.whl", hash = "sha256:bfe6472507986613dc6cc00b3d492b2f7564b02b3b3682d25ca7f40fa3fd321b", size = 3966337, upload-time = "2022-11-27T19:03:13.798Z" }, - { url = "https://files.pythonhosted.org/packages/26/f8/a81170a816679fca9ccd907b801992acfc03c33f952440421c921af2cc57/cryptography-38.0.4-cp36-abi3-manylinux_2_28_x86_64.whl", hash = "sha256:ce127dd0a6a0811c251a6cddd014d292728484e530d80e872ad9806cfb1c5b3c", size = 4166037, upload-time = "2022-11-27T19:02:09.987Z" }, - { url = "https://files.pythonhosted.org/packages/b1/44/6d6cb7cff7f2dbc59fde50e5b82bc6df075e73af89a25eba1a6193c22165/cryptography-38.0.4-cp36-abi3-musllinux_1_1_aarch64.whl", hash = "sha256:53049f3379ef05182864d13bb9686657659407148f901f3f1eee57a733fb4b00", size = 4070539, upload-time = "2022-11-27T19:03:16.685Z" }, - { url = "https://files.pythonhosted.org/packages/64/4e/04dced6a515032b7bf3e8f287c7ff73a7d1b438c8394aa50b9fceb4077e2/cryptography-38.0.4-cp36-abi3-musllinux_1_1_x86_64.whl", hash = "sha256:8a4b2bdb68a447fadebfd7d24855758fe2d6fecc7fed0b78d190b1af39a8e3b0", size = 4231944, upload-time = "2022-11-27T19:02:34.288Z" }, - { url = "https://files.pythonhosted.org/packages/0f/83/2cc749fdc39345c1343cb29dc38bc7de9a0a55b7761663e098410f98f902/cryptography-38.0.4-cp36-abi3-win32.whl", hash = "sha256:1d7e632804a248103b60b16fb145e8df0bc60eed790ece0d12efe8cd3f3e7744", size = 2073540, upload-time = "2022-11-27T19:02:36.361Z" }, - { url = "https://files.pythonhosted.org/packages/c0/eb/f52b165db2abd662cda0a76efb7579a291fed1a7979cf41146cdc19e0d7a/cryptography-38.0.4-cp36-abi3-win_amd64.whl", hash = "sha256:8e45653fb97eb2f20b8c96f9cd2b3a0654d742b47d638cf2897afbd97f80fa6d", size = 2432391, upload-time = "2022-11-27T19:02:38.848Z" }, +sdist = { url = "https://files.pythonhosted.org/packages/9d/af/182eb91b0df3fe75c4d9f26fe70684569566745f6ba7e5c9c73a862c5252/cryptography-50.0.2.tar.gz", hash = "sha256:7b46165bb56eb4704e2eaaf86f3c940d19154535d9b0ca7d6d590b04060e00d5", size = 880623, upload-time = "2026-09-30T15:30:04.884Z" } +wheels = [ + { url = "https://files.pythonhosted.org/packages/e5/56/d194340cc4a57535e82e1bee9e89667ac4b7c13b5d3f59686deae3094dd5/cryptography-50.0.2-cp311-abi3-macosx_11_0_arm64.whl", hash = "sha256:fa8f5efb344d6908a1ce62f4a24e2e5780f825d6f53f5f50ec5ffacac72936cb", size = 3914904, upload-time = "2026-09-30T14:43:44.339Z" }, + { url = "https://files.pythonhosted.org/packages/d9/69/c9bd862c3bf43d6399c433caf002df16e2dffd4be49bdf515cda38038711/cryptography-50.0.2-cp311-abi3-manylinux2014_aarch64.manylinux_2_17_aarch64.whl", hash = "sha256:79def8d059362e7831389ed3be0ecdf58a89386e1271e35dd9f5af84e81bffd0", size = 4731146, upload-time = "2026-09-30T14:43:47.113Z" }, + { url = "https://files.pythonhosted.org/packages/21/69/64cef1f702bf6657e0cc186ed1a2891d50d29fb41586b254e1c07adea261/cryptography-50.0.2-cp311-abi3-manylinux2014_x86_64.manylinux_2_17_x86_64.whl", hash = "sha256:630ebfea3bf689d075f82316324ff7433dc447fe6bc1bfc76524b74b4a9567d2", size = 4719841, upload-time = "2026-09-30T14:43:49.01Z" }, + { url = "https://files.pythonhosted.org/packages/38/6b/61a3f8d8c5e1e49a6cddccafc4015cc1c0021360ab0acb4080e7a423644a/cryptography-50.0.2-cp311-abi3-manylinux_2_28_aarch64.whl", hash = "sha256:f9f6143a8c75945eb960d9eb98905a441394abfa24afaae239d514ffb2586480", size = 4738340, upload-time = "2026-09-30T14:43:50.932Z" }, + { url = "https://files.pythonhosted.org/packages/7b/2e/7212ca32fd43dc91f2f41db20160b268098874b4c9a0e7be94d6835f5b2e/cryptography-50.0.2-cp311-abi3-manylinux_2_28_ppc64le.whl", hash = "sha256:a582ab2ae1d34f67112cadc86702774c9ea4374df6bca6afe672817203c99134", size = 5367029, upload-time = "2026-09-30T14:43:52.911Z" }, + { url = "https://files.pythonhosted.org/packages/1a/f1/b474e930c4d910328780e3940da76f5aa5cbc48ce1fc14e44d239d9ea9db/cryptography-50.0.2-cp311-abi3-manylinux_2_28_x86_64.whl", hash = "sha256:4061c0079120205fb760c58acab6443e217307dcf05e3702cf970e0689972856", size = 4753050, upload-time = "2026-09-30T14:43:55.272Z" }, + { url = "https://files.pythonhosted.org/packages/7c/52/9af10e80ac16b0fcc2123f9cbd5e7afbd0fd5075bb7a607c592258a39cda/cryptography-50.0.2-cp311-abi3-manylinux_2_31_armv7l.whl", hash = "sha256:ac9ed99d81760c62fe89d5f0815cdfa1ba9a35141cf30f1c2d044f04b4803d2e", size = 4376724, upload-time = "2026-09-30T14:43:57.24Z" }, + { url = "https://files.pythonhosted.org/packages/71/37/6202e488cc1eb625ea110c292c6bda92823176e023f427d8d5660ce8d632/cryptography-50.0.2-cp311-abi3-manylinux_2_34_aarch64.whl", hash = "sha256:87e9ce85beb6b328ba370cc6e6aea483c92617b4c95b1d33a49297eb662bfb04", size = 4737859, upload-time = "2026-09-30T14:43:59.541Z" }, + { url = "https://files.pythonhosted.org/packages/8f/30/e86d7d518489b0ae2497091a35287abcb1a2ce4037837a34afbe9b1d6964/cryptography-50.0.2-cp311-abi3-manylinux_2_34_ppc64le.whl", hash = "sha256:f265528741e048bce55c3463ed721fb0aa45a5888d8add8cfeccb3035451bbdc", size = 5324103, upload-time = "2026-09-30T14:44:01.901Z" }, + { url = "https://files.pythonhosted.org/packages/d3/69/2c833a049475e0a3444e94c7d0aca0aa51d166374a449b09e92ac98138de/cryptography-50.0.2-cp311-abi3-manylinux_2_34_x86_64.whl", hash = "sha256:9dab55f57c74c3cad24c323bacbbd04be4705ba6eb0d92e920b1fc4837ed5079", size = 4752576, upload-time = "2026-09-30T14:44:04.545Z" }, + { url = "https://files.pythonhosted.org/packages/6c/5d/906970b83bbfc1f5bbfb677a143c181f2801f23b6a7204a3b47c42c97e65/cryptography-50.0.2-cp311-abi3-musllinux_1_2_aarch64.whl", hash = "sha256:25784ce8b9621c90c643efb9e1e2162ab3b0224cae446ad5e70e7fcb1ce18b51", size = 4870819, upload-time = "2026-09-30T14:44:06.884Z" }, + { url = "https://files.pythonhosted.org/packages/68/e3/f2298d3bb55e0c4a91841ec4d01b3f020ba8c5fbf15ccdcc6dcf03f97025/cryptography-50.0.2-cp311-abi3-musllinux_1_2_x86_64.whl", hash = "sha256:85d0d9a31b9098e98534226d5686b47264b95e62ce459dc2e62fdfc809f9fe93", size = 5030152, upload-time = "2026-09-30T14:44:09.443Z" }, + { url = "https://files.pythonhosted.org/packages/9a/4f/adfc442765721292fff86d314ce385d3249d22db42295c0dd057727b60f3/cryptography-50.0.2-cp311-abi3-win_amd64.whl", hash = "sha256:7afa5a6602a9f29af1f3a2965f831bae7c9d5d597b7cbb716d41ab3b7d89879c", size = 3824692, upload-time = "2026-09-30T14:44:11.671Z" }, + { url = "https://files.pythonhosted.org/packages/ce/cb/52eb3770c0d0be2702a98c6e96065ddc0a2877cf0845aa9c23397c142cd4/cryptography-50.0.2-cp314-cp314t-macosx_11_0_arm64.whl", hash = "sha256:f785f6161f202ab04d8ca194158968798e480ca058943907972da5f12e2881e8", size = 3892731, upload-time = "2026-09-30T14:44:13.485Z" }, + { url = "https://files.pythonhosted.org/packages/19/8e/aa1fc533d4546b127b45de8aa024eb5933d23eff9debfe25931e56861095/cryptography-50.0.2-cp314-cp314t-manylinux2014_aarch64.manylinux_2_17_aarch64.whl", hash = "sha256:0ecbc5652bdb6fc9eaf89a7d196e20941adfe812f43bc4ca05d9150496821047", size = 4710431, upload-time = "2026-09-30T14:44:15.427Z" }, + { url = "https://files.pythonhosted.org/packages/6a/64/72bc3f75176e7e406b748a3e3830432b8c51297b38368713df04dc04898a/cryptography-50.0.2-cp314-cp314t-manylinux2014_x86_64.manylinux_2_17_x86_64.whl", hash = "sha256:ab50ee449bf968271e820086f10a33d101dd060370abc10bcd22279be2656539", size = 4694824, upload-time = "2026-09-30T14:44:17.69Z" }, + { url = "https://files.pythonhosted.org/packages/4e/c6/62c77550edfa5ca3f14bf44a1e6739b9fa09d6e998a11d97ed8213bccc98/cryptography-50.0.2-cp314-cp314t-manylinux_2_28_aarch64.whl", hash = "sha256:a9f7355e6fab51f6c369b86fb7571cffa05edee2c2121e0380a37fb9ac1cd5c1", size = 4716967, upload-time = "2026-09-30T14:44:19.661Z" }, + { url = "https://files.pythonhosted.org/packages/f4/37/cce70f150c432914460157a6ecc161752e053aa5ec0ef3b3f7dc6e31039a/cryptography-50.0.2-cp314-cp314t-manylinux_2_28_ppc64le.whl", hash = "sha256:94e5e9f108ee10471288214d3d233fbfbb492840a8457eb85178d643ddeb32c7", size = 5328676, upload-time = "2026-09-30T14:44:21.744Z" }, + { url = "https://files.pythonhosted.org/packages/aa/9a/6f2f0304d634ceafdeaf23e84537336664ac419b5d07611675c2ad3f6b7a/cryptography-50.0.2-cp314-cp314t-manylinux_2_28_x86_64.whl", hash = "sha256:241449bf940a5d27309bd317e6f9a2af6932113818bb2b8f5c59ddc7ef16da18", size = 4727698, upload-time = "2026-09-30T14:44:24.178Z" }, + { url = "https://files.pythonhosted.org/packages/1d/de/66bcf9244d118663b2e1aaded8990f4640e3d7b7411870a5765f252074d2/cryptography-50.0.2-cp314-cp314t-manylinux_2_31_armv7l.whl", hash = "sha256:d8947001be83df1394050758ce0e745dd74fb134eef0a4b5124208dfc3a68c37", size = 4354821, upload-time = "2026-09-30T14:44:26.263Z" }, + { url = "https://files.pythonhosted.org/packages/bd/e6/db28a28c7b6c676addce89136de3d8db49ea825a8c863472e36e42ead4ad/cryptography-50.0.2-cp314-cp314t-manylinux_2_34_aarch64.whl", hash = "sha256:4a20ce1e5cb4284a86692fdcba7cb8754185c6b2e5c56fcef3751cf451d3cdc2", size = 4716748, upload-time = "2026-09-30T14:44:28.447Z" }, + { url = "https://files.pythonhosted.org/packages/30/96/01546c7f69ea0e2ab790a2e4f0934a4052fb9b388147fbf83c2fd72f1e57/cryptography-50.0.2-cp314-cp314t-manylinux_2_34_ppc64le.whl", hash = "sha256:84f964e537f916e2cc85199e5a88742e964939b575ac8598b3f9d6cc416cdaf1", size = 5285085, upload-time = "2026-09-30T14:44:30.704Z" }, + { url = "https://files.pythonhosted.org/packages/6c/01/03263395f74d50b071e9e66daace3f8bef80493e5d410726f2ba8554736b/cryptography-50.0.2-cp314-cp314t-manylinux_2_34_x86_64.whl", hash = "sha256:828d49b0ff5a0e3975865571c5d91dbbdd0d38d8289b249a163e9425413a5e05", size = 4727268, upload-time = "2026-09-30T14:44:32.92Z" }, + { url = "https://files.pythonhosted.org/packages/eb/94/2bfe8f29ec0cc9c0d99359c4161adf32858e4934b72c6d100d2ac0bbe962/cryptography-50.0.2-cp314-cp314t-musllinux_1_2_aarch64.whl", hash = "sha256:deb9fde5c60e437ee4821bc9bc39ff31b42135c27e1dc61ef0a629389c1de62e", size = 4849503, upload-time = "2026-09-30T14:44:34.969Z" }, + { url = "https://files.pythonhosted.org/packages/54/44/e80651ecbf0e42b62e2bb5f5768916e07eea72e1297338956a61df361f88/cryptography-50.0.2-cp314-cp314t-musllinux_1_2_x86_64.whl", hash = "sha256:8c71ba2cd31fc93748c38e1b613200ff1c2665cbfd5341fe3a61cfde35a1430e", size = 5004057, upload-time = "2026-09-30T14:44:37.064Z" }, + { url = "https://files.pythonhosted.org/packages/f8/cc/1d33befb3cd7ea7e77d2d73f43f2066471da1b21f24a6156efcaabf6d2e8/cryptography-50.0.2-cp314-cp314t-win_amd64.whl", hash = "sha256:78198641e5be9521beea5aa782bb551a58068d10e6eb04c9c680c1b69f2e7d45", size = 3795868, upload-time = "2026-09-30T14:44:39.71Z" }, + { url = "https://files.pythonhosted.org/packages/2d/49/93f6a6e7a87c9aa68d44d3e1cdb5fe8f60c90d5d2f46acae9a56892816b8/cryptography-50.0.2-cp315-abi3.abi3t-macosx_11_0_arm64.whl", hash = "sha256:edc3342adf8f697fc5f59c887a304356f147b397809440ed64e2fa6af2f50f37", size = 4133708, upload-time = "2026-09-30T14:44:41.807Z" }, + { url = "https://files.pythonhosted.org/packages/8c/75/32ac2a56243d778805c16ca6a32b8f74fb757df7e28d7ecb560afafb59cf/cryptography-50.0.2-cp315-abi3.abi3t-manylinux2014_aarch64.manylinux_2_17_aarch64.whl", hash = "sha256:d370b8d1dfcdf7130178137f6fbee6140774a1acc6cacefc4b42643ec11d0a3a", size = 4956267, upload-time = "2026-09-30T14:44:43.693Z" }, + { url = "https://files.pythonhosted.org/packages/aa/a4/2c8d734e43d97f0842ee9f1b7b4bfb3d0cf5e19edebf43c2afe6675c2320/cryptography-50.0.2-cp315-abi3.abi3t-manylinux2014_x86_64.manylinux_2_17_x86_64.whl", hash = "sha256:f2f9bd7f90c64fe89253f0a2c05e3c4856072660429ce8831b4235bf29403a67", size = 4966465, upload-time = "2026-09-30T14:44:45.769Z" }, + { url = "https://files.pythonhosted.org/packages/c2/58/ee288c829a6f41f6235ae9dd33d82fd19b45442b65b4c8a3da36963d9f7a/cryptography-50.0.2-cp315-abi3.abi3t-manylinux_2_28_aarch64.whl", hash = "sha256:e275096ea1e60cc595cda2836fd4a6c725d1125108b868be17f53684d164e2cc", size = 4959356, upload-time = "2026-09-30T14:44:48.211Z" }, + { url = "https://files.pythonhosted.org/packages/92/20/9ded6d51ddd9897f6b6e81fb9ebea7951d7cc5d6c890b0ed8abf77a51a80/cryptography-50.0.2-cp315-abi3.abi3t-manylinux_2_28_ppc64le.whl", hash = "sha256:b13478603dcd0a2479ff8e87e2c19a7d525734686fe3c49542472293a204212d", size = 5548822, upload-time = "2026-09-30T14:44:50.86Z" }, + { url = "https://files.pythonhosted.org/packages/02/a8/8df951850d6b31d2a00218f19e2b3f999523437ed7a819df7fa427942fca/cryptography-50.0.2-cp315-abi3.abi3t-manylinux_2_28_x86_64.whl", hash = "sha256:58a0c478eeca76fe5e07993c5a0703def34a6dc6a0cda4f5564639b33112ffe7", size = 5001199, upload-time = "2026-09-30T14:44:53.379Z" }, + { url = "https://files.pythonhosted.org/packages/8b/f9/36b3022218ce75b7cdf068fb95f809f9bd0d820e4955ef43b90c255cc7ac/cryptography-50.0.2-cp315-abi3.abi3t-manylinux_2_31_armv7l.whl", hash = "sha256:d38cdff612d06fa6a32840d5e1b1f7a27cee4a349aa9085d94a67789d6bfd408", size = 4629333, upload-time = "2026-09-30T14:44:55.635Z" }, + { url = "https://files.pythonhosted.org/packages/8c/72/20f99a219f6af47cdd1cbd978c243b92d71496e168a746138af44ded4f29/cryptography-50.0.2-cp315-abi3.abi3t-manylinux_2_34_aarch64.whl", hash = "sha256:fdd28f912fccfec1846a94e2e1e8f9b0012f557f0c46fe4f3eb0d7a87afcf90b", size = 4958822, upload-time = "2026-09-30T14:44:59.639Z" }, + { url = "https://files.pythonhosted.org/packages/f2/20/196f112617fb08eb4d608a2a6c422373d46f9cc2857f38fc0667033c0899/cryptography-50.0.2-cp315-abi3.abi3t-manylinux_2_34_ppc64le.whl", hash = "sha256:cbc8738fd8526d80f35cb3a40d41f41a2e7030bb3b18b09a6778ef63d291c2fd", size = 5506351, upload-time = "2026-09-30T14:45:02.267Z" }, + { url = "https://files.pythonhosted.org/packages/24/95/83378121ef3eaaaf71d4b781577ff794acb39b9e1b87a3f156898c8497ed/cryptography-50.0.2-cp315-abi3.abi3t-manylinux_2_34_x86_64.whl", hash = "sha256:e105ab60406787da31fccc883fc0f733af1efd78f0136a4599692c4083a73d0c", size = 5000859, upload-time = "2026-09-30T14:45:05.009Z" }, + { url = "https://files.pythonhosted.org/packages/22/f7/70fd7ae4d1dbfa7ba29b02e1b9068771519a86027756510b700ce81086a8/cryptography-50.0.2-cp315-abi3.abi3t-musllinux_1_2_aarch64.whl", hash = "sha256:6f8700550aa1474a91e5dc07049c46f98b423b5b1ddd0483e0b51362eeeaf5be", size = 5092151, upload-time = "2026-09-30T15:29:15.932Z" }, + { url = "https://files.pythonhosted.org/packages/d4/be/688367b74de86984bd58d8efacfc7c9e68b89a6a22ced0fb4f38db50254a/cryptography-50.0.2-cp315-abi3.abi3t-musllinux_1_2_x86_64.whl", hash = "sha256:c71be1cbfa5cd9a41ee452acf1eccd82b2c05950358b106ec8ceb83411d1a020", size = 5286120, upload-time = "2026-09-30T15:29:18.309Z" }, + { url = "https://files.pythonhosted.org/packages/39/d1/55f8a3f2ef5d1529e16835ef10cf0fe3d559ce237b46dddc440c0bba3649/cryptography-50.0.2-cp315-abi3.abi3t-win_amd64.whl", hash = "sha256:c423ab384a46c4dff7217b2ea5ba2e11cffdeab6441acd04cf65a369caf0366c", size = 4111557, upload-time = "2026-09-30T15:29:20.155Z" }, + { url = "https://files.pythonhosted.org/packages/23/ad/ac987755d00e1e64273760228d2635ae38dae2be83e3c6e0d3289d91dec3/cryptography-50.0.2-cp39-abi3-macosx_11_0_arm64.whl", hash = "sha256:0ec5f09541743261e66e291b4a0cbf0fb2997aeaab6d9e9c740b9dba1b58d1c2", size = 3943588, upload-time = "2026-09-30T15:29:22.265Z" }, + { url = "https://files.pythonhosted.org/packages/d5/8d/6d585339bedf85d45044c85d8412dac53f2bb6f918e8b7777efba1787844/cryptography-50.0.2-cp39-abi3-manylinux2014_aarch64.manylinux_2_17_aarch64.whl", hash = "sha256:c5e67125c7dca78d199ec4e116aa93dbb83494808ecbb8211a2cb09b1bf41dbd", size = 4756166, upload-time = "2026-09-30T15:29:24.58Z" }, + { url = "https://files.pythonhosted.org/packages/bf/f1/1c1f6874e8550cfddd4b688ceb38cefb6ed15ceed224d56f133f3d88c214/cryptography-50.0.2-cp39-abi3-manylinux2014_x86_64.manylinux_2_17_x86_64.whl", hash = "sha256:ee247f5c245c9a2fe7c8e2214e295918838e44e00a45a6718451e4004219e767", size = 4749145, upload-time = "2026-09-30T15:29:26.807Z" }, + { url = "https://files.pythonhosted.org/packages/c1/63/61b15dc1a8de03fe0adbe3fd7608b3ad5c73bf50993bbcb1faaa930afe33/cryptography-50.0.2-cp39-abi3-manylinux_2_28_aarch64.whl", hash = "sha256:dfe9763530994147d9af1def057a5b9658b00e8f8fe8743d144d1e0911c2e454", size = 4763638, upload-time = "2026-09-30T15:29:28.588Z" }, + { url = "https://files.pythonhosted.org/packages/fc/35/b345bdfa40c9126df1a9d33236aa98418367931b8725f84fc3ae2b98dc59/cryptography-50.0.2-cp39-abi3-manylinux_2_28_ppc64le.whl", hash = "sha256:58ddb5a8e3179d12f19e4ea34d2d32e9d63a4baa142c875c1eb59f41b7243acd", size = 5382217, upload-time = "2026-09-30T15:29:30.589Z" }, + { url = "https://files.pythonhosted.org/packages/4f/87/ef344a9e616871f2519c22d6afcda79ddd5d35e9592d95eb6e677608d055/cryptography-50.0.2-cp39-abi3-manylinux_2_28_x86_64.whl", hash = "sha256:f21e8a22c8605750c7af886bab299a363721264061b4ac0a30efb73cfd58efc5", size = 4781387, upload-time = "2026-09-30T15:29:32.605Z" }, + { url = "https://files.pythonhosted.org/packages/90/5b/f2fdb13cd0b96f6f932c8627bb292a45f11c64d21620a8e120aee9a3b848/cryptography-50.0.2-cp39-abi3-manylinux_2_31_armv7l.whl", hash = "sha256:9c8402a82ea0dc4ceeab793db05f0fafa8ca139ca34fcde5df0f596103c74107", size = 4403790, upload-time = "2026-09-30T15:29:34.374Z" }, + { url = "https://files.pythonhosted.org/packages/bc/ce/7e4f662b1e3c393513569e402cfc85ac7da0bd3d5435e122a3140219eb2d/cryptography-50.0.2-cp39-abi3-manylinux_2_34_aarch64.whl", hash = "sha256:0ddc924c04591c2811ca024d62ecad4f7f6f08af8939c211438f48a16bd23602", size = 4764319, upload-time = "2026-09-30T15:29:36.149Z" }, + { url = "https://files.pythonhosted.org/packages/3c/3f/86ff33ce34cc0de6847fb96e035a1a760d81652e38643f617c02ad32ef7a/cryptography-50.0.2-cp39-abi3-manylinux_2_34_ppc64le.whl", hash = "sha256:a6557e5f38e065ca9fbdaf7cfc7435ecb1d113aa81a022d1b51921ee7432e227", size = 5338560, upload-time = "2026-09-30T15:29:39.053Z" }, + { url = "https://files.pythonhosted.org/packages/40/cf/6b5c8e2fd9202d98988ab7cb5cc5c991704c4ad55f492ff408e4969f83f1/cryptography-50.0.2-cp39-abi3-manylinux_2_34_x86_64.whl", hash = "sha256:1981f1db4630889b9ef7803fadef12b056f428cb6b85c27ba57b774793b6093c", size = 4780973, upload-time = "2026-09-30T15:29:41.251Z" }, + { url = "https://files.pythonhosted.org/packages/10/bf/8d6ebc7dded797bd0f0160d52188021211f011a2b164ef0ae1dac4587465/cryptography-50.0.2-cp39-abi3-musllinux_1_2_aarch64.whl", hash = "sha256:7a8701d6b584d76e909e3d305b7d126b41439876a5aaf76cddc67fc230eafa2e", size = 4897738, upload-time = "2026-09-30T15:29:43.106Z" }, + { url = "https://files.pythonhosted.org/packages/d4/aa/f3f6e0de7e6253b8baa8b2d8fb9d50924fa75cee3d4624bd4bc1208ee923/cryptography-50.0.2-cp39-abi3-musllinux_1_2_x86_64.whl", hash = "sha256:ce47f66801c20ec6c6632453bb5960fe38939e9306970b48b3a5a26de7745d94", size = 5058280, upload-time = "2026-09-30T15:29:44.827Z" }, + { url = "https://files.pythonhosted.org/packages/f6/b6/a1faf3a27ae9405fb34b1713cc73b2d8a26b04d5c561578fa2e6ef3e5bb9/cryptography-50.0.2-cp39-abi3-win_amd64.whl", hash = "sha256:4e81d95e5bafc2d6e34e4bed780e53e4d5b9a2f928573428aa4d35fbec1eb0de", size = 3854095, upload-time = "2026-09-30T15:29:46.782Z" }, + { url = "https://files.pythonhosted.org/packages/1d/7a/f08d34ce09d60f89ebd391e2ebc6ba2b995e6dd7552f41820f8085f94e53/cryptography-50.0.2-pp311-pypy311_pp73-manylinux_2_28_aarch64.whl", hash = "sha256:92e665960f25fcdc73725b9cec7a3824f279ba97a98653afe9ffac2e43668f67", size = 4716035, upload-time = "2026-09-30T15:29:48.681Z" }, + { url = "https://files.pythonhosted.org/packages/45/67/e18fb65592451a2acb76e9f2fbe14e0f47a8318b4c5430f1633851d03daa/cryptography-50.0.2-pp311-pypy311_pp73-manylinux_2_28_x86_64.whl", hash = "sha256:eef4c2f3423810b3070ab391f85436d2f8bbfcb286ac15cbc73190b3563b1f1a", size = 4726917, upload-time = "2026-09-30T15:29:50.608Z" }, + { url = "https://files.pythonhosted.org/packages/83/28/38fdce17e60f6b825e69fc3b7f75e70a6612759980704697e1de4cbfaf6e/cryptography-50.0.2-pp311-pypy311_pp73-manylinux_2_34_aarch64.whl", hash = "sha256:7c6d0330c472d96f6a6afe24d80dfdf15176c33096f0a4397ae4c60f3dd3be48", size = 4715341, upload-time = "2026-09-30T15:29:52.522Z" }, + { url = "https://files.pythonhosted.org/packages/b6/b1/d9121a717e0f893c64bd6ca7702614778d7df2a5c309128a002421788516/cryptography-50.0.2-pp311-pypy311_pp73-manylinux_2_34_x86_64.whl", hash = "sha256:1ba34f04897fcdaa73f74145c25f3ec146fbd56593853e88adc2e811303c5f42", size = 4726322, upload-time = "2026-09-30T15:29:54.263Z" }, + { url = "https://files.pythonhosted.org/packages/36/8b/e6d153808bf353e152abd2fd4d8f09670d956ac78379ac46e60d7efbf04c/cryptography-50.0.2-pp311-pypy311_pp80-macosx_11_0_arm64.whl", hash = "sha256:3dc4fd8058cea1644971207d530e1a03a184a805ffc8ebdddf0599d78a331b81", size = 3873097, upload-time = "2026-09-30T15:29:56.097Z" }, + { url = "https://files.pythonhosted.org/packages/ca/1d/1271f287ff7170ddafc2aad36260c4eec20ccd2fea70f38455e9d56d427b/cryptography-50.0.2-pp311-pypy311_pp80-win_amd64.whl", hash = "sha256:7b75de3c8b3be1cdb1052747c929440c3eea46c1bc2cb8a6e3a48388e9b7b452", size = 3805376, upload-time = "2026-09-30T15:29:58.729Z" }, ] [[package]] @@ -706,19 +754,20 @@ wheels = [ [[package]] name = "deepagents" -version = "0.6.12" +version = "0.7.7" source = { registry = "https://pypi.org/simple" } dependencies = [ { name = "langchain", version = "1.3.15", source = { registry = "https://pypi.org/simple" } }, { name = "langchain-anthropic", version = "1.5.5", source = { registry = "https://pypi.org/simple" } }, { name = "langchain-core", version = "1.5.4", source = { registry = "https://pypi.org/simple" } }, { name = "langchain-google-genai" }, - { name = "langsmith", version = "0.8.18", source = { registry = "https://pypi.org/simple" } }, + { name = "langsmith", version = "0.12.6", source = { registry = "https://pypi.org/simple" } }, + { name = "packaging" }, { name = "wcmatch" }, ] -sdist = { url = "https://files.pythonhosted.org/packages/e0/db/a6acdc72a9e90c3f07ed10de35c951734a02d4facb693bb59684ad368801/deepagents-0.6.12.tar.gz", hash = "sha256:1f281c0bc5a63132f62e2ee345c1dc593b23188da6e23016401f6879fbe54b5f", size = 211364, upload-time = "2026-06-25T17:26:52.775Z" } +sdist = { url = "https://files.pythonhosted.org/packages/d3/20/6a2fff4d42984f6302f211c164d4cf1b1894086b576736d81a935a67186e/deepagents-0.7.7.tar.gz", hash = "sha256:68b8f0c861a95065b3eda39b5c3748943e09500898bc39e7e689f0b7deba9f72", size = 282001, upload-time = "2026-08-18T15:06:55.05Z" } wheels = [ - { url = "https://files.pythonhosted.org/packages/98/49/af7219b3c13520fee047bb807cfaefba17f8e4584c551d946773589a4f08/deepagents-0.6.12-py3-none-any.whl", hash = "sha256:28b8fa0119ca0a689e3e18e288c4634e4046062acfc87a1cb34289d3af3a1c88", size = 236120, upload-time = "2026-06-25T17:26:51.736Z" }, + { url = "https://files.pythonhosted.org/packages/e2/15/0e029e7f119c4c7a9cb17702b604153af71571d36c646c2837e5f4d3074d/deepagents-0.7.7-py3-none-any.whl", hash = "sha256:ddce2604799205ef51dc2c17fae613c9e162bbbc90206fcff2860c4e6f48bdb1", size = 308616, upload-time = "2026-08-18T15:06:53.532Z" }, ] [[package]] @@ -1095,10 +1144,9 @@ wheels = [ [[package]] name = "google-adk" -version = "2.6.2" +version = "2.11.0" source = { registry = "https://pypi.org/simple" } dependencies = [ - { name = "aiohttp" }, { name = "aiosqlite" }, { name = "authlib" }, { name = "click" }, @@ -1119,32 +1167,38 @@ dependencies = [ { name = "starlette" }, { name = "tenacity" }, { name = "typing-extensions" }, - { name = "tzlocal" }, { name = "uvicorn" }, { name = "watchdog" }, { name = "websockets" }, ] -sdist = { url = "https://files.pythonhosted.org/packages/f9/39/d9512c13102d20dd32e4c36b8af3918583a2a1ae4e1f062dec01f648bb59/google_adk-2.6.2.tar.gz", hash = "sha256:e95eee1e18811078a3478e8b4a57922dd8eff0fa4c465b864f0f6174c04bfad8", size = 3721236, upload-time = "2026-08-04T01:20:22.206Z" } +sdist = { url = "https://files.pythonhosted.org/packages/e7/50/7e9d83adc67df40752598bddcc24d9b6696aae4d61c45b6271d53ec2df53/google_adk-2.11.0.tar.gz", hash = "sha256:59258cec8d79306192bf65e0d43fa64b764f831e3b74ed3b8e6fe9df16a1e2c8", size = 4197119, upload-time = "2026-10-02T00:46:25.232Z" } wheels = [ - { url = "https://files.pythonhosted.org/packages/6d/6f/8bde13dff964e96f2351c5aab0fc8a2ce69a16e1adeaed0c5558331b1f27/google_adk-2.6.2-py3-none-any.whl", hash = "sha256:59908032fa10ba0249aad12fb571d5f5cacb24f1c85e63a6eaec45c7c3ed01f1", size = 4305118, upload-time = "2026-08-04T01:20:20.307Z" }, + { url = "https://files.pythonhosted.org/packages/b3/44/b4f54c46f1c6a32318891ff2be25d854f4c5b5b9ed8ac507ed9466f1ccc8/google_adk-2.11.0-py3-none-any.whl", hash = "sha256:4774e1fc7bb37727e56142e7d41e9035949ebfc876a2b15d5505969b02798bcd", size = 4871441, upload-time = "2026-10-02T00:46:23.264Z" }, +] + +[package.optional-dependencies] +mcp = [ + { name = "aiohttp" }, + { name = "anyio" }, + { name = "mcp" }, ] [[package]] name = "google-auth" -version = "2.55.0" +version = "2.61.0" source = { registry = "https://pypi.org/simple" } dependencies = [ { name = "cryptography" }, { name = "pyasn1-modules" }, ] -sdist = { url = "https://files.pythonhosted.org/packages/81/1c/70b23fc52b2bb3c70b379f3bd05c4a60ab3a873e30c6bd21c57e0154848a/google_auth-2.55.0.tar.gz", hash = "sha256:fcd3a130f575fa36403d38774af1c64a4fbfbca09215f0589d2372b5119697cb", size = 349379, upload-time = "2026-06-15T22:33:16.466Z" } +sdist = { url = "https://files.pythonhosted.org/packages/c7/0b/9788e913f2202da49068c27ce821eebcf96319240a89d7bb11f206d6471f/google_auth-2.61.0.tar.gz", hash = "sha256:37f0815967322e8c32b12bf422531e8b637cafdaae0acbb9141117cfe6a96f23", size = 398379, upload-time = "2026-10-07T20:13:14.827Z" } wheels = [ - { url = "https://files.pythonhosted.org/packages/44/71/c0321dc6d63d99946da45f7c06299b934e4f7f7da5c4f14d101bcb39adf1/google_auth-2.55.0-py3-none-any.whl", hash = "sha256:a17cef9dedf98c4ebae2fb0c48c8f75952c877cbc2efe09f329ef16c2783d88a", size = 252400, upload-time = "2026-06-15T22:33:14.992Z" }, + { url = "https://files.pythonhosted.org/packages/1e/68/c2ff6043d93fda69e5c12a834d0be3b3fa6c762e89732160532566be621b/google_auth-2.61.0-py3-none-any.whl", hash = "sha256:ca60266a37475ae68b63bac007272f46094b3d571abe92aded329b6cfb568025", size = 268021, upload-time = "2026-10-07T20:13:13.2Z" }, ] [package.optional-dependencies] pyopenssl = [ - { name = "pyopenssl" }, + { name = "cryptography" }, ] requests = [ { name = "requests" }, @@ -1152,7 +1206,7 @@ requests = [ [[package]] name = "google-genai" -version = "2.12.1" +version = "2.29.0" source = { registry = "https://pypi.org/simple" } dependencies = [ { name = "anyio" }, @@ -1166,9 +1220,9 @@ dependencies = [ { name = "typing-extensions" }, { name = "websockets" }, ] -sdist = { url = "https://files.pythonhosted.org/packages/96/59/9ea84cbeb8f09694564d3b0ee9dd59003551b308d47b61f251415df93982/google_genai-2.12.1.tar.gz", hash = "sha256:78c25217885d63dc430ca7c4526853512b164a25a93a8a0d0af5b85971aa1db0", size = 636710, upload-time = "2026-07-16T16:15:02.035Z" } +sdist = { url = "https://files.pythonhosted.org/packages/21/2b/977616ef350e51d3d263eb43be23a91be793544cd937b51c0fac313be233/google_genai-2.29.0.tar.gz", hash = "sha256:124d3eef9ff6b9e4ea548f95ff5b7721683e7990c0a936b006d9e2ab61ea897d", size = 706902, upload-time = "2026-10-07T22:22:57.153Z" } wheels = [ - { url = "https://files.pythonhosted.org/packages/b6/b4/1369fb413fc2ba7f78acace5590b6e9990c52ab5d1d166aafaa1ae2c28c8/google_genai-2.12.1-py3-none-any.whl", hash = "sha256:686d5ec39bda345151d3ed1bac3915f01f49138b1ea519af2eb98f11cc55ebc4", size = 1023403, upload-time = "2026-07-16T16:14:59.79Z" }, + { url = "https://files.pythonhosted.org/packages/b8/27/a3dede4a1deb21f7fde6a171daa039bf0ea149a5e7826a785e8f109a6e13/google_genai-2.29.0-py3-none-any.whl", hash = "sha256:7adda55cb6746fb46d38ad3202c3372840b96eede964b5fb3df1469cd4998570", size = 1167603, upload-time = "2026-10-07T22:22:55.215Z" }, ] [[package]] @@ -1391,6 +1445,19 @@ wheels = [ { url = "https://files.pythonhosted.org/packages/7e/f5/f66802a942d491edb555dd61e3a9961140fd64c90bce1eafd741609d334d/httpcore-1.0.9-py3-none-any.whl", hash = "sha256:2d400746a40668fc9dec9810239072b40b4484b640a8c38fd654a024c7a1bf55", size = 78784, upload-time = "2025-04-24T22:06:20.566Z" }, ] +[[package]] +name = "httpcore2" +version = "2.13.1" +source = { registry = "https://pypi.org/simple" } +dependencies = [ + { name = "h11" }, + { name = "truststore" }, +] +sdist = { url = "https://files.pythonhosted.org/packages/cb/f3/1db7aa2bc2524062192bb0e0323969492d1883152a232fe36eea65f4e35c/httpcore2-2.13.1.tar.gz", hash = "sha256:e0aa977abe17e69a3b820a24542a6fa88702676d83880b8d194dcd18408e5103", size = 68071, upload-time = "2026-09-23T07:47:22.372Z" } +wheels = [ + { url = "https://files.pythonhosted.org/packages/09/ba/a4568248771ce81957bfb7cc600264a40fbcda092391ee1c415c50be4bea/httpcore2-2.13.1-py3-none-any.whl", hash = "sha256:e1e05d4f25f7d7d496bfb96748f6f4b67657b03da069b3a68c36069f3db73d0a", size = 83423, upload-time = "2026-09-23T07:47:19.365Z" }, +] + [[package]] name = "httpx" version = "0.28.1" @@ -1399,7 +1466,8 @@ dependencies = [ { name = "anyio" }, { name = "certifi" }, { name = "httpcore" }, - { name = "idna" }, + { name = "idna", version = "3.15", source = { registry = "https://pypi.org/simple" }, marker = "python_full_version < '3.11'" }, + { name = "idna", version = "3.20", source = { registry = "https://pypi.org/simple" }, marker = "python_full_version >= '3.11'" }, ] sdist = { url = "https://files.pythonhosted.org/packages/b1/df/48c586a5fe32a0f01324ee087459e112ebb7224f646c0b5023f5e79e9956/httpx-0.28.1.tar.gz", hash = "sha256:75e98c5f16b0f35b567856f597f06ff2270a374470a5c2392242528e3e3e42fc", size = 141406, upload-time = "2024-12-06T15:37:23.222Z" } wheels = [ @@ -1415,6 +1483,32 @@ wheels = [ { url = "https://files.pythonhosted.org/packages/d2/fd/6668e5aec43ab844de6fc74927e155a3b37bf40d7c3790e49fc0406b6578/httpx_sse-0.4.3-py3-none-any.whl", hash = "sha256:0ac1c9fe3c0afad2e0ebb25a934a59f4c7823b60792691f779fad2c5568830fc", size = 8960, upload-time = "2025-10-10T21:48:21.158Z" }, ] +[[package]] +name = "httpx2" +version = "2.13.1" +source = { registry = "https://pypi.org/simple" } +dependencies = [ + { name = "anyio", marker = "sys_platform != 'emscripten'" }, + { name = "httpcore2", marker = "sys_platform != 'emscripten'" }, + { name = "httpx2-jsfetch", marker = "python_full_version >= '3.12' and sys_platform == 'emscripten'" }, + { name = "idna", version = "3.20", source = { registry = "https://pypi.org/simple" } }, + { name = "truststore", marker = "sys_platform != 'emscripten'" }, + { name = "typing-extensions", marker = "python_full_version < '3.13'" }, +] +sdist = { url = "https://files.pythonhosted.org/packages/d5/44/474bef2a0e9d90f1715d32cb98b0738695ca17ba324095fb2497ed7fbd59/httpx2-2.13.1.tar.gz", hash = "sha256:e48744a19e3af5ee48313d0ce5fe941d5422fae5705ea922a4aabf94d7800dfa", size = 100405, upload-time = "2026-09-23T07:47:23.052Z" } +wheels = [ + { url = "https://files.pythonhosted.org/packages/d8/9c/6fe8931fd9f381042a9e4c7d5a7b4cbf7016b252bec0c99a49fce42c3326/httpx2-2.13.1-py3-none-any.whl", hash = "sha256:6dff50fabc270ee5fd25d845d0b078ed20564579744d6d962850975996d2f9a4", size = 95597, upload-time = "2026-09-23T07:47:20.995Z" }, +] + +[[package]] +name = "httpx2-jsfetch" +version = "1.0" +source = { registry = "https://pypi.org/simple" } +sdist = { url = "https://files.pythonhosted.org/packages/cd/c4/0e5636363151a2a1795e0a77617168b9ca438e1748ec05fc9b5687f93d64/httpx2_jsfetch-1.0.tar.gz", hash = "sha256:70a0e3eabfef7cce5ad9c629f7d01ca05e418f586646f4ddf14782e4c1454c60", size = 6872, upload-time = "2026-08-07T00:13:07.492Z" } +wheels = [ + { url = "https://files.pythonhosted.org/packages/9b/43/832f631d32e4f1211caa2ba368317739fe71f0b8530e4c9d15dc454bac2a/httpx2_jsfetch-1.0-py3-none-any.whl", hash = "sha256:cb916b707601e69a07721aabc8f3f6659be3a6893bc1ff5c6f9e02241df2da32", size = 6382, upload-time = "2026-08-07T00:13:06.567Z" }, +] + [[package]] name = "huggingface-hub" version = "1.15.0" @@ -1439,11 +1533,30 @@ wheels = [ name = "idna" version = "3.15" source = { registry = "https://pypi.org/simple" } +resolution-markers = [ + "python_full_version < '3.11'", +] sdist = { url = "https://files.pythonhosted.org/packages/82/77/7b3966d0b9d1d31a36ddf1746926a11dface89a83409bf1483f0237aa758/idna-3.15.tar.gz", hash = "sha256:ca962446ea538f7092a95e057da437618e886f4d349216d2b1e294abfdb65fdc", size = 199245, upload-time = "2026-05-12T22:45:57.011Z" } wheels = [ { url = "https://files.pythonhosted.org/packages/d2/23/408243171aa9aaba178d3e2559159c24c1171a641aa83b67bdd3394ead8e/idna-3.15-py3-none-any.whl", hash = "sha256:048adeaf8c2d788c40fee287673ccaa74c24ffd8dcf09ffa555a2fbb59f10ac8", size = 72340, upload-time = "2026-05-12T22:45:55.733Z" }, ] +[[package]] +name = "idna" +version = "3.20" +source = { registry = "https://pypi.org/simple" } +resolution-markers = [ + "python_full_version >= '3.15'", + "python_full_version == '3.14.*'", + "python_full_version == '3.13.*'", + "python_full_version == '3.12.*'", + "python_full_version == '3.11.*'", +] +sdist = { url = "https://files.pythonhosted.org/packages/f5/08/8eea9d4b8302028f3abb2c0813953f7aec26d33b7a8960ed760e65ff29fa/idna-3.20.tar.gz", hash = "sha256:a7db850025b95ded1eae8a46181a1a6c56c92c96f0e2b005d9ff8dc0210cab44", size = 216463, upload-time = "2026-09-17T14:11:04.752Z" } +wheels = [ + { url = "https://files.pythonhosted.org/packages/58/a2/bb081bab032533a855d44de1d56f8e8426114ff1ba5d1f07a438a0a654f8/idna-3.20-py3-none-any.whl", hash = "sha256:ab7ae7122974553370f0bdb919e1a960b2cd1bc1ef0276416d896db81c14582c", size = 69583, upload-time = "2026-09-17T14:11:03.168Z" }, +] + [[package]] name = "importlib-metadata" version = "8.7.1" @@ -1794,7 +1907,7 @@ resolution-markers = [ dependencies = [ { name = "jsonpatch" }, { name = "langchain-protocol", version = "0.0.18", source = { registry = "https://pypi.org/simple" } }, - { name = "langsmith", version = "0.8.18", source = { registry = "https://pypi.org/simple" } }, + { name = "langsmith", version = "0.12.6", source = { registry = "https://pypi.org/simple" } }, { name = "packaging" }, { name = "pydantic" }, { name = "pyyaml" }, @@ -1993,7 +2106,7 @@ wheels = [ [[package]] name = "langsmith" -version = "0.8.18" +version = "0.12.6" source = { registry = "https://pypi.org/simple" } resolution-markers = [ "python_full_version >= '3.15'", @@ -2003,20 +2116,24 @@ resolution-markers = [ "python_full_version == '3.11.*'", ] dependencies = [ - { name = "httpx" }, + { name = "anyio" }, + { name = "distro" }, + { name = "httpx2" }, { name = "orjson", marker = "platform_python_implementation != 'PyPy'" }, { name = "packaging" }, { name = "pydantic" }, { name = "requests" }, { name = "requests-toolbelt" }, + { name = "sniffio" }, + { name = "typing-extensions" }, { name = "uuid-utils" }, { name = "websockets" }, { name = "xxhash" }, { name = "zstandard" }, ] -sdist = { url = "https://files.pythonhosted.org/packages/9a/d9/a6681aa9847bbbc5ec21abe20a5e233b94e5edcfe39624db607ac7e8ccb4/langsmith-0.8.18.tar.gz", hash = "sha256:32dde9c0e67e053e0fb738921fc8ced768af7b8fa83d7a0e3fd63597cf8776dd", size = 4526988, upload-time = "2026-06-19T13:12:17.123Z" } +sdist = { url = "https://files.pythonhosted.org/packages/1f/ab/53c8110164e52ae759d3fed27a24cf860c717995be3ab652cf4d671a2a60/langsmith-0.12.6.tar.gz", hash = "sha256:f16901a5be1539f8c789cd26391f1935886f4029bfaf465d82afde7f7cb464bb", size = 4890684, upload-time = "2026-09-16T17:35:09.174Z" } wheels = [ - { url = "https://files.pythonhosted.org/packages/03/70/0e0cc80a3b064c8d6c8d697c3125ed86e39d5a7393ec6dc8b07cb1cf13c4/langsmith-0.8.18-py3-none-any.whl", hash = "sha256:3940183349993faef48e6c7d08e4822ee9cefd906b362d0e3c2d650314d2f282", size = 508108, upload-time = "2026-06-19T13:12:15.348Z" }, + { url = "https://files.pythonhosted.org/packages/73/03/e63610daca0bdadb6456648beea89e812f245293d39f2eb7287503e2f419/langsmith-0.12.6-py3-none-any.whl", hash = "sha256:5782b38dd259b2a6a1933dc9ca2beba4fb2899ad05e2ab10d61568dc49ce1d35", size = 768545, upload-time = "2026-09-16T17:35:07.252Z" }, ] [[package]] @@ -3733,18 +3850,6 @@ crypto = [ { name = "cryptography" }, ] -[[package]] -name = "pyopenssl" -version = "23.2.0" -source = { registry = "https://pypi.org/simple" } -dependencies = [ - { name = "cryptography" }, -] -sdist = { url = "https://files.pythonhosted.org/packages/be/df/75a6525d8988a89aed2393347e9db27a56cb38a3e864314fac223e905aef/pyOpenSSL-23.2.0.tar.gz", hash = "sha256:276f931f55a452e7dea69c7173e984eb2a4407ce413c918aa34b55f82f9b8bac", size = 185132, upload-time = "2023-05-31T03:21:28.901Z" } -wheels = [ - { url = "https://files.pythonhosted.org/packages/f0/e2/f8b4f1c67933a4907e52228241f4bd52169f3196b70af04403b29c63238a/pyOpenSSL-23.2.0-py3-none-any.whl", hash = "sha256:24f0dc5227396b3e831f4c7f602b950a5e9833d292c8e4a2e06b709292806ae2", size = 59036, upload-time = "2023-05-31T03:21:26.479Z" }, -] - [[package]] name = "pyparsing" version = "3.3.2" @@ -4089,7 +4194,8 @@ source = { registry = "https://pypi.org/simple" } dependencies = [ { name = "certifi" }, { name = "charset-normalizer" }, - { name = "idna" }, + { name = "idna", version = "3.15", source = { registry = "https://pypi.org/simple" }, marker = "python_full_version < '3.11'" }, + { name = "idna", version = "3.20", source = { registry = "https://pypi.org/simple" }, marker = "python_full_version >= '3.11'" }, { name = "urllib3" }, ] sdist = { url = "https://files.pythonhosted.org/packages/ac/c3/e2a2b89f2d3e2179abd6d00ebd70bff6273f37fb3e0cc209f48b39d00cbf/requests-2.34.2.tar.gz", hash = "sha256:f288924cae4e29463698d6d60bc6a4da69c89185ad1e0bcc4104f584e960b9ed", size = 142856, upload-time = "2026-05-14T19:25:27.735Z" } @@ -4423,12 +4529,13 @@ wheels = [ [[package]] name = "strands-agents" -version = "1.42.0" +version = "1.58.1" source = { registry = "https://pypi.org/simple" } dependencies = [ { name = "boto3" }, { name = "botocore" }, { name = "docstring-parser" }, + { name = "httpx" }, { name = "jsonschema" }, { name = "mcp" }, { name = "opentelemetry-api" }, @@ -4439,9 +4546,9 @@ dependencies = [ { name = "typing-extensions" }, { name = "watchdog" }, ] -sdist = { url = "https://files.pythonhosted.org/packages/da/9e/8d577e0ff9ad0a15b368f43c61b7034f918b1c1b51ef17465d1a39a00403/strands_agents-1.42.0.tar.gz", hash = "sha256:39113d67d2fc3e5686f58c63ab71b68e458d578f9e6e0105e03b8a3960b97595", size = 872195, upload-time = "2026-06-01T18:38:22.243Z" } +sdist = { url = "https://files.pythonhosted.org/packages/19/15/b87850332d13d77ababa1d50f7a2bb8797d422d834cc93e623b6be9459c1/strands_agents-1.58.1.tar.gz", hash = "sha256:02174515242fd31d847e6f4a5b019adbeec15e706070329068cc31a2e04cc921", size = 1738858, upload-time = "2026-10-06T21:02:36.326Z" } wheels = [ - { url = "https://files.pythonhosted.org/packages/86/16/426f1f8c7d2678230b68755fcb3c0b8f59bc3a5591efe48343566b8e73c5/strands_agents-1.42.0-py3-none-any.whl", hash = "sha256:6cc04a32fc23a443a651d0e40198d946afc809888ae6fbc1fd07b2d5b6e354b3", size = 440999, upload-time = "2026-06-01T18:38:20.231Z" }, + { url = "https://files.pythonhosted.org/packages/ee/63/d58939faaa6d4a6dc9082e812efa31b429eb5f105ae54c08da9a04e13342/strands_agents-1.58.1-py3-none-any.whl", hash = "sha256:5946a3e542a351678ed45b86fa9fd070efbc1f63f469cdc5b094a44966425ce3", size = 871746, upload-time = "2026-10-06T21:02:34.56Z" }, ] [[package]] @@ -4486,7 +4593,7 @@ wheels = [ [[package]] name = "temporalio" -version = "1.33.0" +version = "1.34.0" source = { registry = "https://pypi.org/simple" } dependencies = [ { name = "nexus-rpc" }, @@ -4495,47 +4602,117 @@ dependencies = [ { name = "types-protobuf" }, { name = "typing-extensions" }, ] -sdist = { url = "https://files.pythonhosted.org/packages/bd/64/b92769790411fa33ce2d037131f5bc856b90837ab1af3d093036f5144c15/temporalio-1.33.0.tar.gz", hash = "sha256:a1e506bcad08c995df7ec083bfd953f3c85bd1e2f6accbbb7562ef39386b3afb", size = 3065348, upload-time = "2026-09-15T00:53:07.558Z" } +sdist = { url = "https://files.pythonhosted.org/packages/13/85/9ece6f400552ed21951c8c5c534056e7d015cb065e3384470ec23ac24f28/temporalio-1.34.0.tar.gz", hash = "sha256:6453cb20e18df485e16578b22c82a9c4bcb1cf7eedd94147dfd373551d80f5b6", size = 3163890, upload-time = "2026-09-30T20:22:56.056Z" } wheels = [ - { url = "https://files.pythonhosted.org/packages/5c/21/eca23a5b343e1036b2449c18405df32d6e452bebaa3ce1e896551741f738/temporalio-1.33.0-cp310-abi3-macosx_10_12_x86_64.whl", hash = "sha256:152b808c622c83052e17e64e228c1fa0410c515a908ed8981d17cba527183cf9", size = 13900095, upload-time = "2026-09-15T00:52:51.43Z" }, - { url = "https://files.pythonhosted.org/packages/dd/89/91e8ed945b6e35f948e4cb01335bd8db0aa973f94d5ed86ead3c0f1fa6c2/temporalio-1.33.0-cp310-abi3-macosx_11_0_arm64.whl", hash = "sha256:a46970c35acf77dfe142ee2aa3504462a3ff7aa12abdada57e7e8e2488930cbc", size = 13572589, upload-time = "2026-09-15T00:52:53.98Z" }, - { url = "https://files.pythonhosted.org/packages/54/96/b23ed2a722f2758035dc5af03d93b426740a7f65ca573a6f9718a093594c/temporalio-1.33.0-cp310-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:c685f6f4629b72645c0f9a9811cb2275d8a7cd0b2893b3349bd0a53985ff6f46", size = 13974142, upload-time = "2026-09-15T00:52:56.152Z" }, - { url = "https://files.pythonhosted.org/packages/7a/12/63e13f93b5772f5bd2128990bfeec050f7de9e80ce4d8504d99f7f794b10/temporalio-1.33.0-cp310-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:efba3fec8735c4592c57a1a7aa4c2e4acf5a0765f53bd7366b94540755dbab0f", size = 14322659, upload-time = "2026-09-15T00:52:58.513Z" }, - { url = "https://files.pythonhosted.org/packages/b5/34/886675724adbdf4b8b01e37fabda07138eb4668ee50388fbd2ac308ec26f/temporalio-1.33.0-cp310-abi3-musllinux_1_2_aarch64.whl", hash = "sha256:79840232ed78943951d5f0069193b997d24e1da85890784a7d4351a48eb1f166", size = 14032190, upload-time = "2026-09-15T00:53:00.726Z" }, - { url = "https://files.pythonhosted.org/packages/7f/00/11d89ec3017fd7fe9c6cfcc8b2f52e8327ff82ff8412b361e5f2efda1e32/temporalio-1.33.0-cp310-abi3-musllinux_1_2_x86_64.whl", hash = "sha256:8f52f2f175aed174de21fc5782e5cba1e9e2e37cfd5687d5a8bd084b4deba483", size = 14423865, upload-time = "2026-09-15T00:53:02.932Z" }, - { url = "https://files.pythonhosted.org/packages/1b/b9/ee3ceb93733512cd9faea4d0d1d604965870aa2e35bf0cfa83e6dba47199/temporalio-1.33.0-cp310-abi3-win_amd64.whl", hash = "sha256:33b5ff39c6737d21c6f16d3fef0c458d64aa9e78ce187e293bda6998d29ea7b8", size = 15254531, upload-time = "2026-09-15T00:53:05.319Z" }, + { url = "https://files.pythonhosted.org/packages/3c/71/e55380e7820819357afada375d4e5c33d141bb94a08fda35aa0551b4369b/temporalio-1.34.0-cp310-abi3-macosx_10_12_x86_64.whl", hash = "sha256:87118447ad13e1062b79bfc8b44b1695e8328ac9c6be1776e426e87b501b135a", size = 14064102, upload-time = "2026-09-30T20:22:35.601Z" }, + { url = "https://files.pythonhosted.org/packages/db/78/356c8e2f0ec1678b757d4c5e8a1b0b1c65b15b8afb2335ad2944c158ea10/temporalio-1.34.0-cp310-abi3-macosx_11_0_arm64.whl", hash = "sha256:023fff9cd9dd21860061e003880dcf95250700f5afab96c030c9cb258504dab8", size = 13763219, upload-time = "2026-09-30T20:22:38.774Z" }, + { url = "https://files.pythonhosted.org/packages/e9/00/4a4b4e018c4c12b4691211aca1d97db8707ed4c9e31f40dcf09784c9913d/temporalio-1.34.0-cp310-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:cdb6e2fb525ea5635afa4a3f1ae4c992c16dbe29dc92939a85153baeb69d95a2", size = 14121901, upload-time = "2026-09-30T20:22:41.428Z" }, + { url = "https://files.pythonhosted.org/packages/c1/20/b032d4a0df51d466fd929d8205e1288e83d97a890f021479f43af9bd6f9b/temporalio-1.34.0-cp310-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:540761f738bdfe5cb5bd7240b659e116a0b5094b94282aef09b8d8c2d66e9c52", size = 14457183, upload-time = "2026-09-30T20:22:44.215Z" }, + { url = "https://files.pythonhosted.org/packages/b6/0d/b08ffeca93bbc29200a5bd85a45cca3c6be0a123de605ecd1798b617df4f/temporalio-1.34.0-cp310-abi3-musllinux_1_2_aarch64.whl", hash = "sha256:87647f87f42ecd45efb675642e2ec8ca34aa42359f5968f31f5391f1db5ebcbe", size = 14179836, upload-time = "2026-09-30T20:22:47.474Z" }, + { url = "https://files.pythonhosted.org/packages/81/55/acde4d1b7c9f23434e263752ef0a3ef58adeb3b95ef8472607414798dfaa/temporalio-1.34.0-cp310-abi3-musllinux_1_2_x86_64.whl", hash = "sha256:71caa4b9061628b22a457c87c3b16da40f7ac6ac1a26ece9aa1ee6b4934404d7", size = 14570248, upload-time = "2026-09-30T20:22:50.569Z" }, + { url = "https://files.pythonhosted.org/packages/cc/c5/6bdc3b02ec483093a71e9f887e8a50ae20fcc79e0578ed7435a81d4271b1/temporalio-1.34.0-cp310-abi3-win_amd64.whl", hash = "sha256:03bd86561188c18d88425178bc690fe0791104b78566dcebd98f59cbdbce0952", size = 15415684, upload-time = "2026-09-30T20:22:53.342Z" }, ] [package.optional-dependencies] -deepagents = [ +opentelemetry = [ + { name = "opentelemetry-api" }, + { name = "opentelemetry-sdk" }, +] +pydantic = [ + { name = "pydantic" }, +] + +[[package]] +name = "temporalio-deepagents" +version = "0.0.1" +source = { registry = "https://pypi.org/simple" } +dependencies = [ { name = "deepagents" }, { name = "langchain", version = "1.3.15", source = { registry = "https://pypi.org/simple" } }, { name = "langchain-core", version = "1.5.4", source = { registry = "https://pypi.org/simple" } }, + { name = "langgraph", version = "1.2.11", source = { registry = "https://pypi.org/simple" } }, + { name = "langsmith", version = "0.12.6", source = { registry = "https://pypi.org/simple" } }, + { name = "pydantic" }, + { name = "temporalio" }, ] -google-adk = [ +sdist = { url = "https://files.pythonhosted.org/packages/a3/0d/dca4dc7ade5695e97488a6e4d0d59ed489a0d1b8a9e8d4c4a99b9883ebe2/temporalio_deepagents-0.0.1.tar.gz", hash = "sha256:ce7793b9ec98e96ad52768ca99a18f9e291b57024df7c06c3965b53e1739d79f", size = 39336, upload-time = "2026-10-07T17:17:20.72Z" } +wheels = [ + { url = "https://files.pythonhosted.org/packages/96/7b/14b4f1e22f9eb5019b5d5349f99809a76fdeb456f6834683fffbf7559fa3/temporalio_deepagents-0.0.1-py3-none-any.whl", hash = "sha256:270f5acc74ff1ce12661bd01f385e80463c02605b14dea9782b9dd0730c15a38", size = 44698, upload-time = "2026-10-07T17:17:19.447Z" }, +] + +[[package]] +name = "temporalio-google-adk" +version = "0.0.1" +source = { registry = "https://pypi.org/simple" } +dependencies = [ { name = "google-adk" }, - { name = "mcp" }, + { name = "google-genai" }, + { name = "opentelemetry-api" }, + { name = "opentelemetry-sdk" }, + { name = "pydantic" }, + { name = "temporalio" }, ] -google-genai = [ +sdist = { url = "https://files.pythonhosted.org/packages/e6/76/560481d0fdf61f3644a7eeac329915e72d13cd842d4e734b46172a74ee6c/temporalio_google_adk-0.0.1.tar.gz", hash = "sha256:faad4a0a210e0788859b3548f5f14794de65a498b6bcb56b7457ea6e40286e9f", size = 28843, upload-time = "2026-10-07T18:48:47.47Z" } +wheels = [ + { url = "https://files.pythonhosted.org/packages/af/e6/f19f7f07268e7537b5028557426ec050c0645baabb94d81ee26707955d88/temporalio_google_adk-0.0.1-py3-none-any.whl", hash = "sha256:0c82b463d00f3c53eeb25c71e22ea4277502e8f9d9862dcd29e9770eca3d8f8e", size = 31334, upload-time = "2026-10-07T18:48:45.902Z" }, +] + +[package.optional-dependencies] +mcp = [ + { name = "google-adk", extra = ["mcp"] }, +] + +[[package]] +name = "temporalio-google-genai" +version = "0.1.0" +source = { registry = "https://pypi.org/simple" } +dependencies = [ { name = "google-genai" }, + { name = "pydantic" }, + { name = "temporalio" }, ] -langgraph = [ +sdist = { url = "https://files.pythonhosted.org/packages/3d/2a/eeaf7cab52aa6500e7b325378fd20347dba4a905293959ffb91b0468b35f/temporalio_google_genai-0.1.0.tar.gz", hash = "sha256:ce90309de31f8080930a7de1fec16ac9542419325b420e487c88aa38f9ab1f53", size = 31914, upload-time = "2026-10-07T20:56:53.814Z" } +wheels = [ + { url = "https://files.pythonhosted.org/packages/a0/0e/979153cfdba59d0be935e3235ffd3388c043ec4b5d519bc99f9927661763/temporalio_google_genai-0.1.0-py3-none-any.whl", hash = "sha256:48dac47903277100434aa8687a71dcf93bfd652f49c43ac0671872f6b175680e", size = 42970, upload-time = "2026-10-07T20:56:52.45Z" }, +] + +[package.optional-dependencies] +mcp = [ + { name = "mcp" }, +] + +[[package]] +name = "temporalio-langgraph" +version = "0.1.0" +source = { registry = "https://pypi.org/simple" } +dependencies = [ + { name = "langchain-core", version = "1.4.0", source = { registry = "https://pypi.org/simple" }, marker = "python_full_version < '3.11'" }, + { name = "langchain-core", version = "1.5.4", source = { registry = "https://pypi.org/simple" }, marker = "python_full_version >= '3.11'" }, { name = "langgraph", version = "1.2.0", source = { registry = "https://pypi.org/simple" }, marker = "python_full_version < '3.11'" }, { name = "langgraph", version = "1.2.11", source = { registry = "https://pypi.org/simple" }, marker = "python_full_version >= '3.11'" }, + { name = "temporalio" }, + { name = "typing-extensions" }, ] -langsmith = [ - { name = "langsmith", version = "0.8.9", source = { registry = "https://pypi.org/simple" }, marker = "python_full_version < '3.11'" }, - { name = "langsmith", version = "0.8.18", source = { registry = "https://pypi.org/simple" }, marker = "python_full_version >= '3.11'" }, -] -opentelemetry = [ - { name = "opentelemetry-api" }, - { name = "opentelemetry-sdk" }, +sdist = { url = "https://files.pythonhosted.org/packages/a0/03/21d4cbeda7843c276d01aea5fe6d17bd82877ac4111f29b39975e568cb6e/temporalio_langgraph-0.1.0.tar.gz", hash = "sha256:35d67361016052b7a87e3878096ca9cd77a7390979dbb60e5b5bb32b53098e0d", size = 17438, upload-time = "2026-10-07T21:36:42.771Z" } +wheels = [ + { url = "https://files.pythonhosted.org/packages/e0/2b/af6582b850ce59ca84d491c24a92d0bfaa6eb0ea02a73e15df6e66af6b73/temporalio_langgraph-0.1.0-py3-none-any.whl", hash = "sha256:7a1643d089559d70cf3982eea9628810dc0981a1bc599f376d66a2dc69a3779e", size = 20352, upload-time = "2026-10-07T21:36:41.445Z" }, ] -pydantic = [ - { name = "pydantic" }, + +[[package]] +name = "temporalio-langsmith" +version = "0.1.0" +source = { registry = "https://pypi.org/simple" } +dependencies = [ + { name = "langchain-core", version = "1.4.0", source = { registry = "https://pypi.org/simple" }, marker = "python_full_version < '3.11'" }, + { name = "langchain-core", version = "1.5.4", source = { registry = "https://pypi.org/simple" }, marker = "python_full_version >= '3.11'" }, + { name = "langsmith", version = "0.8.9", source = { registry = "https://pypi.org/simple" }, marker = "python_full_version < '3.11'" }, + { name = "langsmith", version = "0.12.6", source = { registry = "https://pypi.org/simple" }, marker = "python_full_version >= '3.11'" }, + { name = "nexus-rpc" }, + { name = "temporalio" }, ] -strands-agents = [ - { name = "strands-agents" }, +sdist = { url = "https://files.pythonhosted.org/packages/db/3b/29e67f44787fcfb7ee8b45c3f40116c5a8189499b9bfe7b43514f1d2d54d/temporalio_langsmith-0.1.0.tar.gz", hash = "sha256:3de432700871d95a364c4da507074430f388b678047dfee47543d93025eb2ff1", size = 213609, upload-time = "2026-10-07T22:34:17.718Z" } +wheels = [ + { url = "https://files.pythonhosted.org/packages/04/41/f88a3c4874e51f688bee85540706b25ff082beff4fb40b21f1b3ba5c513e/temporalio_langsmith-0.1.0-py3-none-any.whl", hash = "sha256:5dd7078d78294b4cd2812a8e41ccaf938aec412aa586145d8aa9b5e9f0fa42d3", size = 213573, upload-time = "2026-10-07T22:34:16.191Z" }, ] [[package]] @@ -4576,7 +4753,8 @@ cloud-export-to-parquet = [ ] deepagents = [ { name = "langchain-anthropic", version = "1.5.5", source = { registry = "https://pypi.org/simple" }, marker = "python_full_version >= '3.11'" }, - { name = "temporalio", extra = ["deepagents", "langsmith"], marker = "python_full_version >= '3.11'" }, + { name = "temporalio-deepagents", marker = "python_full_version >= '3.11'" }, + { name = "temporalio-langsmith", marker = "python_full_version >= '3.11'" }, ] dev = [ { name = "fakeredis" }, @@ -4615,11 +4793,11 @@ google-adk = [ { name = "google-adk" }, { name = "opentelemetry-exporter-prometheus" }, { name = "prometheus-client" }, - { name = "temporalio", extra = ["google-adk", "opentelemetry"] }, + { name = "temporalio", extra = ["opentelemetry"] }, + { name = "temporalio-google-adk", extra = ["mcp"] }, ] google-genai = [ - { name = "mcp" }, - { name = "temporalio", extra = ["google-genai", "pydantic"] }, + { name = "temporalio-google-genai", extra = ["mcp"] }, ] langfuse-tracing = [ { name = "openai" }, @@ -4635,13 +4813,15 @@ langgraph = [ { name = "langchain-anthropic", version = "1.5.5", source = { registry = "https://pypi.org/simple" }, marker = "python_full_version >= '3.11'" }, { name = "langgraph", version = "1.2.0", source = { registry = "https://pypi.org/simple" }, marker = "python_full_version < '3.11'" }, { name = "langgraph", version = "1.2.11", source = { registry = "https://pypi.org/simple" }, marker = "python_full_version >= '3.11'" }, - { name = "temporalio", extra = ["langgraph", "langsmith"] }, + { name = "temporalio-langgraph" }, + { name = "temporalio-langsmith" }, ] langsmith-tracing = [ { name = "langsmith", version = "0.8.9", source = { registry = "https://pypi.org/simple" }, marker = "python_full_version < '3.11'" }, - { name = "langsmith", version = "0.8.18", source = { registry = "https://pypi.org/simple" }, marker = "python_full_version >= '3.11'" }, + { name = "langsmith", version = "0.12.6", source = { registry = "https://pypi.org/simple" }, marker = "python_full_version >= '3.11'" }, { name = "openai" }, - { name = "temporalio", extra = ["langsmith", "pydantic"] }, + { name = "temporalio", extra = ["pydantic"] }, + { name = "temporalio-langsmith" }, ] litellm = [ { name = "litellm" }, @@ -4669,7 +4849,7 @@ strands-agents = [ { name = "mcp" }, { name = "strands-agents" }, { name = "strands-agents-tools" }, - { name = "temporalio", extra = ["pydantic", "strands-agents"] }, + { name = "temporalio-strands-agents" }, ] trio-async = [ { name = "trio" }, @@ -4679,7 +4859,7 @@ trio-async = [ [package.metadata] requires-dist = [ { name = "protobuf", specifier = ">=5.29.6,<6" }, - { name = "temporalio", specifier = ">=1.32.0,<2" }, + { name = "temporalio", specifier = ">=1.34.0,<2" }, ] [package.metadata.requires-dev] @@ -4692,7 +4872,8 @@ cloud-export-to-parquet = [ ] deepagents = [ { name = "langchain-anthropic", marker = "python_full_version >= '3.11'", specifier = ">=1.4.7,<2" }, - { name = "temporalio", extras = ["deepagents", "langsmith"], marker = "python_full_version >= '3.11'", specifier = ">=1.32.0" }, + { name = "temporalio-deepagents", marker = "python_full_version >= '3.11'", specifier = ">=0.0.1" }, + { name = "temporalio-langsmith", marker = "python_full_version >= '3.11'", specifier = ">=0.1.0" }, ] dev = [ { name = "fakeredis", specifier = ">=2,<3" }, @@ -4713,7 +4894,7 @@ dsl = [ ] encryption = [ { name = "aiohttp", specifier = ">=3.13.3,<4" }, - { name = "cryptography", specifier = ">=38.0.1,<39" }, + { name = "cryptography", specifier = ">=41.0.5" }, ] external-storage = [ { name = "aioboto3", specifier = ">=15.1.0,<15.2" }, @@ -4727,12 +4908,10 @@ google-adk = [ { name = "google-adk", specifier = ">=2.2.0,<3" }, { name = "opentelemetry-exporter-prometheus", specifier = ">=0.48b0" }, { name = "prometheus-client", specifier = ">=0.21" }, - { name = "temporalio", extras = ["google-adk", "opentelemetry"], specifier = ">=1.32.0,<2" }, -] -google-genai = [ - { name = "mcp", specifier = ">=1.0.0" }, - { name = "temporalio", extras = ["google-genai", "pydantic"], specifier = ">=1.32.0" }, + { name = "temporalio", extras = ["opentelemetry"], specifier = ">=1.34.0,<2" }, + { name = "temporalio-google-adk", extras = ["mcp"], specifier = ">=0.0.1" }, ] +google-genai = [{ name = "temporalio-google-genai", extras = ["mcp"], specifier = ">=0.1.0" }] langfuse-tracing = [ { name = "openai", specifier = ">=1.4.0" }, { name = "openinference-instrumentation-openai", specifier = ">=0.1.52" }, @@ -4744,12 +4923,14 @@ langgraph = [ { name = "langchain", specifier = ">=0.3.0" }, { name = "langchain-anthropic", specifier = ">=0.3.0" }, { name = "langgraph", specifier = ">=1.1.3" }, - { name = "temporalio", extras = ["langgraph", "langsmith"], specifier = ">=1.32.0" }, + { name = "temporalio-langgraph", specifier = ">=0.1.0" }, + { name = "temporalio-langsmith", specifier = ">=0.1.0" }, ] langsmith-tracing = [ { name = "langsmith", specifier = ">=0.7.0" }, { name = "openai", specifier = ">=1.4.0" }, - { name = "temporalio", extras = ["pydantic", "langsmith"], specifier = ">=1.32.0" }, + { name = "temporalio", extras = ["pydantic"], specifier = ">=1.34.0,<2" }, + { name = "temporalio-langsmith", specifier = ">=0.1.0" }, ] litellm = [{ name = "litellm", specifier = ">=1.85.0,<2" }] nexus = [{ name = "nexus-rpc", specifier = ">=1.1.0,<2" }] @@ -4769,13 +4950,28 @@ strands-agents = [ { name = "mcp", specifier = ">=1.0.0" }, { name = "strands-agents", specifier = ">=1.39.0" }, { name = "strands-agents-tools", specifier = ">=0.5.2" }, - { name = "temporalio", extras = ["strands-agents", "pydantic"], specifier = ">=1.32.0" }, + { name = "temporalio-strands-agents", specifier = ">=0.1.0" }, ] trio-async = [ { name = "trio", specifier = ">=0.28.0,<0.29" }, { name = "trio-asyncio", specifier = ">=0.15.0,<0.16" }, ] +[[package]] +name = "temporalio-strands-agents" +version = "0.1.0" +source = { registry = "https://pypi.org/simple" } +dependencies = [ + { name = "botocore" }, + { name = "mcp" }, + { name = "strands-agents" }, + { name = "temporalio" }, +] +sdist = { url = "https://files.pythonhosted.org/packages/35/ab/2b2a30df8ef357546e14a151ab114869da541405d99da513a74b9c4fc89f/temporalio_strands_agents-0.1.0.tar.gz", hash = "sha256:1da8ac046004bb83f12cd3c87df278f4c71ee11c2abecfb791928e22c22c3f75", size = 36060, upload-time = "2026-10-07T22:52:50.223Z" } +wheels = [ + { url = "https://files.pythonhosted.org/packages/f5/52/2d8e3126bbfc88f6cf8cbbacf98550ea509e3796885420344b1f49a7eb2d/temporalio_strands_agents-0.1.0-py3-none-any.whl", hash = "sha256:3227ae604e845feeab0f0868fc301d44b299585935dfb42c47d9910234f74e9f", size = 36680, upload-time = "2026-10-07T22:52:49.072Z" }, +] + [[package]] name = "tenacity" version = "9.1.4" @@ -4947,7 +5143,8 @@ dependencies = [ { name = "attrs" }, { name = "cffi", marker = "implementation_name != 'pypy' and os_name == 'nt'" }, { name = "exceptiongroup", marker = "python_full_version < '3.11'" }, - { name = "idna" }, + { name = "idna", version = "3.15", source = { registry = "https://pypi.org/simple" }, marker = "python_full_version < '3.11'" }, + { name = "idna", version = "3.20", source = { registry = "https://pypi.org/simple" }, marker = "python_full_version >= '3.11'" }, { name = "outcome" }, { name = "sniffio" }, { name = "sortedcontainers" }, @@ -4973,6 +5170,15 @@ wheels = [ { url = "https://files.pythonhosted.org/packages/2b/3f/a529b02ae6a4145721eaf952cdf19f2627bd4f5e248b010f77c0064eb4f6/trio_asyncio-0.15.0-py3-none-any.whl", hash = "sha256:7dad5a5edcc7c90c5b80b777dcaef11c22668ce7ddc374633068c2b35d683d62", size = 39786, upload-time = "2024-04-24T22:23:57.699Z" }, ] +[[package]] +name = "truststore" +version = "0.10.4" +source = { registry = "https://pypi.org/simple" } +sdist = { url = "https://files.pythonhosted.org/packages/53/a3/1585216310e344e8102c22482f6060c7a6ea0322b63e026372e6dcefcfd6/truststore-0.10.4.tar.gz", hash = "sha256:9d91bd436463ad5e4ee4aba766628dd6cd7010cf3e2461756b3303710eebc301", size = 26169, upload-time = "2025-08-12T18:49:02.73Z" } +wheels = [ + { url = "https://files.pythonhosted.org/packages/19/97/56608b2249fe206a67cd573bc93cd9896e1efb9e98bce9c163bcdc704b88/truststore-0.10.4-py3-none-any.whl", hash = "sha256:adaeaecf1cbb5f4de3b1959b42d41f6fab57b2b1666adb59e89cb0b53361d981", size = 18660, upload-time = "2025-08-12T18:49:01.46Z" }, +] + [[package]] name = "typer" version = "0.25.1" @@ -5048,18 +5254,6 @@ wheels = [ { url = "https://files.pythonhosted.org/packages/ce/e4/dccd7f47c4b64213ac01ef921a1337ee6e30e8c6466046018326977efd95/tzdata-2026.2-py2.py3-none-any.whl", hash = "sha256:bbe9af844f658da81a5f95019480da3a89415801f6cc966806612cc7169bffe7", size = 349321, upload-time = "2026-04-24T15:22:05.876Z" }, ] -[[package]] -name = "tzlocal" -version = "5.4.3" -source = { registry = "https://pypi.org/simple" } -dependencies = [ - { name = "tzdata", marker = "sys_platform == 'win32'" }, -] -sdist = { url = "https://files.pythonhosted.org/packages/48/55/15e2340963d2bfedcc6042da3911438fd336f8ae96b65bdbe3a29766da0c/tzlocal-5.4.3.tar.gz", hash = "sha256:3a8c9bc18cf47e1dcde252ea0e6a72a6cde320a400b6ac6db1f1f8cccd553c00", size = 30873, upload-time = "2026-06-17T04:17:41.764Z" } -wheels = [ - { url = "https://files.pythonhosted.org/packages/42/28/fc144409c71569e928585f8f3c629d80d1ca3ef40175e9222f01588f98c9/tzlocal-5.4.3-py3-none-any.whl", hash = "sha256:24ce97bb58e2a973f7640ec2553ab4e6f6d5a0d0d1aa9dc43bca21d89e1feb82", size = 18039, upload-time = "2026-06-17T04:17:40.027Z" }, -] - [[package]] name = "urllib3" version = "2.7.0" @@ -5560,7 +5754,8 @@ name = "yarl" version = "1.23.0" source = { registry = "https://pypi.org/simple" } dependencies = [ - { name = "idna" }, + { name = "idna", version = "3.15", source = { registry = "https://pypi.org/simple" }, marker = "python_full_version < '3.11'" }, + { name = "idna", version = "3.20", source = { registry = "https://pypi.org/simple" }, marker = "python_full_version >= '3.11'" }, { name = "multidict" }, { name = "propcache" }, ] From 155a16b45af06acf229c8d78877d71ffd4777244 Mon Sep 17 00:00:00 2001 From: Brian Strauch Date: Thu, 8 Oct 2026 21:56:55 -0700 Subject: [PATCH 02/13] Add Deep Agents external storage sample --- deepagents_plugin/README.md | 15 ++- deepagents_plugin/external_storage/README.md | 121 +++++++++++++++++ deepagents_plugin/external_storage/client.py | 64 +++++++++ deepagents_plugin/external_storage/main.py | 71 ++++++++++ .../external_storage/workflow.py | 75 +++++++++++ .../external_storage_test.py | 125 ++++++++++++++++++ 6 files changed, 467 insertions(+), 4 deletions(-) create mode 100644 deepagents_plugin/external_storage/README.md create mode 100644 deepagents_plugin/external_storage/client.py create mode 100644 deepagents_plugin/external_storage/main.py create mode 100644 deepagents_plugin/external_storage/workflow.py create mode 100644 tests/deepagents_plugin/external_storage_test.py diff --git a/deepagents_plugin/README.md b/deepagents_plugin/README.md index 7f5d435b9..d5fb90296 100644 --- a/deepagents_plugin/README.md +++ b/deepagents_plugin/README.md @@ -26,6 +26,7 @@ one side. | [subagents](subagents) | Durability propagates across the agent tree — sub-agent model calls become activities with no per-sub-agent wiring. | | [streaming](streaming) | Stream model chunks to external subscribers via `streaming_topic` + `WorkflowStream`, keeping the durable result identical. | | [langsmith_tracing](langsmith_tracing) | Compose `DeepAgentsPlugin` with `LangSmithPlugin` for durable execution + LLM tracing. | +| [external_storage](external_storage) | Carry a 6 MiB tool result and the next model input through native S3 External Storage; scripted model, no API keys. | ## Prerequisites @@ -45,8 +46,10 @@ one side. > Temporal 1.34.0 or later and Python >= 3.11 — on older interpreters the group resolves to nothing > and the samples are skipped. -2. Configure a model provider. The samples use - `anthropic:claude-sonnet-4-5`, which needs an Anthropic API key: +2. Configure a model provider. Most samples use + `anthropic:claude-sonnet-4-5`, which needs an Anthropic API key. The + [external_storage](external_storage) sample uses a scripted model and needs + no provider credentials: ```bash export ANTHROPIC_API_KEY=... @@ -85,11 +88,13 @@ uv run deepagents_plugin/hello_world/run_worker.py uv run deepagents_plugin/hello_world/run_workflow.py ``` -The `langsmith_tracing` sample instead bundles the worker and starter into a -single driver: +The `langsmith_tracing` and `external_storage` samples instead bundle the worker +and starter into a single driver. The storage sample also needs a mock S3 service; +see its [setup instructions](external_storage): ```bash uv run deepagents_plugin/langsmith_tracing/main.py +uv run deepagents_plugin/external_storage/main.py ``` ## Key Features Demonstrated @@ -109,6 +114,8 @@ uv run deepagents_plugin/langsmith_tracing/main.py - **Streaming** — forward model chunks to external subscribers while keeping the durable result unchanged. - **Observability** — compose with `LangSmithPlugin` for tracing. +- **Large payload storage** — compose native `ExternalStorage` with the plugin's + data converter, keeping full tool results in S3 and small references in history. ## Related diff --git a/deepagents_plugin/external_storage/README.md b/deepagents_plugin/external_storage/README.md new file mode 100644 index 000000000..3fe8af72c --- /dev/null +++ b/deepagents_plugin/external_storage/README.md @@ -0,0 +1,121 @@ +# External Storage + +Run a Deep Agent whose `read_file` tool returns **6 MiB** of text, exceeding +Temporal's default 2 MiB payload limit. The SDK's native `ExternalStorage` +offloads the tool output and the next model activity's input to S3, recording +small references in workflow history and retrieving the full bytes on decode. +The workflow returns only a byte count, SHA-256, and a short final answer. + +Native External Storage is in **Public Preview**. This sample uses the SDK's +`S3StorageDriver` with the local mock S3 service from the +[general External Storage sample](../../external_storage). Neither AWS credentials, +Docker, nor an LLM API key is needed. The model replies are scripted; the real +Deep Agents loop, tool activity, model activities, and S3 transfers still run. + +## Running the sample + +Use Python **3.11 or later**. Run these commands from the repository root: + +```bash +uv sync --python 3.13 --group deepagents --group external-storage +``` + +Start Temporal with its default payload limits in one terminal: + +```bash +temporal server start-dev +``` + +In a second terminal, start the existing mock S3 service. It listens on port +5000 and creates the `temporal-payloads` bucket: + +```bash +uv run external_storage/s3.py +``` + +In a third terminal, run the demo. It starts a worker, executes one workflow, +checks the result's integrity, and shuts down the worker: + +```bash +uv run deepagents_plugin/external_storage/main.py +``` + +The output includes: + +```text +Tool result: 6,291,456 bytes (6 MiB), integrity verified +Agent: Received the complete document. +``` + +The script also prints the workflow ID and complete SHA-256. Inspect the history +in the Temporal UI or with: + +```bash +temporal workflow show --workflow-id +``` + +The completed `deepagents.invoke_tool` activity and the following +`deepagents.invoke_model` input contain native storage references. The first +model input and final workflow result remain small and inline. + +To view externally stored payloads in the UI, reuse the +[storage-aware codec server](../../external_storage#5-optional-run-the-codec-server): +run `uv run external_storage/codec_server.py` and set the UI's Remote Codec +Endpoint to `http://localhost:8081`. Its gzip decoder passes uncompressed payloads +through, so it can also read this sample's references. + +## How the configuration works + +`client.py` creates `ExternalStorage(drivers=[driver], +payload_size_threshold=256 * 1024)`. It uses the SDK's `SimplePlugin` converter +hook to apply this configuration **after** `DeepAgentsPlugin` installs its +LangChain-aware payload converter: + +```python +def configure(converter: DataConverter | None) -> DataConverter: + return replace(converter or DataConverter.default, external_storage=storage) + +client = await Client.connect( + "localhost:7233", + plugins=[ + create_plugin(), + SimplePlugin("ExternalStorage", data_converter=configure), + ], +) +``` + +This order also supports the older plugin version in this repository's lockfile, +which otherwise replaces the client's converter. The worker inherits the final +converter. The S3 client stays open while the worker runs and the starter decodes +results. No application code uploads or downloads payloads manually. + +This demo deliberately uses **no compression codec**: repeated `x` characters +would compress well below the storage threshold. It overrides the built-in +`read_file` tool with an activity-backed mock bulk reader. Deep Agents excludes +`read_file` from tool-result eviction, so the complete result crosses both +activity boundaries. Applications using real models should page documents or +retrieve excerpts to manage context separately. Storage reduces transport and +history bytes; it does not reduce model tokens or decoded workflow memory. + +With storage removed, this tool result fails with `PayloadsTooLarge` at the +default limits. Raising the blob limit alone still leaves the gRPC message +limit described in [Hanyu Liu's post](https://hanyuliu.me/posts/temporal-deep-agent-payload-limits/). +Native storage avoids transmitting the large bytes through either limit. + +For real S3, use an existing bucket and normal AWS credentials instead of this +sample's local endpoint and mock credentials. Configure compatible storage +drivers on every client, worker, and replayer that reads the history. Retain +objects for as long as execution, reset, or replay may need them; Temporal does +not delete stored payloads when an activity finishes. + +## Tests + +The integration test starts an isolated mock S3 service and verifies the full +result, both native references, activity routing, and replay with a new S3 +client after worker shutdown. +No manually running S3 service or model credentials are required: + +```bash +uv sync --python 3.13 --group deepagents --group external-storage --group dev +uv run pytest tests/deepagents_plugin/external_storage_test.py +``` diff --git a/deepagents_plugin/external_storage/client.py b/deepagents_plugin/external_storage/client.py new file mode 100644 index 000000000..92fdca481 --- /dev/null +++ b/deepagents_plugin/external_storage/client.py @@ -0,0 +1,64 @@ +"""Compose native S3 storage with the Deep Agents data converter.""" + +from collections.abc import AsyncIterator +from contextlib import asynccontextmanager +from dataclasses import replace + +import aioboto3 +from temporalio.client import Client +from temporalio.contrib.aws.s3driver import S3StorageDriver +from temporalio.contrib.aws.s3driver.aioboto3 import new_aioboto3_client +from temporalio.contrib.deepagents import DeepAgentsPlugin +from temporalio.converter import DataConverter, ExternalStorage +from temporalio.envconfig import ClientConfig +from temporalio.plugin import SimplePlugin + +S3_ENDPOINT = "http://localhost:5000" +S3_BUCKET = "temporal-payloads" + + +# @@@SNIPSTART python-deepagents-external-storage-converter +def storage_plugin(storage: ExternalStorage) -> SimplePlugin: + """Add storage after the agent plugin has installed its payload converter.""" + + def configure(converter: DataConverter | None) -> DataConverter: + return replace(converter or DataConverter.default, external_storage=storage) + + # Applying this after DeepAgentsPlugin also supports older plugin versions + # that replace the converter rather than composing with the client's one. + return SimplePlugin("ExternalStorage", data_converter=configure) + + +@asynccontextmanager +async def connect_client( + plugin: DeepAgentsPlugin, + *, + target_host: str | None = None, + s3_endpoint: str = S3_ENDPOINT, +) -> AsyncIterator[Client]: + """Keep the S3 client alive throughout workflow execution and payload reads.""" + config = ClientConfig.load_client_connect_config() + config.setdefault("target_host", "localhost:7233") + if target_host is not None: + config["target_host"] = target_host + + session = aioboto3.Session() + async with session.client( + "s3", + endpoint_url=s3_endpoint, + aws_access_key_id="test", + aws_secret_access_key="test", + region_name="us-east-1", + ) as s3_client: + driver = S3StorageDriver( + client=new_aioboto3_client(s3_client), + bucket=S3_BUCKET, + ) + storage = ExternalStorage(drivers=[driver], payload_size_threshold=256 * 1024) + yield await Client.connect( + **config, + plugins=[plugin, storage_plugin(storage)], + ) + + +# @@@SNIPEND diff --git a/deepagents_plugin/external_storage/main.py b/deepagents_plugin/external_storage/main.py new file mode 100644 index 000000000..57a7be05f --- /dev/null +++ b/deepagents_plugin/external_storage/main.py @@ -0,0 +1,71 @@ +"""Run one Deep Agent with a 6 MiB tool result and native S3 storage. + +Both the worker and starter run in this process. The two model replies are +scripted, so the demo needs no LLM credentials or provider context budget. +The model and tool still run as real Temporal activities. +""" + +import asyncio +import hashlib +import uuid + +from langchain_core.messages import AIMessage +from temporalio.contrib.deepagents import DeepAgentsPlugin +from temporalio.contrib.deepagents.testing import mock_model_provider +from temporalio.worker import Worker + +from deepagents_plugin.external_storage.client import connect_client +from deepagents_plugin.external_storage.workflow import ( + PAYLOAD_BYTES, + TASK_QUEUE, + ExternalStorageAgent, +) + + +def create_plugin() -> DeepAgentsPlugin: + """Script a tool request and acknowledgment for this single-workflow demo.""" + return DeepAgentsPlugin( + model_provider=mock_model_provider( + [ + AIMessage( + content="", + tool_calls=[ + { + "name": "read_file", + "args": {"file_path": "large-document.txt"}, + "id": "call-read", + } + ], + ), + AIMessage(content="Received the complete document."), + ] + ) + ) + + +async def main() -> None: + async with connect_client(create_plugin()) as client: + async with Worker( + client, + task_queue=TASK_QUEUE, + workflows=[ExternalStorageAgent], + max_cached_workflows=0, + ): + workflow_id = f"deepagents-external-storage-{uuid.uuid4()}" + result = await client.execute_workflow( + ExternalStorageAgent.run, + "Read large-document.txt and acknowledge receiving it.", + id=workflow_id, + task_queue=TASK_QUEUE, + ) + + assert result.result_bytes == PAYLOAD_BYTES + assert result.sha256 == hashlib.sha256(b"x" * PAYLOAD_BYTES).hexdigest() + print(f"Workflow: {workflow_id}") + print(f"Tool result: {result.result_bytes:,} bytes (6 MiB), integrity verified") + print(f"SHA-256: {result.sha256}") + print(f"Agent: {result.answer}") + + +if __name__ == "__main__": + asyncio.run(main()) diff --git a/deepagents_plugin/external_storage/workflow.py b/deepagents_plugin/external_storage/workflow.py new file mode 100644 index 000000000..2c339b81a --- /dev/null +++ b/deepagents_plugin/external_storage/workflow.py @@ -0,0 +1,75 @@ +"""A Deep Agent whose tool returns 6 MiB, carried by native External Storage.""" + +import hashlib +from dataclasses import dataclass +from datetime import timedelta + +from langchain_core.messages import ToolMessage +from langchain_core.tools import tool +from temporalio import workflow +from temporalio.common import RetryPolicy +from temporalio.contrib.deepagents import ( + create_temporal_deep_agent, + tool_as_activity, +) + +PAYLOAD_BYTES = 6 * 1024 * 1024 +MODEL = "fake:external-storage" +TASK_QUEUE = "deepagents-external-storage" + + +@dataclass +class AgentResult: + """Small integrity evidence; the large document stays out of the final result.""" + + result_bytes: int + sha256: str + answer: str + + +@tool +async def read_file(file_path: str) -> str: + """Read a mock document containing exactly 6 MiB of text.""" + # Override the built-in read_file with an activity-backed bulk reader. + # Deep Agents excludes read_file from tool-result eviction, so its complete + # content reaches the next model activity. Real file I/O would go here. + del file_path + return "x" * PAYLOAD_BYTES + + +# @@@SNIPSTART python-deepagents-external-storage-workflow +@workflow.defn +class ExternalStorageAgent: + @workflow.run + async def run(self, question: str) -> AgentResult: + reader = tool_as_activity( + read_file, + start_to_close_timeout=timedelta(seconds=30), + activity_options={"retry_policy": RetryPolicy(maximum_attempts=1)}, + ) + agent = create_temporal_deep_agent( + model=MODEL, + tools=[reader], + system_prompt="Read the document, then acknowledge receiving the result.", + activity_options={"start_to_close_timeout": timedelta(seconds=30)}, + ) + result = await agent.ainvoke( + {"messages": [{"role": "user", "content": question}]} + ) + tool_result = next( + message + for message in result["messages"] + if isinstance(message, ToolMessage) and message.name == "read_file" + ) + assert isinstance(tool_result.content, str) + data = tool_result.content.encode() + answer = result["messages"][-1].content + assert isinstance(answer, str) + return AgentResult( + result_bytes=len(data), + sha256=hashlib.sha256(data).hexdigest(), + answer=answer, + ) + + +# @@@SNIPEND diff --git a/tests/deepagents_plugin/external_storage_test.py b/tests/deepagents_plugin/external_storage_test.py new file mode 100644 index 000000000..c9aa38709 --- /dev/null +++ b/tests/deepagents_plugin/external_storage_test.py @@ -0,0 +1,125 @@ +"""Verify the sample against real Temporal activities and a local S3 service.""" + +import hashlib +import uuid +from collections.abc import Iterator +from datetime import timedelta + +import boto3 +import pytest +from moto.server import ThreadedMotoServer +from temporalio.api.enums.v1 import EventType +from temporalio.api.sdk.v1 import ExternalStorageReference +from temporalio.client import Client +from temporalio.contrib.deepagents import DeepAgentsPlugin +from temporalio.converter import DataConverter +from temporalio.worker import Replayer, Worker + +from deepagents_plugin.external_storage.client import ( + S3_BUCKET, + connect_client, + storage_plugin, +) +from deepagents_plugin.external_storage.main import create_plugin +from deepagents_plugin.external_storage.workflow import ( + PAYLOAD_BYTES, + AgentResult, + ExternalStorageAgent, +) +from tests.deepagents_plugin.helpers import ( + INVOKE_MODEL, + INVOKE_TOOL, + count_scheduled_activities, +) + + +@pytest.fixture +def s3_endpoint() -> Iterator[str]: + server = ThreadedMotoServer(ip_address="127.0.0.1", port=0, verbose=False) + server.start() + try: + host, port = server.get_host_and_port() + endpoint = f"http://{host}:{port}" + s3 = boto3.client( + "s3", + endpoint_url=endpoint, + aws_access_key_id="test", + aws_secret_access_key="test", + region_name="us-east-1", + ) + s3.create_bucket(Bucket=S3_BUCKET) + yield endpoint + finally: + server.stop() + + +async def test_external_storage(client: Client, s3_endpoint: str) -> None: + queue = f"deepagents-storage-{uuid.uuid4()}" + target_host = client.service_client.config.target_host + async with connect_client( + create_plugin(), target_host=target_host, s3_endpoint=s3_endpoint + ) as stored_client: + assert stored_client.data_converter.external_storage is not None + async with Worker( + stored_client, + task_queue=queue, + workflows=[ExternalStorageAgent], + max_cached_workflows=0, + ): + handle = await stored_client.start_workflow( + ExternalStorageAgent.run, + "Read large-document.txt and acknowledge receiving it.", + id=queue, + task_queue=queue, + execution_timeout=timedelta(seconds=60), + ) + result = await handle.result() + history = await handle.fetch_history() + + assert result == AgentResult( + result_bytes=PAYLOAD_BYTES, + sha256=hashlib.sha256(b"x" * PAYLOAD_BYTES).hexdigest(), + answer="Received the complete document.", + ) + counts = await count_scheduled_activities(handle) + assert counts[INVOKE_MODEL] == 2 + assert counts[INVOKE_TOOL] == 1 + + scheduled = { + event.event_id: event.activity_task_scheduled_event_attributes + for event in history.events + if event.event_type == EventType.EVENT_TYPE_ACTIVITY_TASK_SCHEDULED + } + tool_result = next( + event.activity_task_completed_event_attributes.result.payloads[0] + for event in history.events + if event.event_type == EventType.EVENT_TYPE_ACTIVITY_TASK_COMPLETED + and scheduled[ + event.activity_task_completed_event_attributes.scheduled_event_id + ].activity_type.name + == INVOKE_TOOL + ) + model_input = list(scheduled.values())[-1].input.payloads[0] + for payload in (tool_result, model_input): + reference = DataConverter.default.payload_converter.from_payload(payload) + assert isinstance(reference, ExternalStorageReference) + assert reference.driver_name == "aws.s3driver" + assert payload.ByteSize() < 1024 + assert "x" * 1024 not in history.to_json() + + # The original worker and S3 client are closed. Retrieve persisted claims + # through a fresh client and driver, without executing the activities again. + async with connect_client( + DeepAgentsPlugin(), target_host=target_host, s3_endpoint=s3_endpoint + ) as replay_client: + storage = replay_client.data_converter.external_storage + assert storage is not None + await Replayer( + workflows=[ExternalStorageAgent], + data_converter=replay_client.data_converter, + plugins=[ + DeepAgentsPlugin(), + # Preserve storage after the older plugin's converter override. + storage_plugin(storage), + ], + ).replay_workflow(history) From d9ef09fcdeb04d3dd7dd8ac1c5ca50c37bd38898 Mon Sep 17 00:00:00 2001 From: Brian Strauch Date: Thu, 8 Oct 2026 22:07:19 -0700 Subject: [PATCH 03/13] Use standalone Deep Agents plugin for external storage --- deepagents_plugin/README.md | 4 +-- deepagents_plugin/external_storage/README.md | 36 ++++++------------- deepagents_plugin/external_storage/client.py | 20 +++-------- deepagents_plugin/external_storage/main.py | 4 +-- .../external_storage/workflow.py | 2 +- .../external_storage_test.py | 11 ++---- 6 files changed, 22 insertions(+), 55 deletions(-) diff --git a/deepagents_plugin/README.md b/deepagents_plugin/README.md index d5fb90296..688eaee44 100644 --- a/deepagents_plugin/README.md +++ b/deepagents_plugin/README.md @@ -114,8 +114,8 @@ uv run deepagents_plugin/external_storage/main.py - **Streaming** — forward model chunks to external subscribers while keeping the durable result unchanged. - **Observability** — compose with `LangSmithPlugin` for tracing. -- **Large payload storage** — compose native `ExternalStorage` with the plugin's - data converter, keeping full tool results in S3 and small references in history. +- **Large payload storage** — configure native `ExternalStorage` on the client's + data converter; the standalone plugin composes it with its LangChain converter. ## Related diff --git a/deepagents_plugin/external_storage/README.md b/deepagents_plugin/external_storage/README.md index 3fe8af72c..a4cca7611 100644 --- a/deepagents_plugin/external_storage/README.md +++ b/deepagents_plugin/external_storage/README.md @@ -66,28 +66,13 @@ through, so it can also read this sample's references. ## How the configuration works -`client.py` creates `ExternalStorage(drivers=[driver], -payload_size_threshold=256 * 1024)`. It uses the SDK's `SimplePlugin` converter -hook to apply this configuration **after** `DeepAgentsPlugin` installs its -LangChain-aware payload converter: - -```python -def configure(converter: DataConverter | None) -> DataConverter: - return replace(converter or DataConverter.default, external_storage=storage) - -client = await Client.connect( - "localhost:7233", - plugins=[ - create_plugin(), - SimplePlugin("ExternalStorage", data_converter=configure), - ], -) -``` - -This order also supports the older plugin version in this repository's lockfile, -which otherwise replaces the client's converter. The worker inherits the final -converter. The S3 client stays open while the worker runs and the starter decodes -results. No application code uploads or downloads payloads manually. +`client.py` opens an S3 client, creates an SDK `S3StorageDriver`, and passes a +`DataConverter` with `ExternalStorage` directly to `Client.connect`. The standalone +`temporalio-deepagents` plugin composes its LangChain payload converter with that +converter, preserving the storage configuration. The worker uses the client's +converter, and the sample keeps the S3 client open while the worker runs and the +starter decodes results. No application code uploads or downloads payloads +manually. This demo deliberately uses **no compression codec**: repeated `x` characters would compress well below the storage threshold. It overrides the built-in @@ -105,15 +90,14 @@ Native storage avoids transmitting the large bytes through either limit. For real S3, use an existing bucket and normal AWS credentials instead of this sample's local endpoint and mock credentials. Configure compatible storage drivers on every client, worker, and replayer that reads the history. Retain -objects for as long as execution, reset, or replay may need them; Temporal does -not delete stored payloads when an activity finishes. +objects for as long as execution, reset, or replay may need them; Temporal does not delete stored payloads when an activity finishes. ## Tests The integration test starts an isolated mock S3 service and verifies the full result, both native references, activity routing, and replay with a new S3 -client after worker shutdown. -No manually running S3 service or model credentials are required: +client after worker shutdown. No manually running S3 service or model credentials +are required: ```bash uv sync --python 3.13 --group deepagents --group external-storage --group dev diff --git a/deepagents_plugin/external_storage/client.py b/deepagents_plugin/external_storage/client.py index 92fdca481..4cbb8ab87 100644 --- a/deepagents_plugin/external_storage/client.py +++ b/deepagents_plugin/external_storage/client.py @@ -1,4 +1,4 @@ -"""Compose native S3 storage with the Deep Agents data converter.""" +"""Configure native S3 storage for the Deep Agents client.""" from collections.abc import AsyncIterator from contextlib import asynccontextmanager @@ -8,27 +8,15 @@ from temporalio.client import Client from temporalio.contrib.aws.s3driver import S3StorageDriver from temporalio.contrib.aws.s3driver.aioboto3 import new_aioboto3_client -from temporalio.contrib.deepagents import DeepAgentsPlugin from temporalio.converter import DataConverter, ExternalStorage from temporalio.envconfig import ClientConfig -from temporalio.plugin import SimplePlugin +from temporalio.deepagents import DeepAgentsPlugin S3_ENDPOINT = "http://localhost:5000" S3_BUCKET = "temporal-payloads" # @@@SNIPSTART python-deepagents-external-storage-converter -def storage_plugin(storage: ExternalStorage) -> SimplePlugin: - """Add storage after the agent plugin has installed its payload converter.""" - - def configure(converter: DataConverter | None) -> DataConverter: - return replace(converter or DataConverter.default, external_storage=storage) - - # Applying this after DeepAgentsPlugin also supports older plugin versions - # that replace the converter rather than composing with the client's one. - return SimplePlugin("ExternalStorage", data_converter=configure) - - @asynccontextmanager async def connect_client( plugin: DeepAgentsPlugin, @@ -55,9 +43,11 @@ async def connect_client( bucket=S3_BUCKET, ) storage = ExternalStorage(drivers=[driver], payload_size_threshold=256 * 1024) + converter = replace(DataConverter.default, external_storage=storage) yield await Client.connect( **config, - plugins=[plugin, storage_plugin(storage)], + data_converter=converter, + plugins=[plugin], ) diff --git a/deepagents_plugin/external_storage/main.py b/deepagents_plugin/external_storage/main.py index 57a7be05f..e0bc3f229 100644 --- a/deepagents_plugin/external_storage/main.py +++ b/deepagents_plugin/external_storage/main.py @@ -10,8 +10,8 @@ import uuid from langchain_core.messages import AIMessage -from temporalio.contrib.deepagents import DeepAgentsPlugin -from temporalio.contrib.deepagents.testing import mock_model_provider +from temporalio.deepagents import DeepAgentsPlugin +from temporalio.deepagents.testing import mock_model_provider from temporalio.worker import Worker from deepagents_plugin.external_storage.client import connect_client diff --git a/deepagents_plugin/external_storage/workflow.py b/deepagents_plugin/external_storage/workflow.py index 2c339b81a..49842b3bc 100644 --- a/deepagents_plugin/external_storage/workflow.py +++ b/deepagents_plugin/external_storage/workflow.py @@ -8,7 +8,7 @@ from langchain_core.tools import tool from temporalio import workflow from temporalio.common import RetryPolicy -from temporalio.contrib.deepagents import ( +from temporalio.deepagents import ( create_temporal_deep_agent, tool_as_activity, ) diff --git a/tests/deepagents_plugin/external_storage_test.py b/tests/deepagents_plugin/external_storage_test.py index c9aa38709..4d28dbdfa 100644 --- a/tests/deepagents_plugin/external_storage_test.py +++ b/tests/deepagents_plugin/external_storage_test.py @@ -11,14 +11,13 @@ from temporalio.api.enums.v1 import EventType from temporalio.api.sdk.v1 import ExternalStorageReference from temporalio.client import Client -from temporalio.contrib.deepagents import DeepAgentsPlugin +from temporalio.deepagents import DeepAgentsPlugin from temporalio.converter import DataConverter from temporalio.worker import Replayer, Worker from deepagents_plugin.external_storage.client import ( S3_BUCKET, connect_client, - storage_plugin, ) from deepagents_plugin.external_storage.main import create_plugin from deepagents_plugin.external_storage.workflow import ( @@ -112,14 +111,8 @@ async def test_external_storage(client: Client, s3_endpoint: str) -> None: async with connect_client( DeepAgentsPlugin(), target_host=target_host, s3_endpoint=s3_endpoint ) as replay_client: - storage = replay_client.data_converter.external_storage - assert storage is not None await Replayer( workflows=[ExternalStorageAgent], data_converter=replay_client.data_converter, - plugins=[ - DeepAgentsPlugin(), - # Preserve storage after the older plugin's converter override. - storage_plugin(storage), - ], + plugins=[DeepAgentsPlugin()], ).replay_workflow(history) From f8b152c13e697049400d1f73952330c346072416 Mon Sep 17 00:00:00 2001 From: Brian Strauch Date: Thu, 8 Oct 2026 22:10:46 -0700 Subject: [PATCH 04/13] Fix import ordering for sample CI --- deepagents_plugin/external_storage/client.py | 2 +- tests/deepagents_plugin/external_storage_test.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/deepagents_plugin/external_storage/client.py b/deepagents_plugin/external_storage/client.py index 4cbb8ab87..feb54d894 100644 --- a/deepagents_plugin/external_storage/client.py +++ b/deepagents_plugin/external_storage/client.py @@ -9,8 +9,8 @@ from temporalio.contrib.aws.s3driver import S3StorageDriver from temporalio.contrib.aws.s3driver.aioboto3 import new_aioboto3_client from temporalio.converter import DataConverter, ExternalStorage -from temporalio.envconfig import ClientConfig from temporalio.deepagents import DeepAgentsPlugin +from temporalio.envconfig import ClientConfig S3_ENDPOINT = "http://localhost:5000" S3_BUCKET = "temporal-payloads" diff --git a/tests/deepagents_plugin/external_storage_test.py b/tests/deepagents_plugin/external_storage_test.py index 4d28dbdfa..a56d84e4a 100644 --- a/tests/deepagents_plugin/external_storage_test.py +++ b/tests/deepagents_plugin/external_storage_test.py @@ -11,8 +11,8 @@ from temporalio.api.enums.v1 import EventType from temporalio.api.sdk.v1 import ExternalStorageReference from temporalio.client import Client -from temporalio.deepagents import DeepAgentsPlugin from temporalio.converter import DataConverter +from temporalio.deepagents import DeepAgentsPlugin from temporalio.worker import Replayer, Worker from deepagents_plugin.external_storage.client import ( From 581b1c372d90ee4a6eaf12387ea8a47129d4aeb2 Mon Sep 17 00:00:00 2001 From: Brian Strauch Date: Fri, 9 Oct 2026 10:06:06 -0700 Subject: [PATCH 05/13] Rename Deep Agents external storage samples --- deepagents_plugin/README.md | 13 +- .../external_conversation_storage/README.md | 59 +++++++ .../external_conversation_storage/client.py | 52 ++++++ .../external_conversation_storage/main.py | 70 ++++++++ .../external_conversation_storage/workflow.py | 159 ++++++++++++++++++ .../README.md | 35 ++-- .../client.py | 14 +- .../main.py | 4 +- .../workflow.py | 4 - ...st.py => external_payload_storage_test.py} | 13 +- 10 files changed, 386 insertions(+), 37 deletions(-) create mode 100644 deepagents_plugin/external_conversation_storage/README.md create mode 100644 deepagents_plugin/external_conversation_storage/client.py create mode 100644 deepagents_plugin/external_conversation_storage/main.py create mode 100644 deepagents_plugin/external_conversation_storage/workflow.py rename deepagents_plugin/{external_storage => external_payload_storage}/README.md (81%) rename deepagents_plugin/{external_storage => external_payload_storage}/client.py (85%) rename deepagents_plugin/{external_storage => external_payload_storage}/main.py (94%) rename deepagents_plugin/{external_storage => external_payload_storage}/workflow.py (96%) rename tests/deepagents_plugin/{external_storage_test.py => external_payload_storage_test.py} (91%) diff --git a/deepagents_plugin/README.md b/deepagents_plugin/README.md index 688eaee44..e4ffd3aa5 100644 --- a/deepagents_plugin/README.md +++ b/deepagents_plugin/README.md @@ -26,7 +26,8 @@ one side. | [subagents](subagents) | Durability propagates across the agent tree — sub-agent model calls become activities with no per-sub-agent wiring. | | [streaming](streaming) | Stream model chunks to external subscribers via `streaming_topic` + `WorkflowStream`, keeping the durable result identical. | | [langsmith_tracing](langsmith_tracing) | Compose `DeepAgentsPlugin` with `LangSmithPlugin` for durable execution + LLM tracing. | -| [external_storage](external_storage) | Carry a 6 MiB tool result and the next model input through native S3 External Storage; scripted model, no API keys. | +| [external_payload_storage](external_payload_storage) | Carry a 6 MiB tool result and the next model input through native S3 External Storage; scripted model, no API keys. | +| [external_conversation_storage](external_conversation_storage) | Store each exchange in S3 and include the full conversation history in each model call; native External Storage also protects large Temporal payloads. | ## Prerequisites @@ -48,7 +49,7 @@ one side. 2. Configure a model provider. Most samples use `anthropic:claude-sonnet-4-5`, which needs an Anthropic API key. The - [external_storage](external_storage) sample uses a scripted model and needs + [external_payload_storage](external_payload_storage) sample uses a scripted model and needs no provider credentials: ```bash @@ -88,13 +89,15 @@ uv run deepagents_plugin/hello_world/run_worker.py uv run deepagents_plugin/hello_world/run_workflow.py ``` -The `langsmith_tracing` and `external_storage` samples instead bundle the worker +The `langsmith_tracing`, `external_payload_storage`, and +`external_conversation_storage` samples instead bundle the worker and starter into a single driver. The storage sample also needs a mock S3 service; -see its [setup instructions](external_storage): +see their [setup instructions](../external_storage): ```bash uv run deepagents_plugin/langsmith_tracing/main.py -uv run deepagents_plugin/external_storage/main.py +uv run deepagents_plugin/external_payload_storage/main.py +uv run deepagents_plugin/external_conversation_storage/main.py ``` ## Key Features Demonstrated diff --git a/deepagents_plugin/external_conversation_storage/README.md b/deepagents_plugin/external_conversation_storage/README.md new file mode 100644 index 000000000..6ee10c204 --- /dev/null +++ b/deepagents_plugin/external_conversation_storage/README.md @@ -0,0 +1,59 @@ +# External Storage and Conversation History + +This companion demonstrates the same native S3 payload configuration pattern as +[external_payload_storage](../external_payload_storage), but has its own client +setup and can be run independently. It runs a four-turn conversation. It writes +each user/assistant exchange to a separate S3 object, then loads every previous +exchange for each model call. The full transcript is available to the agent +throughout the conversation. + +The S3 transcript is application-managed conversation memory. Temporal's native +`ExternalStorage` is configured too, so large workflow and activity payloads can +be stored as S3 references in Temporal history. These solve different problems: +the transcript design makes the full history available to the model, while +native External Storage bounds payload bytes in Temporal history and transport. +The scripted run uses small prompts, so it does not need to cross the native +storage threshold. The full-history approach increases model input size on every +turn; total tokens across a long conversation can grow roughly quadratically. + +External storage preserves and retrieves the transcript; it does not reduce +model tokens. For long conversations, a summary or selective retrieval strategy +can keep the model context smaller while still drawing on older turns. + +## Run it + +Use Python 3.11 or later. Install dependencies: + +```bash +uv sync --python 3.13 --group deepagents --group external-storage +``` + +Start the Temporal dev server in one terminal: + +```bash +temporal server start-dev +``` + +Start the repository's mock S3 service in another terminal: + +```bash +uv run external_storage/s3.py +``` + +Then run the sample: + +```bash +uv run deepagents_plugin/external_conversation_storage/main.py +``` + +It uses a scripted model and needs no provider API key. Each turn's full exchange +is stored under a workflow-specific S3 prefix. The final turn demonstrates that +the complete history carries earlier project details into the answer. + +The sample uses the same `temporal-payloads` bucket and local mock S3 service as +the [large-payload sample](../external_payload_storage), but shares no code with +it. +For production, use durable storage with access controls and retention +appropriate for conversation data. +Keep the storage driver configured on clients, workers, and replayers that need +to decode native Temporal payload references. diff --git a/deepagents_plugin/external_conversation_storage/client.py b/deepagents_plugin/external_conversation_storage/client.py new file mode 100644 index 000000000..44201aabd --- /dev/null +++ b/deepagents_plugin/external_conversation_storage/client.py @@ -0,0 +1,52 @@ +"""Connect a Deep Agents client with Temporal native S3 External Storage.""" + +from collections.abc import AsyncIterator +from contextlib import asynccontextmanager +from dataclasses import replace + +import aioboto3 +from temporalio.client import Client +from temporalio.contrib.aws.s3driver import S3StorageDriver +from temporalio.contrib.aws.s3driver.aioboto3 import new_aioboto3_client +from temporalio.deepagents import DeepAgentsPlugin +from temporalio.converter import DataConverter, ExternalStorage +from temporalio.envconfig import ClientConfig + +S3_ENDPOINT = "http://localhost:5000" +S3_BUCKET = "temporal-payloads" + + +@asynccontextmanager +async def connect_client( + plugin: DeepAgentsPlugin, + *, + target_host: str | None = None, + s3_endpoint: str = S3_ENDPOINT, +) -> AsyncIterator[Client]: + """Keep the S3 client alive while Temporal reads and writes payloads.""" + config = ClientConfig.load_client_connect_config() + config.setdefault("target_host", "localhost:7233") + if target_host is not None: + config["target_host"] = target_host + + session = aioboto3.Session() + async with session.client( + "s3", + endpoint_url=s3_endpoint, + aws_access_key_id="test", + aws_secret_access_key="test", + region_name="us-east-1", + ) as s3_client: + driver = S3StorageDriver( + client=new_aioboto3_client(s3_client), + bucket=S3_BUCKET, + ) + storage = ExternalStorage(drivers=[driver], payload_size_threshold=256 * 1024) + plugin.data_converter = replace( + plugin.data_converter or DataConverter.default, + external_storage=storage, + ) + yield await Client.connect( + **config, + plugins=[plugin], + ) diff --git a/deepagents_plugin/external_conversation_storage/main.py b/deepagents_plugin/external_conversation_storage/main.py new file mode 100644 index 000000000..448d7b162 --- /dev/null +++ b/deepagents_plugin/external_conversation_storage/main.py @@ -0,0 +1,70 @@ +"""Run a multi-turn agent that supplies its full transcript to the model.""" + +import asyncio +import uuid + +from langchain_core.messages import AIMessage +from temporalio.deepagents import DeepAgentsPlugin +from temporalio.deepagents.testing import mock_model_provider +from temporalio.worker import Worker + +from deepagents_plugin.external_conversation_storage.client import connect_client +from deepagents_plugin.external_conversation_storage.workflow import ( + TASK_QUEUE, + StoredConversationAgent, + load_conversation_history, + save_turn, +) + + +def create_plugin() -> DeepAgentsPlugin: + """Script replies so the sample runs without an LLM provider or API key.""" + return DeepAgentsPlugin( + model_provider=mock_model_provider( + [ + AIMessage(content="The project name is Cedar."), + AIMessage(content="The project is called Cedar and uses Python."), + AIMessage(content="Cedar uses Python and is due Friday."), + AIMessage(content="Cedar is a Python project due Friday."), + ] + ) + ) + + +async def main() -> None: + user_turns = [ + "I am working on a project called Cedar.", + "The project uses Python.", + "It is due Friday.", + "Remind me of the project name, language, and deadline.", + ] + async with connect_client(create_plugin()) as client: + async with Worker( + client, + task_queue=TASK_QUEUE, + workflows=[StoredConversationAgent], + activities=[load_conversation_history, save_turn], + max_cached_workflows=0, + ): + workflow_id = f"deepagents-conversation-{uuid.uuid4()}" + handle = await client.start_workflow( + StoredConversationAgent.run, + id=workflow_id, + task_queue=TASK_QUEUE, + ) + for question in user_turns: + await handle.signal(StoredConversationAgent.submit_turn, question) + await handle.signal(StoredConversationAgent.finish) + result = await handle.result() + + print(f"Workflow: {workflow_id}") + print(f"Turns processed: {result.turns}") + print(f"First-turn prompt context: {result.first_context_chars:,} characters") + print(f"Last-turn prompt context: {result.last_context_chars:,} characters") + print(f"Final answer: {result.last_answer}") + print(f"Full transcript stored externally: {result.transcript_turns} turns") + print("Each model call included the complete conversation history.") + + +if __name__ == "__main__": + asyncio.run(main()) diff --git a/deepagents_plugin/external_conversation_storage/workflow.py b/deepagents_plugin/external_conversation_storage/workflow.py new file mode 100644 index 000000000..79ccc81fe --- /dev/null +++ b/deepagents_plugin/external_conversation_storage/workflow.py @@ -0,0 +1,159 @@ +"""A multi-turn agent that loads its full S3 transcript on each turn.""" + +from dataclasses import dataclass +from datetime import timedelta + +from temporalio import activity, workflow +from temporalio.common import RetryPolicy +from temporalio.deepagents import create_temporal_deep_agent + +MODEL = "fake:external-conversation-storage" +TASK_QUEUE = "deepagents-external-conversation-storage" +S3_BUCKET = "temporal-payloads" + + +@dataclass +class Turn: + user: str + assistant: str + + +@dataclass +class ConversationResult: + last_answer: str + turns: int + first_context_chars: int + last_context_chars: int + transcript_turns: int + + +def _conversation_prefix(workflow_id: str) -> str: + """Keep user-provided workflow IDs out of S3 key syntax.""" + import hashlib + + return f"conversation-memory/{hashlib.sha256(workflow_id.encode()).hexdigest()}/" + + +@activity.defn +async def load_conversation_history(workflow_id: str, turn_index: int) -> list[Turn]: + """Read every earlier exchange from the external transcript.""" + import aioboto3 + + session = aioboto3.Session() + async with session.client( + "s3", + endpoint_url="http://localhost:5000", + aws_access_key_id="test", + aws_secret_access_key="test", + region_name="us-east-1", + ) as client: + turns = [] + prefix = _conversation_prefix(workflow_id) + for index in range(turn_index): + response = await client.get_object( + Bucket=S3_BUCKET, Key=f"{prefix}turn-{index:08d}.json" + ) + import json + + turns.append(Turn(**json.loads(await response["Body"].read()))) + return turns + + +@activity.defn +async def save_turn(workflow_id: str, turn_index: int, turn: Turn) -> None: + """Append one exchange as its own immutable S3 object.""" + import aioboto3 + import json + from dataclasses import asdict + + session = aioboto3.Session() + async with session.client( + "s3", + endpoint_url="http://localhost:5000", + aws_access_key_id="test", + aws_secret_access_key="test", + region_name="us-east-1", + ) as client: + await client.put_object( + Bucket=S3_BUCKET, + Key=f"{_conversation_prefix(workflow_id)}turn-{turn_index:08d}.json", + Body=json.dumps(asdict(turn)).encode(), + ContentType="application/json", + ) + + +@workflow.defn +class StoredConversationAgent: + def __init__(self) -> None: + self.pending_turns: list[str] = [] + self.finished = False + + @workflow.signal + def submit_turn(self, question: str) -> None: + self.pending_turns.append(question) + + @workflow.signal + def finish(self) -> None: + self.finished = True + + @workflow.run + async def run(self) -> ConversationResult: + workflow_id = workflow.info().workflow_id + turn_count = 0 + first_context_chars = 0 + last_context_chars = 0 + last_answer = "" + + while True: + await workflow.wait_condition(lambda: self.pending_turns or self.finished) + if not self.pending_turns: + break + question = self.pending_turns.pop(0) + turn_index = turn_count + history = await workflow.execute_activity( + load_conversation_history, + args=[workflow_id, turn_index], + start_to_close_timeout=timedelta(seconds=30), + retry_policy=RetryPolicy(maximum_attempts=1), + ) + memory = "\n".join( + f"User: {turn.user}\nAssistant: {turn.assistant}" + for turn in history + ) + system_prompt = ( + "Answer the user's latest message. Use the full conversation " + "when relevant. This is the complete conversation so far.\n\n" + "Conversation history:\n" + f"{memory or '(no earlier turns)'}" + ) + # A fresh agent invocation receives the complete prior transcript + # and current prompt; prior turns are not carried in graph state. + agent = create_temporal_deep_agent( + model=MODEL, + system_prompt=system_prompt, + activity_options={"start_to_close_timeout": timedelta(seconds=30)}, + ) + context_chars = len(system_prompt) + len(question) + if turn_count == 0: + first_context_chars = context_chars + result = await agent.ainvoke({"messages": [{"role": "user", "content": question}]}) + answer = result["messages"][-1].content + if not isinstance(answer, str): + raise TypeError("Expected a text response from the model") + last_answer = answer + last_context_chars = context_chars + await workflow.execute_activity( + save_turn, + args=[workflow_id, turn_index, Turn(user=question, assistant=answer)], + start_to_close_timeout=timedelta(seconds=30), + retry_policy=RetryPolicy(maximum_attempts=1), + ) + turn_count += 1 + + return ConversationResult( + last_answer=last_answer, + turns=turn_count, + first_context_chars=first_context_chars, + last_context_chars=last_context_chars, + transcript_turns=turn_count, + ) diff --git a/deepagents_plugin/external_storage/README.md b/deepagents_plugin/external_payload_storage/README.md similarity index 81% rename from deepagents_plugin/external_storage/README.md rename to deepagents_plugin/external_payload_storage/README.md index a4cca7611..6105768bb 100644 --- a/deepagents_plugin/external_storage/README.md +++ b/deepagents_plugin/external_payload_storage/README.md @@ -37,7 +37,7 @@ In a third terminal, run the demo. It starts a worker, executes one workflow, checks the result's integrity, and shuts down the worker: ```bash -uv run deepagents_plugin/external_storage/main.py +uv run deepagents_plugin/external_payload_storage/main.py ``` The output includes: @@ -66,13 +66,23 @@ through, so it can also read this sample's references. ## How the configuration works -`client.py` opens an S3 client, creates an SDK `S3StorageDriver`, and passes a -`DataConverter` with `ExternalStorage` directly to `Client.connect`. The standalone -`temporalio-deepagents` plugin composes its LangChain payload converter with that -converter, preserving the storage configuration. The worker uses the client's -converter, and the sample keeps the S3 client open while the worker runs and the -starter decodes results. No application code uploads or downloads payloads -manually. +`client.py` creates `ExternalStorage(drivers=[driver], +payload_size_threshold=256 * 1024)` and adds it to the LangChain-aware converter +provided by `DeepAgentsPlugin`: + +```python +plugin = create_plugin() +plugin.data_converter = replace(plugin.data_converter, external_storage=storage) + +client = await Client.connect( + "localhost:7233", + plugins=[plugin], +) +``` + +The worker inherits the configured converter. The S3 client stays open while +the worker runs and the starter decodes results. No application code uploads or +downloads Temporal payloads manually. This demo deliberately uses **no compression codec**: repeated `x` characters would compress well below the storage threshold. It overrides the built-in @@ -90,16 +100,17 @@ Native storage avoids transmitting the large bytes through either limit. For real S3, use an existing bucket and normal AWS credentials instead of this sample's local endpoint and mock credentials. Configure compatible storage drivers on every client, worker, and replayer that reads the history. Retain -objects for as long as execution, reset, or replay may need them; Temporal does not delete stored payloads when an activity finishes. +objects for as long as execution, reset, or replay may need them; Temporal does +not delete stored payloads when an activity finishes. ## Tests The integration test starts an isolated mock S3 service and verifies the full result, both native references, activity routing, and replay with a new S3 -client after worker shutdown. No manually running S3 service or model credentials -are required: +client after worker shutdown. +No manually running S3 service or model credentials are required: ```bash uv sync --python 3.13 --group deepagents --group external-storage --group dev -uv run pytest tests/deepagents_plugin/external_storage_test.py +uv run pytest tests/deepagents_plugin/external_payload_storage_test.py ``` diff --git a/deepagents_plugin/external_storage/client.py b/deepagents_plugin/external_payload_storage/client.py similarity index 85% rename from deepagents_plugin/external_storage/client.py rename to deepagents_plugin/external_payload_storage/client.py index feb54d894..df667d0d8 100644 --- a/deepagents_plugin/external_storage/client.py +++ b/deepagents_plugin/external_payload_storage/client.py @@ -1,4 +1,4 @@ -"""Configure native S3 storage for the Deep Agents client.""" +"""Compose native S3 storage with the Deep Agents data converter.""" from collections.abc import AsyncIterator from contextlib import asynccontextmanager @@ -8,15 +8,14 @@ from temporalio.client import Client from temporalio.contrib.aws.s3driver import S3StorageDriver from temporalio.contrib.aws.s3driver.aioboto3 import new_aioboto3_client -from temporalio.converter import DataConverter, ExternalStorage from temporalio.deepagents import DeepAgentsPlugin +from temporalio.converter import DataConverter, ExternalStorage from temporalio.envconfig import ClientConfig S3_ENDPOINT = "http://localhost:5000" S3_BUCKET = "temporal-payloads" -# @@@SNIPSTART python-deepagents-external-storage-converter @asynccontextmanager async def connect_client( plugin: DeepAgentsPlugin, @@ -43,12 +42,11 @@ async def connect_client( bucket=S3_BUCKET, ) storage = ExternalStorage(drivers=[driver], payload_size_threshold=256 * 1024) - converter = replace(DataConverter.default, external_storage=storage) + plugin.data_converter = replace( + plugin.data_converter or DataConverter.default, + external_storage=storage, + ) yield await Client.connect( **config, - data_converter=converter, plugins=[plugin], ) - - -# @@@SNIPEND diff --git a/deepagents_plugin/external_storage/main.py b/deepagents_plugin/external_payload_storage/main.py similarity index 94% rename from deepagents_plugin/external_storage/main.py rename to deepagents_plugin/external_payload_storage/main.py index e0bc3f229..fb520aca0 100644 --- a/deepagents_plugin/external_storage/main.py +++ b/deepagents_plugin/external_payload_storage/main.py @@ -14,8 +14,8 @@ from temporalio.deepagents.testing import mock_model_provider from temporalio.worker import Worker -from deepagents_plugin.external_storage.client import connect_client -from deepagents_plugin.external_storage.workflow import ( +from deepagents_plugin.external_payload_storage.client import connect_client +from deepagents_plugin.external_payload_storage.workflow import ( PAYLOAD_BYTES, TASK_QUEUE, ExternalStorageAgent, diff --git a/deepagents_plugin/external_storage/workflow.py b/deepagents_plugin/external_payload_storage/workflow.py similarity index 96% rename from deepagents_plugin/external_storage/workflow.py rename to deepagents_plugin/external_payload_storage/workflow.py index 49842b3bc..1e4a2e35a 100644 --- a/deepagents_plugin/external_storage/workflow.py +++ b/deepagents_plugin/external_payload_storage/workflow.py @@ -37,7 +37,6 @@ async def read_file(file_path: str) -> str: return "x" * PAYLOAD_BYTES -# @@@SNIPSTART python-deepagents-external-storage-workflow @workflow.defn class ExternalStorageAgent: @workflow.run @@ -70,6 +69,3 @@ async def run(self, question: str) -> AgentResult: sha256=hashlib.sha256(data).hexdigest(), answer=answer, ) - - -# @@@SNIPEND diff --git a/tests/deepagents_plugin/external_storage_test.py b/tests/deepagents_plugin/external_payload_storage_test.py similarity index 91% rename from tests/deepagents_plugin/external_storage_test.py rename to tests/deepagents_plugin/external_payload_storage_test.py index a56d84e4a..f4157a7d7 100644 --- a/tests/deepagents_plugin/external_storage_test.py +++ b/tests/deepagents_plugin/external_payload_storage_test.py @@ -11,16 +11,16 @@ from temporalio.api.enums.v1 import EventType from temporalio.api.sdk.v1 import ExternalStorageReference from temporalio.client import Client -from temporalio.converter import DataConverter from temporalio.deepagents import DeepAgentsPlugin +from temporalio.converter import DataConverter from temporalio.worker import Replayer, Worker -from deepagents_plugin.external_storage.client import ( +from deepagents_plugin.external_payload_storage.client import ( S3_BUCKET, connect_client, ) -from deepagents_plugin.external_storage.main import create_plugin -from deepagents_plugin.external_storage.workflow import ( +from deepagents_plugin.external_payload_storage.main import create_plugin +from deepagents_plugin.external_payload_storage.workflow import ( PAYLOAD_BYTES, AgentResult, ExternalStorageAgent, @@ -108,11 +108,12 @@ async def test_external_storage(client: Client, s3_endpoint: str) -> None: # The original worker and S3 client are closed. Retrieve persisted claims # through a fresh client and driver, without executing the activities again. + replay_plugin = DeepAgentsPlugin() async with connect_client( - DeepAgentsPlugin(), target_host=target_host, s3_endpoint=s3_endpoint + replay_plugin, target_host=target_host, s3_endpoint=s3_endpoint ) as replay_client: await Replayer( workflows=[ExternalStorageAgent], data_converter=replay_client.data_converter, - plugins=[DeepAgentsPlugin()], + plugins=[replay_plugin], ).replay_workflow(history) From 5970487261c6eb5dd0424d8b788a346b5305e256 Mon Sep 17 00:00:00 2001 From: Brian Strauch Date: Fri, 9 Oct 2026 10:08:48 -0700 Subject: [PATCH 06/13] Fix Deep Agents external storage lint --- .../external_conversation_storage/client.py | 2 +- .../external_conversation_storage/workflow.py | 14 +++++++++----- .../external_payload_storage/client.py | 2 +- .../external_payload_storage_test.py | 2 +- 4 files changed, 12 insertions(+), 8 deletions(-) diff --git a/deepagents_plugin/external_conversation_storage/client.py b/deepagents_plugin/external_conversation_storage/client.py index 44201aabd..91d9e1d37 100644 --- a/deepagents_plugin/external_conversation_storage/client.py +++ b/deepagents_plugin/external_conversation_storage/client.py @@ -8,8 +8,8 @@ from temporalio.client import Client from temporalio.contrib.aws.s3driver import S3StorageDriver from temporalio.contrib.aws.s3driver.aioboto3 import new_aioboto3_client -from temporalio.deepagents import DeepAgentsPlugin from temporalio.converter import DataConverter, ExternalStorage +from temporalio.deepagents import DeepAgentsPlugin from temporalio.envconfig import ClientConfig S3_ENDPOINT = "http://localhost:5000" diff --git a/deepagents_plugin/external_conversation_storage/workflow.py b/deepagents_plugin/external_conversation_storage/workflow.py index 79ccc81fe..ea6a9e067 100644 --- a/deepagents_plugin/external_conversation_storage/workflow.py +++ b/deepagents_plugin/external_conversation_storage/workflow.py @@ -62,10 +62,11 @@ async def load_conversation_history(workflow_id: str, turn_index: int) -> list[T @activity.defn async def save_turn(workflow_id: str, turn_index: int, turn: Turn) -> None: """Append one exchange as its own immutable S3 object.""" - import aioboto3 import json from dataclasses import asdict + import aioboto3 + session = aioboto3.Session() async with session.client( "s3", @@ -105,7 +106,9 @@ async def run(self) -> ConversationResult: last_answer = "" while True: - await workflow.wait_condition(lambda: self.pending_turns or self.finished) + await workflow.wait_condition( + lambda: bool(self.pending_turns) or self.finished + ) if not self.pending_turns: break question = self.pending_turns.pop(0) @@ -117,8 +120,7 @@ async def run(self) -> ConversationResult: retry_policy=RetryPolicy(maximum_attempts=1), ) memory = "\n".join( - f"User: {turn.user}\nAssistant: {turn.assistant}" - for turn in history + f"User: {turn.user}\nAssistant: {turn.assistant}" for turn in history ) system_prompt = ( "Answer the user's latest message. Use the full conversation " @@ -136,7 +138,9 @@ async def run(self) -> ConversationResult: context_chars = len(system_prompt) + len(question) if turn_count == 0: first_context_chars = context_chars - result = await agent.ainvoke({"messages": [{"role": "user", "content": question}]}) + result = await agent.ainvoke( + {"messages": [{"role": "user", "content": question}]} + ) answer = result["messages"][-1].content if not isinstance(answer, str): raise TypeError("Expected a text response from the model") diff --git a/deepagents_plugin/external_payload_storage/client.py b/deepagents_plugin/external_payload_storage/client.py index df667d0d8..26daaa645 100644 --- a/deepagents_plugin/external_payload_storage/client.py +++ b/deepagents_plugin/external_payload_storage/client.py @@ -8,8 +8,8 @@ from temporalio.client import Client from temporalio.contrib.aws.s3driver import S3StorageDriver from temporalio.contrib.aws.s3driver.aioboto3 import new_aioboto3_client -from temporalio.deepagents import DeepAgentsPlugin from temporalio.converter import DataConverter, ExternalStorage +from temporalio.deepagents import DeepAgentsPlugin from temporalio.envconfig import ClientConfig S3_ENDPOINT = "http://localhost:5000" diff --git a/tests/deepagents_plugin/external_payload_storage_test.py b/tests/deepagents_plugin/external_payload_storage_test.py index f4157a7d7..6305ec455 100644 --- a/tests/deepagents_plugin/external_payload_storage_test.py +++ b/tests/deepagents_plugin/external_payload_storage_test.py @@ -11,8 +11,8 @@ from temporalio.api.enums.v1 import EventType from temporalio.api.sdk.v1 import ExternalStorageReference from temporalio.client import Client -from temporalio.deepagents import DeepAgentsPlugin from temporalio.converter import DataConverter +from temporalio.deepagents import DeepAgentsPlugin from temporalio.worker import Replayer, Worker from deepagents_plugin.external_payload_storage.client import ( From 64f9a7643b92e0d2aa0d3293310f977397f30652 Mon Sep 17 00:00:00 2001 From: Brian Strauch Date: Fri, 9 Oct 2026 10:17:00 -0700 Subject: [PATCH 07/13] Pass S3 converter into Deep Agents plugin --- .../external_conversation_storage/client.py | 10 ++++------ .../external_conversation_storage/main.py | 8 +++++--- deepagents_plugin/external_payload_storage/README.md | 12 ++++++++---- deepagents_plugin/external_payload_storage/client.py | 10 ++++------ deepagents_plugin/external_payload_storage/main.py | 8 +++++--- .../external_payload_storage_test.py | 6 ++++-- 6 files changed, 30 insertions(+), 24 deletions(-) diff --git a/deepagents_plugin/external_conversation_storage/client.py b/deepagents_plugin/external_conversation_storage/client.py index 91d9e1d37..1d6a963e8 100644 --- a/deepagents_plugin/external_conversation_storage/client.py +++ b/deepagents_plugin/external_conversation_storage/client.py @@ -1,6 +1,6 @@ """Connect a Deep Agents client with Temporal native S3 External Storage.""" -from collections.abc import AsyncIterator +from collections.abc import AsyncIterator, Callable from contextlib import asynccontextmanager from dataclasses import replace @@ -18,7 +18,7 @@ @asynccontextmanager async def connect_client( - plugin: DeepAgentsPlugin, + plugin_factory: Callable[[DataConverter], DeepAgentsPlugin], *, target_host: str | None = None, s3_endpoint: str = S3_ENDPOINT, @@ -42,10 +42,8 @@ async def connect_client( bucket=S3_BUCKET, ) storage = ExternalStorage(drivers=[driver], payload_size_threshold=256 * 1024) - plugin.data_converter = replace( - plugin.data_converter or DataConverter.default, - external_storage=storage, - ) + data_converter = replace(DataConverter.default, external_storage=storage) + plugin = plugin_factory(data_converter) yield await Client.connect( **config, plugins=[plugin], diff --git a/deepagents_plugin/external_conversation_storage/main.py b/deepagents_plugin/external_conversation_storage/main.py index 448d7b162..0a7edf627 100644 --- a/deepagents_plugin/external_conversation_storage/main.py +++ b/deepagents_plugin/external_conversation_storage/main.py @@ -4,6 +4,7 @@ import uuid from langchain_core.messages import AIMessage +from temporalio.converter import DataConverter from temporalio.deepagents import DeepAgentsPlugin from temporalio.deepagents.testing import mock_model_provider from temporalio.worker import Worker @@ -17,9 +18,10 @@ ) -def create_plugin() -> DeepAgentsPlugin: +def create_plugin(data_converter: DataConverter) -> DeepAgentsPlugin: """Script replies so the sample runs without an LLM provider or API key.""" return DeepAgentsPlugin( + data_converter=data_converter, model_provider=mock_model_provider( [ AIMessage(content="The project name is Cedar."), @@ -27,7 +29,7 @@ def create_plugin() -> DeepAgentsPlugin: AIMessage(content="Cedar uses Python and is due Friday."), AIMessage(content="Cedar is a Python project due Friday."), ] - ) + ), ) @@ -38,7 +40,7 @@ async def main() -> None: "It is due Friday.", "Remind me of the project name, language, and deadline.", ] - async with connect_client(create_plugin()) as client: + async with connect_client(create_plugin) as client: async with Worker( client, task_queue=TASK_QUEUE, diff --git a/deepagents_plugin/external_payload_storage/README.md b/deepagents_plugin/external_payload_storage/README.md index 6105768bb..e4120f5a0 100644 --- a/deepagents_plugin/external_payload_storage/README.md +++ b/deepagents_plugin/external_payload_storage/README.md @@ -67,12 +67,12 @@ through, so it can also read this sample's references. ## How the configuration works `client.py` creates `ExternalStorage(drivers=[driver], -payload_size_threshold=256 * 1024)` and adds it to the LangChain-aware converter -provided by `DeepAgentsPlugin`: +payload_size_threshold=256 * 1024)`, adds it to the SDK's default converter with +`dataclasses.replace`, and passes that converter into the Deep Agents plugin: ```python -plugin = create_plugin() -plugin.data_converter = replace(plugin.data_converter, external_storage=storage) +data_converter = replace(DataConverter.default, external_storage=storage) +plugin = DeepAgentsPlugin(data_converter=data_converter) client = await Client.connect( "localhost:7233", @@ -80,6 +80,10 @@ client = await Client.connect( ) ``` +The plugin upgrades the default payload converter for LangChain types while +preserving the converter's external-storage configuration. This uses the +standalone plugin's supported `data_converter` constructor argument. + The worker inherits the configured converter. The S3 client stays open while the worker runs and the starter decodes results. No application code uploads or downloads Temporal payloads manually. diff --git a/deepagents_plugin/external_payload_storage/client.py b/deepagents_plugin/external_payload_storage/client.py index 26daaa645..dbbd290e9 100644 --- a/deepagents_plugin/external_payload_storage/client.py +++ b/deepagents_plugin/external_payload_storage/client.py @@ -1,6 +1,6 @@ """Compose native S3 storage with the Deep Agents data converter.""" -from collections.abc import AsyncIterator +from collections.abc import AsyncIterator, Callable from contextlib import asynccontextmanager from dataclasses import replace @@ -18,7 +18,7 @@ @asynccontextmanager async def connect_client( - plugin: DeepAgentsPlugin, + plugin_factory: Callable[[DataConverter], DeepAgentsPlugin], *, target_host: str | None = None, s3_endpoint: str = S3_ENDPOINT, @@ -42,10 +42,8 @@ async def connect_client( bucket=S3_BUCKET, ) storage = ExternalStorage(drivers=[driver], payload_size_threshold=256 * 1024) - plugin.data_converter = replace( - plugin.data_converter or DataConverter.default, - external_storage=storage, - ) + data_converter = replace(DataConverter.default, external_storage=storage) + plugin = plugin_factory(data_converter) yield await Client.connect( **config, plugins=[plugin], diff --git a/deepagents_plugin/external_payload_storage/main.py b/deepagents_plugin/external_payload_storage/main.py index fb520aca0..07d8bd979 100644 --- a/deepagents_plugin/external_payload_storage/main.py +++ b/deepagents_plugin/external_payload_storage/main.py @@ -10,6 +10,7 @@ import uuid from langchain_core.messages import AIMessage +from temporalio.converter import DataConverter from temporalio.deepagents import DeepAgentsPlugin from temporalio.deepagents.testing import mock_model_provider from temporalio.worker import Worker @@ -22,9 +23,10 @@ ) -def create_plugin() -> DeepAgentsPlugin: +def create_plugin(data_converter: DataConverter) -> DeepAgentsPlugin: """Script a tool request and acknowledgment for this single-workflow demo.""" return DeepAgentsPlugin( + data_converter=data_converter, model_provider=mock_model_provider( [ AIMessage( @@ -39,12 +41,12 @@ def create_plugin() -> DeepAgentsPlugin: ), AIMessage(content="Received the complete document."), ] - ) + ), ) async def main() -> None: - async with connect_client(create_plugin()) as client: + async with connect_client(create_plugin) as client: async with Worker( client, task_queue=TASK_QUEUE, diff --git a/tests/deepagents_plugin/external_payload_storage_test.py b/tests/deepagents_plugin/external_payload_storage_test.py index 6305ec455..ecfc095be 100644 --- a/tests/deepagents_plugin/external_payload_storage_test.py +++ b/tests/deepagents_plugin/external_payload_storage_test.py @@ -56,7 +56,7 @@ async def test_external_storage(client: Client, s3_endpoint: str) -> None: queue = f"deepagents-storage-{uuid.uuid4()}" target_host = client.service_client.config.target_host async with connect_client( - create_plugin(), target_host=target_host, s3_endpoint=s3_endpoint + create_plugin, target_host=target_host, s3_endpoint=s3_endpoint ) as stored_client: assert stored_client.data_converter.external_storage is not None async with Worker( @@ -110,7 +110,9 @@ async def test_external_storage(client: Client, s3_endpoint: str) -> None: # through a fresh client and driver, without executing the activities again. replay_plugin = DeepAgentsPlugin() async with connect_client( - replay_plugin, target_host=target_host, s3_endpoint=s3_endpoint + lambda data_converter: DeepAgentsPlugin(data_converter=data_converter), + target_host=target_host, + s3_endpoint=s3_endpoint, ) as replay_client: await Replayer( workflows=[ExternalStorageAgent], From 95c24f556b5247db976eb7f1f05e9fcbe3a9fe8d Mon Sep 17 00:00:00 2001 From: Brian Strauch Date: Fri, 9 Oct 2026 12:21:07 -0700 Subject: [PATCH 08/13] Combine Deep Agents external storage samples --- deepagents_plugin/README.md | 11 +- .../external_conversation_storage/README.md | 59 ------- .../external_conversation_storage/main.py | 72 -------- .../external_conversation_storage/workflow.py | 163 ------------------ .../external_payload_storage/README.md | 120 ------------- .../external_payload_storage/client.py | 50 ------ .../external_payload_storage/workflow.py | 71 -------- deepagents_plugin/external_storage/README.md | 75 ++++++++ .../client.py | 11 +- .../main.py | 42 +++-- .../external_storage/workflow.py | 95 ++++++++++ ...orage_test.py => external_storage_test.py} | 90 +++++----- 12 files changed, 251 insertions(+), 608 deletions(-) delete mode 100644 deepagents_plugin/external_conversation_storage/README.md delete mode 100644 deepagents_plugin/external_conversation_storage/main.py delete mode 100644 deepagents_plugin/external_conversation_storage/workflow.py delete mode 100644 deepagents_plugin/external_payload_storage/README.md delete mode 100644 deepagents_plugin/external_payload_storage/client.py delete mode 100644 deepagents_plugin/external_payload_storage/workflow.py create mode 100644 deepagents_plugin/external_storage/README.md rename deepagents_plugin/{external_conversation_storage => external_storage}/client.py (83%) rename deepagents_plugin/{external_payload_storage => external_storage}/main.py (53%) create mode 100644 deepagents_plugin/external_storage/workflow.py rename tests/deepagents_plugin/{external_payload_storage_test.py => external_storage_test.py} (50%) diff --git a/deepagents_plugin/README.md b/deepagents_plugin/README.md index e4ffd3aa5..da532e18a 100644 --- a/deepagents_plugin/README.md +++ b/deepagents_plugin/README.md @@ -26,8 +26,7 @@ one side. | [subagents](subagents) | Durability propagates across the agent tree — sub-agent model calls become activities with no per-sub-agent wiring. | | [streaming](streaming) | Stream model chunks to external subscribers via `streaming_topic` + `WorkflowStream`, keeping the durable result identical. | | [langsmith_tracing](langsmith_tracing) | Compose `DeepAgentsPlugin` with `LangSmithPlugin` for durable execution + LLM tracing. | -| [external_payload_storage](external_payload_storage) | Carry a 6 MiB tool result and the next model input through native S3 External Storage; scripted model, no API keys. | -| [external_conversation_storage](external_conversation_storage) | Store each exchange in S3 and include the full conversation history in each model call; native External Storage also protects large Temporal payloads. | +| [external_storage](external_storage) | Use the Temporal data converter's native S3 External Storage for a 6 MiB tool result and multi-turn conversation payloads; scripted model, no API keys. | ## Prerequisites @@ -49,7 +48,7 @@ one side. 2. Configure a model provider. Most samples use `anthropic:claude-sonnet-4-5`, which needs an Anthropic API key. The - [external_payload_storage](external_payload_storage) sample uses a scripted model and needs + [external_storage](external_storage) sample uses a scripted model and needs no provider credentials: ```bash @@ -89,15 +88,13 @@ uv run deepagents_plugin/hello_world/run_worker.py uv run deepagents_plugin/hello_world/run_workflow.py ``` -The `langsmith_tracing`, `external_payload_storage`, and -`external_conversation_storage` samples instead bundle the worker +The `langsmith_tracing` and `external_storage` samples instead bundle the worker and starter into a single driver. The storage sample also needs a mock S3 service; see their [setup instructions](../external_storage): ```bash uv run deepagents_plugin/langsmith_tracing/main.py -uv run deepagents_plugin/external_payload_storage/main.py -uv run deepagents_plugin/external_conversation_storage/main.py +uv run deepagents_plugin/external_storage/main.py ``` ## Key Features Demonstrated diff --git a/deepagents_plugin/external_conversation_storage/README.md b/deepagents_plugin/external_conversation_storage/README.md deleted file mode 100644 index 6ee10c204..000000000 --- a/deepagents_plugin/external_conversation_storage/README.md +++ /dev/null @@ -1,59 +0,0 @@ -# External Storage and Conversation History - -This companion demonstrates the same native S3 payload configuration pattern as -[external_payload_storage](../external_payload_storage), but has its own client -setup and can be run independently. It runs a four-turn conversation. It writes -each user/assistant exchange to a separate S3 object, then loads every previous -exchange for each model call. The full transcript is available to the agent -throughout the conversation. - -The S3 transcript is application-managed conversation memory. Temporal's native -`ExternalStorage` is configured too, so large workflow and activity payloads can -be stored as S3 references in Temporal history. These solve different problems: -the transcript design makes the full history available to the model, while -native External Storage bounds payload bytes in Temporal history and transport. -The scripted run uses small prompts, so it does not need to cross the native -storage threshold. The full-history approach increases model input size on every -turn; total tokens across a long conversation can grow roughly quadratically. - -External storage preserves and retrieves the transcript; it does not reduce -model tokens. For long conversations, a summary or selective retrieval strategy -can keep the model context smaller while still drawing on older turns. - -## Run it - -Use Python 3.11 or later. Install dependencies: - -```bash -uv sync --python 3.13 --group deepagents --group external-storage -``` - -Start the Temporal dev server in one terminal: - -```bash -temporal server start-dev -``` - -Start the repository's mock S3 service in another terminal: - -```bash -uv run external_storage/s3.py -``` - -Then run the sample: - -```bash -uv run deepagents_plugin/external_conversation_storage/main.py -``` - -It uses a scripted model and needs no provider API key. Each turn's full exchange -is stored under a workflow-specific S3 prefix. The final turn demonstrates that -the complete history carries earlier project details into the answer. - -The sample uses the same `temporal-payloads` bucket and local mock S3 service as -the [large-payload sample](../external_payload_storage), but shares no code with -it. -For production, use durable storage with access controls and retention -appropriate for conversation data. -Keep the storage driver configured on clients, workers, and replayers that need -to decode native Temporal payload references. diff --git a/deepagents_plugin/external_conversation_storage/main.py b/deepagents_plugin/external_conversation_storage/main.py deleted file mode 100644 index 0a7edf627..000000000 --- a/deepagents_plugin/external_conversation_storage/main.py +++ /dev/null @@ -1,72 +0,0 @@ -"""Run a multi-turn agent that supplies its full transcript to the model.""" - -import asyncio -import uuid - -from langchain_core.messages import AIMessage -from temporalio.converter import DataConverter -from temporalio.deepagents import DeepAgentsPlugin -from temporalio.deepagents.testing import mock_model_provider -from temporalio.worker import Worker - -from deepagents_plugin.external_conversation_storage.client import connect_client -from deepagents_plugin.external_conversation_storage.workflow import ( - TASK_QUEUE, - StoredConversationAgent, - load_conversation_history, - save_turn, -) - - -def create_plugin(data_converter: DataConverter) -> DeepAgentsPlugin: - """Script replies so the sample runs without an LLM provider or API key.""" - return DeepAgentsPlugin( - data_converter=data_converter, - model_provider=mock_model_provider( - [ - AIMessage(content="The project name is Cedar."), - AIMessage(content="The project is called Cedar and uses Python."), - AIMessage(content="Cedar uses Python and is due Friday."), - AIMessage(content="Cedar is a Python project due Friday."), - ] - ), - ) - - -async def main() -> None: - user_turns = [ - "I am working on a project called Cedar.", - "The project uses Python.", - "It is due Friday.", - "Remind me of the project name, language, and deadline.", - ] - async with connect_client(create_plugin) as client: - async with Worker( - client, - task_queue=TASK_QUEUE, - workflows=[StoredConversationAgent], - activities=[load_conversation_history, save_turn], - max_cached_workflows=0, - ): - workflow_id = f"deepagents-conversation-{uuid.uuid4()}" - handle = await client.start_workflow( - StoredConversationAgent.run, - id=workflow_id, - task_queue=TASK_QUEUE, - ) - for question in user_turns: - await handle.signal(StoredConversationAgent.submit_turn, question) - await handle.signal(StoredConversationAgent.finish) - result = await handle.result() - - print(f"Workflow: {workflow_id}") - print(f"Turns processed: {result.turns}") - print(f"First-turn prompt context: {result.first_context_chars:,} characters") - print(f"Last-turn prompt context: {result.last_context_chars:,} characters") - print(f"Final answer: {result.last_answer}") - print(f"Full transcript stored externally: {result.transcript_turns} turns") - print("Each model call included the complete conversation history.") - - -if __name__ == "__main__": - asyncio.run(main()) diff --git a/deepagents_plugin/external_conversation_storage/workflow.py b/deepagents_plugin/external_conversation_storage/workflow.py deleted file mode 100644 index ea6a9e067..000000000 --- a/deepagents_plugin/external_conversation_storage/workflow.py +++ /dev/null @@ -1,163 +0,0 @@ -"""A multi-turn agent that loads its full S3 transcript on each turn.""" - -from dataclasses import dataclass -from datetime import timedelta - -from temporalio import activity, workflow -from temporalio.common import RetryPolicy -from temporalio.deepagents import create_temporal_deep_agent - -MODEL = "fake:external-conversation-storage" -TASK_QUEUE = "deepagents-external-conversation-storage" -S3_BUCKET = "temporal-payloads" - - -@dataclass -class Turn: - user: str - assistant: str - - -@dataclass -class ConversationResult: - last_answer: str - turns: int - first_context_chars: int - last_context_chars: int - transcript_turns: int - - -def _conversation_prefix(workflow_id: str) -> str: - """Keep user-provided workflow IDs out of S3 key syntax.""" - import hashlib - - return f"conversation-memory/{hashlib.sha256(workflow_id.encode()).hexdigest()}/" - - -@activity.defn -async def load_conversation_history(workflow_id: str, turn_index: int) -> list[Turn]: - """Read every earlier exchange from the external transcript.""" - import aioboto3 - - session = aioboto3.Session() - async with session.client( - "s3", - endpoint_url="http://localhost:5000", - aws_access_key_id="test", - aws_secret_access_key="test", - region_name="us-east-1", - ) as client: - turns = [] - prefix = _conversation_prefix(workflow_id) - for index in range(turn_index): - response = await client.get_object( - Bucket=S3_BUCKET, Key=f"{prefix}turn-{index:08d}.json" - ) - import json - - turns.append(Turn(**json.loads(await response["Body"].read()))) - return turns - - -@activity.defn -async def save_turn(workflow_id: str, turn_index: int, turn: Turn) -> None: - """Append one exchange as its own immutable S3 object.""" - import json - from dataclasses import asdict - - import aioboto3 - - session = aioboto3.Session() - async with session.client( - "s3", - endpoint_url="http://localhost:5000", - aws_access_key_id="test", - aws_secret_access_key="test", - region_name="us-east-1", - ) as client: - await client.put_object( - Bucket=S3_BUCKET, - Key=f"{_conversation_prefix(workflow_id)}turn-{turn_index:08d}.json", - Body=json.dumps(asdict(turn)).encode(), - ContentType="application/json", - ) - - -@workflow.defn -class StoredConversationAgent: - def __init__(self) -> None: - self.pending_turns: list[str] = [] - self.finished = False - - @workflow.signal - def submit_turn(self, question: str) -> None: - self.pending_turns.append(question) - - @workflow.signal - def finish(self) -> None: - self.finished = True - - @workflow.run - async def run(self) -> ConversationResult: - workflow_id = workflow.info().workflow_id - turn_count = 0 - first_context_chars = 0 - last_context_chars = 0 - last_answer = "" - - while True: - await workflow.wait_condition( - lambda: bool(self.pending_turns) or self.finished - ) - if not self.pending_turns: - break - question = self.pending_turns.pop(0) - turn_index = turn_count - history = await workflow.execute_activity( - load_conversation_history, - args=[workflow_id, turn_index], - start_to_close_timeout=timedelta(seconds=30), - retry_policy=RetryPolicy(maximum_attempts=1), - ) - memory = "\n".join( - f"User: {turn.user}\nAssistant: {turn.assistant}" for turn in history - ) - system_prompt = ( - "Answer the user's latest message. Use the full conversation " - "when relevant. This is the complete conversation so far.\n\n" - "Conversation history:\n" - f"{memory or '(no earlier turns)'}" - ) - # A fresh agent invocation receives the complete prior transcript - # and current prompt; prior turns are not carried in graph state. - agent = create_temporal_deep_agent( - model=MODEL, - system_prompt=system_prompt, - activity_options={"start_to_close_timeout": timedelta(seconds=30)}, - ) - context_chars = len(system_prompt) + len(question) - if turn_count == 0: - first_context_chars = context_chars - result = await agent.ainvoke( - {"messages": [{"role": "user", "content": question}]} - ) - answer = result["messages"][-1].content - if not isinstance(answer, str): - raise TypeError("Expected a text response from the model") - last_answer = answer - last_context_chars = context_chars - await workflow.execute_activity( - save_turn, - args=[workflow_id, turn_index, Turn(user=question, assistant=answer)], - start_to_close_timeout=timedelta(seconds=30), - retry_policy=RetryPolicy(maximum_attempts=1), - ) - turn_count += 1 - - return ConversationResult( - last_answer=last_answer, - turns=turn_count, - first_context_chars=first_context_chars, - last_context_chars=last_context_chars, - transcript_turns=turn_count, - ) diff --git a/deepagents_plugin/external_payload_storage/README.md b/deepagents_plugin/external_payload_storage/README.md deleted file mode 100644 index e4120f5a0..000000000 --- a/deepagents_plugin/external_payload_storage/README.md +++ /dev/null @@ -1,120 +0,0 @@ -# External Storage - -Run a Deep Agent whose `read_file` tool returns **6 MiB** of text, exceeding -Temporal's default 2 MiB payload limit. The SDK's native `ExternalStorage` -offloads the tool output and the next model activity's input to S3, recording -small references in workflow history and retrieving the full bytes on decode. -The workflow returns only a byte count, SHA-256, and a short final answer. - -Native External Storage is in **Public Preview**. This sample uses the SDK's -`S3StorageDriver` with the local mock S3 service from the -[general External Storage sample](../../external_storage). Neither AWS credentials, -Docker, nor an LLM API key is needed. The model replies are scripted; the real -Deep Agents loop, tool activity, model activities, and S3 transfers still run. - -## Running the sample - -Use Python **3.11 or later**. Run these commands from the repository root: - -```bash -uv sync --python 3.13 --group deepagents --group external-storage -``` - -Start Temporal with its default payload limits in one terminal: - -```bash -temporal server start-dev -``` - -In a second terminal, start the existing mock S3 service. It listens on port -5000 and creates the `temporal-payloads` bucket: - -```bash -uv run external_storage/s3.py -``` - -In a third terminal, run the demo. It starts a worker, executes one workflow, -checks the result's integrity, and shuts down the worker: - -```bash -uv run deepagents_plugin/external_payload_storage/main.py -``` - -The output includes: - -```text -Tool result: 6,291,456 bytes (6 MiB), integrity verified -Agent: Received the complete document. -``` - -The script also prints the workflow ID and complete SHA-256. Inspect the history -in the Temporal UI or with: - -```bash -temporal workflow show --workflow-id -``` - -The completed `deepagents.invoke_tool` activity and the following -`deepagents.invoke_model` input contain native storage references. The first -model input and final workflow result remain small and inline. - -To view externally stored payloads in the UI, reuse the -[storage-aware codec server](../../external_storage#5-optional-run-the-codec-server): -run `uv run external_storage/codec_server.py` and set the UI's Remote Codec -Endpoint to `http://localhost:8081`. Its gzip decoder passes uncompressed payloads -through, so it can also read this sample's references. - -## How the configuration works - -`client.py` creates `ExternalStorage(drivers=[driver], -payload_size_threshold=256 * 1024)`, adds it to the SDK's default converter with -`dataclasses.replace`, and passes that converter into the Deep Agents plugin: - -```python -data_converter = replace(DataConverter.default, external_storage=storage) -plugin = DeepAgentsPlugin(data_converter=data_converter) - -client = await Client.connect( - "localhost:7233", - plugins=[plugin], -) -``` - -The plugin upgrades the default payload converter for LangChain types while -preserving the converter's external-storage configuration. This uses the -standalone plugin's supported `data_converter` constructor argument. - -The worker inherits the configured converter. The S3 client stays open while -the worker runs and the starter decodes results. No application code uploads or -downloads Temporal payloads manually. - -This demo deliberately uses **no compression codec**: repeated `x` characters -would compress well below the storage threshold. It overrides the built-in -`read_file` tool with an activity-backed mock bulk reader. Deep Agents excludes -`read_file` from tool-result eviction, so the complete result crosses both -activity boundaries. Applications using real models should page documents or -retrieve excerpts to manage context separately. Storage reduces transport and -history bytes; it does not reduce model tokens or decoded workflow memory. - -With storage removed, this tool result fails with `PayloadsTooLarge` at the -default limits. Raising the blob limit alone still leaves the gRPC message -limit described in [Hanyu Liu's post](https://hanyuliu.me/posts/temporal-deep-agent-payload-limits/). -Native storage avoids transmitting the large bytes through either limit. - -For real S3, use an existing bucket and normal AWS credentials instead of this -sample's local endpoint and mock credentials. Configure compatible storage -drivers on every client, worker, and replayer that reads the history. Retain -objects for as long as execution, reset, or replay may need them; Temporal does -not delete stored payloads when an activity finishes. - -## Tests - -The integration test starts an isolated mock S3 service and verifies the full -result, both native references, activity routing, and replay with a new S3 -client after worker shutdown. -No manually running S3 service or model credentials are required: - -```bash -uv sync --python 3.13 --group deepagents --group external-storage --group dev -uv run pytest tests/deepagents_plugin/external_payload_storage_test.py -``` diff --git a/deepagents_plugin/external_payload_storage/client.py b/deepagents_plugin/external_payload_storage/client.py deleted file mode 100644 index dbbd290e9..000000000 --- a/deepagents_plugin/external_payload_storage/client.py +++ /dev/null @@ -1,50 +0,0 @@ -"""Compose native S3 storage with the Deep Agents data converter.""" - -from collections.abc import AsyncIterator, Callable -from contextlib import asynccontextmanager -from dataclasses import replace - -import aioboto3 -from temporalio.client import Client -from temporalio.contrib.aws.s3driver import S3StorageDriver -from temporalio.contrib.aws.s3driver.aioboto3 import new_aioboto3_client -from temporalio.converter import DataConverter, ExternalStorage -from temporalio.deepagents import DeepAgentsPlugin -from temporalio.envconfig import ClientConfig - -S3_ENDPOINT = "http://localhost:5000" -S3_BUCKET = "temporal-payloads" - - -@asynccontextmanager -async def connect_client( - plugin_factory: Callable[[DataConverter], DeepAgentsPlugin], - *, - target_host: str | None = None, - s3_endpoint: str = S3_ENDPOINT, -) -> AsyncIterator[Client]: - """Keep the S3 client alive throughout workflow execution and payload reads.""" - config = ClientConfig.load_client_connect_config() - config.setdefault("target_host", "localhost:7233") - if target_host is not None: - config["target_host"] = target_host - - session = aioboto3.Session() - async with session.client( - "s3", - endpoint_url=s3_endpoint, - aws_access_key_id="test", - aws_secret_access_key="test", - region_name="us-east-1", - ) as s3_client: - driver = S3StorageDriver( - client=new_aioboto3_client(s3_client), - bucket=S3_BUCKET, - ) - storage = ExternalStorage(drivers=[driver], payload_size_threshold=256 * 1024) - data_converter = replace(DataConverter.default, external_storage=storage) - plugin = plugin_factory(data_converter) - yield await Client.connect( - **config, - plugins=[plugin], - ) diff --git a/deepagents_plugin/external_payload_storage/workflow.py b/deepagents_plugin/external_payload_storage/workflow.py deleted file mode 100644 index 1e4a2e35a..000000000 --- a/deepagents_plugin/external_payload_storage/workflow.py +++ /dev/null @@ -1,71 +0,0 @@ -"""A Deep Agent whose tool returns 6 MiB, carried by native External Storage.""" - -import hashlib -from dataclasses import dataclass -from datetime import timedelta - -from langchain_core.messages import ToolMessage -from langchain_core.tools import tool -from temporalio import workflow -from temporalio.common import RetryPolicy -from temporalio.deepagents import ( - create_temporal_deep_agent, - tool_as_activity, -) - -PAYLOAD_BYTES = 6 * 1024 * 1024 -MODEL = "fake:external-storage" -TASK_QUEUE = "deepagents-external-storage" - - -@dataclass -class AgentResult: - """Small integrity evidence; the large document stays out of the final result.""" - - result_bytes: int - sha256: str - answer: str - - -@tool -async def read_file(file_path: str) -> str: - """Read a mock document containing exactly 6 MiB of text.""" - # Override the built-in read_file with an activity-backed bulk reader. - # Deep Agents excludes read_file from tool-result eviction, so its complete - # content reaches the next model activity. Real file I/O would go here. - del file_path - return "x" * PAYLOAD_BYTES - - -@workflow.defn -class ExternalStorageAgent: - @workflow.run - async def run(self, question: str) -> AgentResult: - reader = tool_as_activity( - read_file, - start_to_close_timeout=timedelta(seconds=30), - activity_options={"retry_policy": RetryPolicy(maximum_attempts=1)}, - ) - agent = create_temporal_deep_agent( - model=MODEL, - tools=[reader], - system_prompt="Read the document, then acknowledge receiving the result.", - activity_options={"start_to_close_timeout": timedelta(seconds=30)}, - ) - result = await agent.ainvoke( - {"messages": [{"role": "user", "content": question}]} - ) - tool_result = next( - message - for message in result["messages"] - if isinstance(message, ToolMessage) and message.name == "read_file" - ) - assert isinstance(tool_result.content, str) - data = tool_result.content.encode() - answer = result["messages"][-1].content - assert isinstance(answer, str) - return AgentResult( - result_bytes=len(data), - sha256=hashlib.sha256(data).hexdigest(), - answer=answer, - ) diff --git a/deepagents_plugin/external_storage/README.md b/deepagents_plugin/external_storage/README.md new file mode 100644 index 000000000..1c563a73e --- /dev/null +++ b/deepagents_plugin/external_storage/README.md @@ -0,0 +1,75 @@ +# External Storage + +This sample combines two cases for Temporal's native `ExternalStorage` data +converter: + +* A Deep Agent tool returns a **6 MiB** document. The tool result and the next + model activity input are stored in S3, with small references in workflow + history. +* The workflow carries a multi-turn conversation. Each model call receives the + earlier turns as context. The same converter externalizes those activity + payloads when they exceed the configured threshold. + +The sample does not use a DeepAgents backend or manage conversation objects +itself. Temporal's converter externalizes large serialized payloads; it is not +a key-value conversation store. Small conversation state is reconstructed by +workflow replay, while large activity payloads are stored by the configured +S3 driver. The demo threshold is deliberately low (128 bytes) so conversation +payloads also exercise the converter. In a real application, choose a threshold +appropriate for your payloads. + +The S3 driver uses the local mock service from the +[general External Storage sample](../../external_storage). No AWS credentials, +Docker, or LLM API key is needed. The model replies are scripted; the real Deep +Agents loop, tool activity, model activities, and S3 transfers still run. + +## Run it + +Use Python **3.11 or later**: + +```bash +uv sync --python 3.13 --group deepagents --group external-storage +``` + +Start Temporal in one terminal: + +```bash +temporal server start-dev +``` + +Start the mock S3 service in another terminal. It listens on port 5000 and +creates the `temporal-payloads` bucket: + +```bash +uv run external_storage/s3.py +``` + +Run the demo: + +```bash +uv run deepagents_plugin/external_storage/main.py +``` + +The output includes the workflow ID, verified document size and SHA-256, number +of conversation turns, and final answer. Inspect the workflow history with: + +```bash +temporal workflow show --workflow-id +``` + +Activity inputs and results above the threshold appear as native storage +references. To view externally stored payloads in the UI, run the +[storage-aware codec server](../../external_storage#5-optional-run-the-codec-server) +and set the UI's Remote Codec Endpoint to `http://localhost:8081`. + +The client configures `ExternalStorage` on the SDK's default data converter and +passes that converter to `DeepAgentsPlugin`. The worker inherits the converter; +application code does not manually upload or download Temporal payloads. For +real S3, use an existing bucket and normal AWS credentials. Configure compatible +storage drivers on every client, worker, and replayer that reads the history, +and retain objects for as long as execution, reset, or replay may need them. + +External Storage reduces bytes in Temporal history and transport. It does not +reduce the number of history events, the model context size, or the total number +of externally stored bytes. Carrying the full transcript into each model call +still increases total conversation payload storage over time. diff --git a/deepagents_plugin/external_conversation_storage/client.py b/deepagents_plugin/external_storage/client.py similarity index 83% rename from deepagents_plugin/external_conversation_storage/client.py rename to deepagents_plugin/external_storage/client.py index 1d6a963e8..b6b66487b 100644 --- a/deepagents_plugin/external_conversation_storage/client.py +++ b/deepagents_plugin/external_storage/client.py @@ -1,4 +1,4 @@ -"""Connect a Deep Agents client with Temporal native S3 External Storage.""" +"""Configure native S3 External Storage for the Deep Agents plugin.""" from collections.abc import AsyncIterator, Callable from contextlib import asynccontextmanager @@ -41,10 +41,9 @@ async def connect_client( client=new_aioboto3_client(s3_client), bucket=S3_BUCKET, ) - storage = ExternalStorage(drivers=[driver], payload_size_threshold=256 * 1024) + # Small on purpose: this demo also externalizes serialized conversation + # context, while the large tool result shows the same path at scale. + storage = ExternalStorage(drivers=[driver], payload_size_threshold=128) data_converter = replace(DataConverter.default, external_storage=storage) plugin = plugin_factory(data_converter) - yield await Client.connect( - **config, - plugins=[plugin], - ) + yield await Client.connect(**config, plugins=[plugin]) diff --git a/deepagents_plugin/external_payload_storage/main.py b/deepagents_plugin/external_storage/main.py similarity index 53% rename from deepagents_plugin/external_payload_storage/main.py rename to deepagents_plugin/external_storage/main.py index 07d8bd979..2394d40f4 100644 --- a/deepagents_plugin/external_payload_storage/main.py +++ b/deepagents_plugin/external_storage/main.py @@ -1,9 +1,4 @@ -"""Run one Deep Agent with a 6 MiB tool result and native S3 storage. - -Both the worker and starter run in this process. The two model replies are -scripted, so the demo needs no LLM credentials or provider context budget. -The model and tool still run as real Temporal activities. -""" +"""Run one scripted conversation with native Temporal S3 External Storage.""" import asyncio import hashlib @@ -15,8 +10,8 @@ from temporalio.deepagents.testing import mock_model_provider from temporalio.worker import Worker -from deepagents_plugin.external_payload_storage.client import connect_client -from deepagents_plugin.external_payload_storage.workflow import ( +from deepagents_plugin.external_storage.client import connect_client +from deepagents_plugin.external_storage.workflow import ( PAYLOAD_BYTES, TASK_QUEUE, ExternalStorageAgent, @@ -24,7 +19,7 @@ def create_plugin(data_converter: DataConverter) -> DeepAgentsPlugin: - """Script a tool request and acknowledgment for this single-workflow demo.""" + """Script the model so the demo needs no LLM provider or API key.""" return DeepAgentsPlugin( data_converter=data_converter, model_provider=mock_model_provider( @@ -39,13 +34,24 @@ def create_plugin(data_converter: DataConverter) -> DeepAgentsPlugin: } ], ), - AIMessage(content="Received the complete document."), + AIMessage(content="I received the complete document."), + AIMessage(content="The project is called Cedar."), + AIMessage(content="Cedar uses Python."), + AIMessage(content="Cedar is due Friday."), + AIMessage(content="Cedar is a Python project due Friday."), ] ), ) async def main() -> None: + questions = [ + "Read large-document.txt and acknowledge receiving it.", + "I am working on a project called Cedar.", + "The project uses Python.", + "It is due Friday.", + "Remind me of the project name, language, and deadline.", + ] async with connect_client(create_plugin) as client: async with Worker( client, @@ -56,17 +62,19 @@ async def main() -> None: workflow_id = f"deepagents-external-storage-{uuid.uuid4()}" result = await client.execute_workflow( ExternalStorageAgent.run, - "Read large-document.txt and acknowledge receiving it.", + questions, id=workflow_id, task_queue=TASK_QUEUE, ) - assert result.result_bytes == PAYLOAD_BYTES - assert result.sha256 == hashlib.sha256(b"x" * PAYLOAD_BYTES).hexdigest() - print(f"Workflow: {workflow_id}") - print(f"Tool result: {result.result_bytes:,} bytes (6 MiB), integrity verified") - print(f"SHA-256: {result.sha256}") - print(f"Agent: {result.answer}") + assert result.tool_result_bytes == PAYLOAD_BYTES + assert result.tool_result_sha256 == hashlib.sha256(b"x" * PAYLOAD_BYTES).hexdigest() + print(f"Workflow: {workflow_id}") + print( + f"Tool result: {result.tool_result_bytes:,} bytes (6 MiB), integrity verified" + ) + print(f"Conversation turns: {result.turns}") + print(f"Final answer: {result.last_answer}") if __name__ == "__main__": diff --git a/deepagents_plugin/external_storage/workflow.py b/deepagents_plugin/external_storage/workflow.py new file mode 100644 index 000000000..afe630096 --- /dev/null +++ b/deepagents_plugin/external_storage/workflow.py @@ -0,0 +1,95 @@ +"""Exercise native External Storage with a large tool result and a conversation.""" + +import hashlib +from dataclasses import dataclass +from datetime import timedelta + +from langchain_core.messages import ToolMessage +from langchain_core.tools import tool +from temporalio import workflow +from temporalio.common import RetryPolicy +from temporalio.deepagents import create_temporal_deep_agent, tool_as_activity + +PAYLOAD_BYTES = 6 * 1024 * 1024 +MODEL = "fake:external-storage" +TASK_QUEUE = "deepagents-external-storage" + + +@dataclass +class ConversationTurn: + user: str + assistant: str + + +@dataclass +class ExternalStorageResult: + tool_result_bytes: int + tool_result_sha256: str + turns: int + last_answer: str + + +@tool +async def read_file(file_path: str) -> str: + """Read a mock document containing exactly 6 MiB of text.""" + del file_path + return "x" * PAYLOAD_BYTES + + +@workflow.defn +class ExternalStorageAgent: + @workflow.run + async def run(self, questions: list[str]) -> ExternalStorageResult: + reader = tool_as_activity( + read_file, + start_to_close_timeout=timedelta(seconds=30), + activity_options={"retry_policy": RetryPolicy(maximum_attempts=1)}, + ) + turns: list[ConversationTurn] = [] + tool_result: str | None = None + last_answer = "" + + for index, question in enumerate(questions): + history = "\n".join( + f"User: {turn.user}\nAssistant: {turn.assistant}" for turn in turns + ) + system_prompt = ( + "Answer the latest message using the conversation history. " + "For the first request, read the requested document and acknowledge " + "receiving it.\n\n" + f"Conversation history:\n{history or '(no earlier turns)'}" + ) + agent = create_temporal_deep_agent( + model=MODEL, + tools=[reader] if index == 0 else [], + system_prompt=system_prompt, + activity_options={"start_to_close_timeout": timedelta(seconds=30)}, + ) + result = await agent.ainvoke( + {"messages": [{"role": "user", "content": question}]} + ) + if index == 0: + message = next( + message + for message in result["messages"] + if isinstance(message, ToolMessage) and message.name == "read_file" + ) + if not isinstance(message.content, str): + raise TypeError("Expected the document tool result to be text") + tool_result = message.content + + answer = result["messages"][-1].content + if not isinstance(answer, str): + raise TypeError("Expected a text response from the model") + turns.append(ConversationTurn(user=question, assistant=answer)) + last_answer = answer + + if tool_result is None: + raise ValueError("At least one question is required") + tool_bytes = tool_result.encode() + return ExternalStorageResult( + tool_result_bytes=len(tool_bytes), + tool_result_sha256=hashlib.sha256(tool_bytes).hexdigest(), + turns=len(turns), + last_answer=last_answer, + ) diff --git a/tests/deepagents_plugin/external_payload_storage_test.py b/tests/deepagents_plugin/external_storage_test.py similarity index 50% rename from tests/deepagents_plugin/external_payload_storage_test.py rename to tests/deepagents_plugin/external_storage_test.py index ecfc095be..65f250c40 100644 --- a/tests/deepagents_plugin/external_payload_storage_test.py +++ b/tests/deepagents_plugin/external_storage_test.py @@ -1,4 +1,4 @@ -"""Verify the sample against real Temporal activities and a local S3 service.""" +"""Verify large tool and conversation payloads use native S3 External Storage.""" import hashlib import uuid @@ -12,18 +12,14 @@ from temporalio.api.sdk.v1 import ExternalStorageReference from temporalio.client import Client from temporalio.converter import DataConverter -from temporalio.deepagents import DeepAgentsPlugin from temporalio.worker import Replayer, Worker -from deepagents_plugin.external_payload_storage.client import ( - S3_BUCKET, - connect_client, -) -from deepagents_plugin.external_payload_storage.main import create_plugin -from deepagents_plugin.external_payload_storage.workflow import ( +from deepagents_plugin.external_storage.client import S3_BUCKET, connect_client +from deepagents_plugin.external_storage.main import create_plugin +from deepagents_plugin.external_storage.workflow import ( PAYLOAD_BYTES, - AgentResult, ExternalStorageAgent, + ExternalStorageResult, ) from tests.deepagents_plugin.helpers import ( INVOKE_MODEL, @@ -55,6 +51,13 @@ def s3_endpoint() -> Iterator[str]: async def test_external_storage(client: Client, s3_endpoint: str) -> None: queue = f"deepagents-storage-{uuid.uuid4()}" target_host = client.service_client.config.target_host + questions = [ + "Read large-document.txt and acknowledge receiving it.", + "I am working on a project called Cedar.", + "The project uses Python.", + "It is due Friday.", + "Remind me of the project name, language, and deadline.", + ] async with connect_client( create_plugin, target_host=target_host, s3_endpoint=s3_endpoint ) as stored_client: @@ -67,7 +70,7 @@ async def test_external_storage(client: Client, s3_endpoint: str) -> None: ): handle = await stored_client.start_workflow( ExternalStorageAgent.run, - "Read large-document.txt and acknowledge receiving it.", + questions, id=queue, task_queue=queue, execution_timeout=timedelta(seconds=60), @@ -75,47 +78,48 @@ async def test_external_storage(client: Client, s3_endpoint: str) -> None: result = await handle.result() history = await handle.fetch_history() - assert result == AgentResult( - result_bytes=PAYLOAD_BYTES, - sha256=hashlib.sha256(b"x" * PAYLOAD_BYTES).hexdigest(), - answer="Received the complete document.", + assert result == ExternalStorageResult( + tool_result_bytes=PAYLOAD_BYTES, + tool_result_sha256=hashlib.sha256(b"x" * PAYLOAD_BYTES).hexdigest(), + turns=5, + last_answer="Cedar is a Python project due Friday.", ) counts = await count_scheduled_activities(handle) - assert counts[INVOKE_MODEL] == 2 + assert counts[INVOKE_MODEL] == 6 assert counts[INVOKE_TOOL] == 1 - scheduled = { - event.event_id: event.activity_task_scheduled_event_attributes - for event in history.events - if event.event_type == EventType.EVENT_TYPE_ACTIVITY_TASK_SCHEDULED - } - tool_result = next( - event.activity_task_completed_event_attributes.result.payloads[0] - for event in history.events - if event.event_type == EventType.EVENT_TYPE_ACTIVITY_TASK_COMPLETED - and scheduled[ - event.activity_task_completed_event_attributes.scheduled_event_id - ].activity_type.name - == INVOKE_TOOL - ) - model_input = list(scheduled.values())[-1].input.payloads[0] - for payload in (tool_result, model_input): - reference = DataConverter.default.payload_converter.from_payload(payload) - assert isinstance(reference, ExternalStorageReference) - assert reference.driver_name == "aws.s3driver" - assert payload.ByteSize() < 1024 - assert "x" * 1024 not in history.to_json() + scheduled = { + event.event_id: event.activity_task_scheduled_event_attributes + for event in history.events + if event.event_type == EventType.EVENT_TYPE_ACTIVITY_TASK_SCHEDULED + } + tool_result = next( + event.activity_task_completed_event_attributes.result.payloads[0] + for event in history.events + if event.event_type == EventType.EVENT_TYPE_ACTIVITY_TASK_COMPLETED + and scheduled[ + event.activity_task_completed_event_attributes.scheduled_event_id + ].activity_type.name + == INVOKE_TOOL + ) + model_inputs = [ + attrs.input.payloads[0] + for attrs in scheduled.values() + if attrs.activity_type.name == INVOKE_MODEL + ] + for payload in [tool_result, *model_inputs]: + reference = DataConverter.default.payload_converter.from_payload(payload) + assert isinstance(reference, ExternalStorageReference) + assert reference.driver_name == "aws.s3driver" + assert payload.ByteSize() < 1024 + assert "x" * 1024 not in history.to_json() - # The original worker and S3 client are closed. Retrieve persisted claims - # through a fresh client and driver, without executing the activities again. - replay_plugin = DeepAgentsPlugin() + # A fresh client can decode the externally stored payloads for replay. async with connect_client( - lambda data_converter: DeepAgentsPlugin(data_converter=data_converter), - target_host=target_host, - s3_endpoint=s3_endpoint, + create_plugin, target_host=target_host, s3_endpoint=s3_endpoint ) as replay_client: await Replayer( workflows=[ExternalStorageAgent], data_converter=replay_client.data_converter, - plugins=[replay_plugin], + plugins=[create_plugin(replay_client.data_converter)], ).replay_workflow(history) From 433d5835ffa033e63f7ce365e9dca1ab09543a80 Mon Sep 17 00:00:00 2001 From: Brian Strauch Date: Wed, 14 Oct 2026 16:31:17 -0700 Subject: [PATCH 09/13] Add stable standalone CI check for branch protection --- .github/workflows/ci.yml | 26 +++++++++++++++++++++++++- 1 file changed, 25 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 0344824a0..9a7d7c671 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -46,7 +46,6 @@ jobs: echo "projects=$projects_json" >> "$GITHUB_OUTPUT" standalone-lint-test: - name: Standalone (${{ matrix.project }}, Python ${{ matrix.python }}) needs: detect-standalone-changes if: needs.detect-standalone-changes.outputs.projects != '[]' strategy: @@ -69,6 +68,31 @@ jobs: - run: uv run poe test working-directory: ${{ matrix.project }} + standalone-checks: + name: Standalone checks + needs: [detect-standalone-changes, standalone-lint-test] + # Always report a result so this can be required even when no projects changed. + if: always() + runs-on: ubuntu-latest + timeout-minutes: 5 + steps: + - name: Verify standalone results + env: + DETECTION_RESULT: ${{ needs.detect-standalone-changes.result }} + PROJECTS: ${{ needs.detect-standalone-changes.outputs.projects }} + TEST_RESULT: ${{ needs.standalone-lint-test.result }} + run: | + if [[ "$DETECTION_RESULT" != "success" ]]; then + echo "Standalone project detection did not succeed: $DETECTION_RESULT" + exit 1 + fi + if [[ "$PROJECTS" == "[]" && "$TEST_RESULT" == "skipped" ]]; then + echo "No standalone projects changed." + elif [[ "$TEST_RESULT" != "success" ]]; then + echo "Standalone lint and tests did not succeed: $TEST_RESULT" + exit 1 + fi + # Build and test the project build-lint-test: strategy: From 9d90bde07adb9b1062c87f704bb1a8abed215685 Mon Sep 17 00:00:00 2001 From: Brian Strauch Date: Thu, 15 Oct 2026 14:48:13 -0700 Subject: [PATCH 10/13] Store Deep Agents transcripts as append-only S3 messages --- deepagents_plugin/README.md | 5 +- deepagents_plugin/external_storage/README.md | 62 ++++--- deepagents_plugin/external_storage/client.py | 19 +- deepagents_plugin/external_storage/main.py | 46 +---- deepagents_plugin/external_storage/storage.py | 174 ++++++++++++++++++ .../external_storage/workflow.py | 68 ++++--- .../external_storage_test.py | 114 +++++++++--- 7 files changed, 356 insertions(+), 132 deletions(-) create mode 100644 deepagents_plugin/external_storage/storage.py diff --git a/deepagents_plugin/README.md b/deepagents_plugin/README.md index da532e18a..d7afa4cf3 100644 --- a/deepagents_plugin/README.md +++ b/deepagents_plugin/README.md @@ -26,7 +26,7 @@ one side. | [subagents](subagents) | Durability propagates across the agent tree — sub-agent model calls become activities with no per-sub-agent wiring. | | [streaming](streaming) | Stream model chunks to external subscribers via `streaming_topic` + `WorkflowStream`, keeping the durable result identical. | | [langsmith_tracing](langsmith_tracing) | Compose `DeepAgentsPlugin` with `LangSmithPlugin` for durable execution + LLM tracing. | -| [external_storage](external_storage) | Use the Temporal data converter's native S3 External Storage for a 6 MiB tool result and multi-turn conversation payloads; scripted model, no API keys. | +| [external_storage](external_storage) | Native External Storage for a 6 MiB tool result, plus an append-only S3 conversation transcript; scripted model, no API keys. | ## Prerequisites @@ -115,7 +115,8 @@ uv run deepagents_plugin/external_storage/main.py durable result unchanged. - **Observability** — compose with `LangSmithPlugin` for tracing. - **Large payload storage** — configure native `ExternalStorage` on the client's - data converter; the standalone plugin composes it with its LangChain converter. + data converter, and retain conversation messages once in S3 with bounded model + context. ## Related diff --git a/deepagents_plugin/external_storage/README.md b/deepagents_plugin/external_storage/README.md index 1c563a73e..7212c6eb2 100644 --- a/deepagents_plugin/external_storage/README.md +++ b/deepagents_plugin/external_storage/README.md @@ -1,22 +1,38 @@ # External Storage -This sample combines two cases for Temporal's native `ExternalStorage` data -converter: +This sample uses S3 for two purposes: * A Deep Agent tool returns a **6 MiB** document. The tool result and the next model activity input are stored in S3, with small references in workflow history. -* The workflow carries a multi-turn conversation. Each model call receives the - earlier turns as context. The same converter externalizes those activity - payloads when they exceed the configured threshold. - -The sample does not use a DeepAgents backend or manage conversation objects -itself. Temporal's converter externalizes large serialized payloads; it is not -a key-value conversation store. Small conversation state is reconstructed by -workflow replay, while large activity payloads are stored by the configured -S3 driver. The demo threshold is deliberately low (128 bytes) so conversation -payloads also exercise the converter. In a real application, choose a threshold -appropriate for your payloads. +* The complete conversation is retained as **one immutable JSON object per + message**, including assistant tool calls and the full tool result. Each new + user turn passes a conversation ID, message offset, and the new question; + earlier turns are loaded inside the model activity. + +The workflow creates one agent and reuses it for every question. Each invocation +puts the conversation ID and message offset in the user message's +`additional_kwargs`. The plugin's `model_provider` returns the small worker-side +wrapper in `storage.py`, which reads that reference inside the model activity. +The agent loop stays in the workflow, and each model and tool call still runs as +its own plugin activity. No custom activity or Deep Agents backend is needed. + +Transcript objects live under `conversations//.json`. +Conditional S3 writes preserve existing messages and let a retried model call +reuse its committed reply, even after later turns have been added. One workflow +owns each conversation. System instructions remain model configuration, rather +than conversation messages. + +Only the latest **16 messages** are loaded as model context; older messages stay +in S3. This keeps both transcript storage and cumulative context reads linear in +the conversation's total bytes for this fixed window. Retaining every message +does not require sending every message to every model call. A production agent +can add token-based budgeting, summaries, or retrieval for older details. + +Temporal's separate `ExternalStorage` configuration uses its default 256 KiB +threshold. It offloads the large tool result and the following model activity +input. Ordinary conversation inputs stay small and inline, instead of saving a +new full-transcript snapshot on every turn. The S3 driver uses the local mock service from the [general External Storage sample](../../external_storage). No AWS credentials, @@ -50,8 +66,8 @@ Run the demo: uv run deepagents_plugin/external_storage/main.py ``` -The output includes the workflow ID, verified document size and SHA-256, number -of conversation turns, and final answer. Inspect the workflow history with: +The output includes the workflow ID, document size, transcript S3 prefix and +message count, and final answer. Inspect the workflow history with: ```bash temporal workflow show --workflow-id @@ -62,14 +78,8 @@ references. To view externally stored payloads in the UI, run the [storage-aware codec server](../../external_storage#5-optional-run-the-codec-server) and set the UI's Remote Codec Endpoint to `http://localhost:8081`. -The client configures `ExternalStorage` on the SDK's default data converter and -passes that converter to `DeepAgentsPlugin`. The worker inherits the converter; -application code does not manually upload or download Temporal payloads. For -real S3, use an existing bucket and normal AWS credentials. Configure compatible -storage drivers on every client, worker, and replayer that reads the history, -and retain objects for as long as execution, reset, or replay may need them. - -External Storage reduces bytes in Temporal history and transport. It does not -reduce the number of history events, the model context size, or the total number -of externally stored bytes. Carrying the full transcript into each model call -still increases total conversation payload storage over time. +For real S3, use an existing bucket and normal AWS credentials. Configure +compatible storage drivers on every client, worker, and replayer that reads the +history. Keep Temporal payload objects for as long as execution, reset, or replay +may need them, and keep transcript objects for the application's conversation +retention period. The local mock S3 service is in memory. diff --git a/deepagents_plugin/external_storage/client.py b/deepagents_plugin/external_storage/client.py index b6b66487b..839d17deb 100644 --- a/deepagents_plugin/external_storage/client.py +++ b/deepagents_plugin/external_storage/client.py @@ -1,6 +1,6 @@ """Configure native S3 External Storage for the Deep Agents plugin.""" -from collections.abc import AsyncIterator, Callable +from collections.abc import AsyncIterator from contextlib import asynccontextmanager from dataclasses import replace @@ -12,17 +12,18 @@ from temporalio.deepagents import DeepAgentsPlugin from temporalio.envconfig import ClientConfig +from deepagents_plugin.external_storage.storage import TranscriptStore + S3_ENDPOINT = "http://localhost:5000" S3_BUCKET = "temporal-payloads" @asynccontextmanager async def connect_client( - plugin_factory: Callable[[DataConverter], DeepAgentsPlugin], *, target_host: str | None = None, s3_endpoint: str = S3_ENDPOINT, -) -> AsyncIterator[Client]: +) -> AsyncIterator[tuple[Client, TranscriptStore]]: """Keep the S3 client alive while Temporal reads and writes payloads.""" config = ClientConfig.load_client_connect_config() config.setdefault("target_host", "localhost:7233") @@ -41,9 +42,11 @@ async def connect_client( client=new_aioboto3_client(s3_client), bucket=S3_BUCKET, ) - # Small on purpose: this demo also externalizes serialized conversation - # context, while the large tool result shows the same path at scale. - storage = ExternalStorage(drivers=[driver], payload_size_threshold=128) + storage = ExternalStorage(drivers=[driver]) data_converter = replace(DataConverter.default, external_storage=storage) - plugin = plugin_factory(data_converter) - yield await Client.connect(**config, plugins=[plugin]) + transcripts = TranscriptStore(s3_client, S3_BUCKET) + plugin = DeepAgentsPlugin( + data_converter=data_converter, model_provider=transcripts.model_provider + ) + client = await Client.connect(**config, plugins=[plugin]) + yield client, transcripts diff --git a/deepagents_plugin/external_storage/main.py b/deepagents_plugin/external_storage/main.py index 2394d40f4..c0702f932 100644 --- a/deepagents_plugin/external_storage/main.py +++ b/deepagents_plugin/external_storage/main.py @@ -1,16 +1,11 @@ -"""Run one scripted conversation with native Temporal S3 External Storage.""" +"""Run an offline conversation with S3 transcripts and large tool payloads.""" import asyncio -import hashlib import uuid -from langchain_core.messages import AIMessage -from temporalio.converter import DataConverter -from temporalio.deepagents import DeepAgentsPlugin -from temporalio.deepagents.testing import mock_model_provider from temporalio.worker import Worker -from deepagents_plugin.external_storage.client import connect_client +from deepagents_plugin.external_storage.client import S3_BUCKET, connect_client from deepagents_plugin.external_storage.workflow import ( PAYLOAD_BYTES, TASK_QUEUE, @@ -18,33 +13,8 @@ ) -def create_plugin(data_converter: DataConverter) -> DeepAgentsPlugin: - """Script the model so the demo needs no LLM provider or API key.""" - return DeepAgentsPlugin( - data_converter=data_converter, - model_provider=mock_model_provider( - [ - AIMessage( - content="", - tool_calls=[ - { - "name": "read_file", - "args": {"file_path": "large-document.txt"}, - "id": "call-read", - } - ], - ), - AIMessage(content="I received the complete document."), - AIMessage(content="The project is called Cedar."), - AIMessage(content="Cedar uses Python."), - AIMessage(content="Cedar is due Friday."), - AIMessage(content="Cedar is a Python project due Friday."), - ] - ), - ) - - async def main() -> None: + workflow_id = f"deepagents-external-storage-{uuid.uuid4()}" questions = [ "Read large-document.txt and acknowledge receiving it.", "I am working on a project called Cedar.", @@ -52,14 +22,12 @@ async def main() -> None: "It is due Friday.", "Remind me of the project name, language, and deadline.", ] - async with connect_client(create_plugin) as client: + async with connect_client() as (client, _): async with Worker( client, task_queue=TASK_QUEUE, workflows=[ExternalStorageAgent], - max_cached_workflows=0, ): - workflow_id = f"deepagents-external-storage-{uuid.uuid4()}" result = await client.execute_workflow( ExternalStorageAgent.run, questions, @@ -68,12 +36,12 @@ async def main() -> None: ) assert result.tool_result_bytes == PAYLOAD_BYTES - assert result.tool_result_sha256 == hashlib.sha256(b"x" * PAYLOAD_BYTES).hexdigest() print(f"Workflow: {workflow_id}") + print(f"Tool result: {result.tool_result_bytes:,} bytes (6 MiB)") print( - f"Tool result: {result.tool_result_bytes:,} bytes (6 MiB), integrity verified" + f"Transcript: s3://{S3_BUCKET}/conversations/" + f"{result.conversation_id}/ ({result.message_count} messages)" ) - print(f"Conversation turns: {result.turns}") print(f"Final answer: {result.last_answer}") diff --git a/deepagents_plugin/external_storage/storage.py b/deepagents_plugin/external_storage/storage.py new file mode 100644 index 000000000..ab6e4a532 --- /dev/null +++ b/deepagents_plugin/external_storage/storage.py @@ -0,0 +1,174 @@ +"""Retain each conversation message once, outside Temporal's payload storage.""" + +import asyncio +import json +from collections.abc import Sequence +from typing import TYPE_CHECKING, Any + +from botocore.exceptions import ClientError +from langchain_core.callbacks import ( + AsyncCallbackManagerForLLMRun, + CallbackManagerForLLMRun, +) +from langchain_core.language_models import BaseChatModel +from langchain_core.messages import ( + AIMessage, + BaseMessage, + SystemMessage, + ToolMessage, + messages_from_dict, + messages_to_dict, +) +from langchain_core.outputs import ChatGeneration, ChatResult +from temporalio.deepagents.testing import FakeModel +from temporalio.exceptions import ApplicationError + +if TYPE_CHECKING: + from types_aiobotocore_s3.client import S3Client + +CONTEXT_MESSAGES = 16 + + +class TranscriptStore: + def __init__(self, client: "S3Client", bucket: str) -> None: + self.client = client + self.bucket = bucket + + async def get(self, conversation_id: str, index: int) -> BaseMessage | None: + try: + response = await self.client.get_object( + Bucket=self.bucket, + Key=f"conversations/{conversation_id}/{index:08d}.json", + ) + except ClientError as error: + if error.response["Error"]["Code"] == "NoSuchKey": + return None + raise + async with response["Body"] as body: + return messages_from_dict([json.loads(await body.read())])[0] + + async def put( + self, conversation_id: str, index: int, message: BaseMessage + ) -> BaseMessage: + try: + await self.client.put_object( + Bucket=self.bucket, + Key=f"conversations/{conversation_id}/{index:08d}.json", + Body=json.dumps(messages_to_dict([message])[0]).encode(), + ContentType="application/json", + IfNoneMatch="*", + ) + return message + except ClientError as error: + if error.response["Error"]["Code"] != "PreconditionFailed": + raise + existing = await self.get(conversation_id, index) + if existing is None: + raise RuntimeError( + "Transcript message disappeared after a conditional write" + ) + return existing + + async def read( + self, conversation_id: str, start: int, stop: int + ) -> list[BaseMessage]: + messages = await asyncio.gather( + *[self.get(conversation_id, index) for index in range(start, stop)] + ) + if any(message is None for message in messages): + raise ApplicationError("Transcript message is missing", non_retryable=True) + return [message for message in messages if message is not None] + + def model_provider(self, name: str) -> "ConversationModel": + return ConversationModel(store=self) + + +class ConversationModel(BaseChatModel): + """Worker-side wrapper; the plugin still runs every model call as an activity.""" + + store: TranscriptStore + + @property + def _llm_type(self) -> str: + return "s3-conversation" + + def bind_tools(self, tools: Sequence[Any], **kwargs: Any) -> Any: + # The demo scripts its tool call rather than asking a real provider. + return self + + def _generate( + self, + messages: list[BaseMessage], + stop: list[str] | None = None, + run_manager: CallbackManagerForLLMRun | None = None, + **kwargs: Any, + ) -> ChatResult: + raise NotImplementedError("Use the async model") + + async def _agenerate( + self, + messages: list[BaseMessage], + stop: list[str] | None = None, + run_manager: AsyncCallbackManagerForLLMRun | None = None, + **kwargs: Any, + ) -> ChatResult: + current = [m for m in messages if not isinstance(m, SystemMessage)] + reference = current[0].additional_kwargs + conversation_id = reference["conversation_id"] + offset = reference["message_offset"] + end = offset + len(current) + for index, message in enumerate(current, offset): + existing = await self.store.put(conversation_id, index, message) + # LangGraph can regenerate message IDs on replay; S3 positions are + # the stable identity. Tool call IDs remain part of the comparison. + if existing.model_dump(exclude={"id"}) != message.model_dump( + exclude={"id"} + ): + raise ApplicationError( + "Conflicting transcript message", non_retryable=True + ) + reply = await self.store.get(conversation_id, end) + if reply is None: + recent = await self.store.read( + conversation_id, max(0, end - CONTEXT_MESSAGES), end + ) + # Drop leading tool results if their calls fell outside the window. + while recent and isinstance(recent[0], ToolMessage): + recent.pop(0) + context = [m for m in messages if isinstance(m, SystemMessage)] + recent + response = await FakeModel([scripted_reply(recent)]).ainvoke(context) + # Conditional writes make committed replies reusable after retries. + reply = await self.store.put(conversation_id, end, response) + return ChatResult(generations=[ChatGeneration(message=reply)]) + + +def scripted_reply(messages: list[BaseMessage]) -> AIMessage: + latest = messages[-1] + if isinstance(latest, ToolMessage): + return AIMessage(content="I received the complete document.") + if str(latest.content).startswith("Read large-document.txt"): + return AIMessage( + content="", + tool_calls=[ + { + "name": "read_file", + "args": {"file_path": "large-document.txt"}, + "id": "call-read", + } + ], + ) + replies = { + "I am working on a project called Cedar.": "The project is called Cedar.", + "The project uses Python.": "Cedar uses Python.", + "It is due Friday.": "Cedar is due Friday.", + } + if str(latest.content).startswith("Remind me"): + context = "\n".join(str(message.content) for message in messages) + return AIMessage( + content=( + "Cedar is a Python project due Friday." + if all(fact in context for fact in ("Cedar", "Python", "Friday")) + else "Those details are outside my recent context." + ) + ) + return AIMessage(content=replies.get(str(latest.content), "Acknowledged.")) diff --git a/deepagents_plugin/external_storage/workflow.py b/deepagents_plugin/external_storage/workflow.py index afe630096..da32f6d00 100644 --- a/deepagents_plugin/external_storage/workflow.py +++ b/deepagents_plugin/external_storage/workflow.py @@ -1,32 +1,25 @@ """Exercise native External Storage with a large tool result and a conversation.""" -import hashlib from dataclasses import dataclass from datetime import timedelta -from langchain_core.messages import ToolMessage +from langchain_core.messages import HumanMessage, ToolMessage from langchain_core.tools import tool from temporalio import workflow from temporalio.common import RetryPolicy from temporalio.deepagents import create_temporal_deep_agent, tool_as_activity PAYLOAD_BYTES = 6 * 1024 * 1024 -MODEL = "fake:external-storage" TASK_QUEUE = "deepagents-external-storage" -@dataclass -class ConversationTurn: - user: str - assistant: str - - @dataclass class ExternalStorageResult: tool_result_bytes: int - tool_result_sha256: str turns: int last_answer: str + conversation_id: str + message_count: int @tool @@ -45,28 +38,33 @@ async def run(self, questions: list[str]) -> ExternalStorageResult: start_to_close_timeout=timedelta(seconds=30), activity_options={"retry_policy": RetryPolicy(maximum_attempts=1)}, ) - turns: list[ConversationTurn] = [] - tool_result: str | None = None + conversation_id = workflow.info().run_id + message_count = 0 + tool_result_bytes = 0 last_answer = "" + agent = create_temporal_deep_agent( + model="fake:conversation", + tools=[reader], + system_prompt=( + "Answer using the recent conversation. For the first request, " + "read the document and acknowledge receiving it." + ), + activity_options={"start_to_close_timeout": timedelta(seconds=30)}, + ) for index, question in enumerate(questions): - history = "\n".join( - f"User: {turn.user}\nAssistant: {turn.assistant}" for turn in turns - ) - system_prompt = ( - "Answer the latest message using the conversation history. " - "For the first request, read the requested document and acknowledge " - "receiving it.\n\n" - f"Conversation history:\n{history or '(no earlier turns)'}" - ) - agent = create_temporal_deep_agent( - model=MODEL, - tools=[reader] if index == 0 else [], - system_prompt=system_prompt, - activity_options={"start_to_close_timeout": timedelta(seconds=30)}, - ) result = await agent.ainvoke( - {"messages": [{"role": "user", "content": question}]} + { + "messages": [ + HumanMessage( + content=question, + additional_kwargs={ + "conversation_id": conversation_id, + "message_offset": message_count, + }, + ) + ] + } ) if index == 0: message = next( @@ -76,20 +74,20 @@ async def run(self, questions: list[str]) -> ExternalStorageResult: ) if not isinstance(message.content, str): raise TypeError("Expected the document tool result to be text") - tool_result = message.content + tool_result_bytes = len(message.content.encode()) answer = result["messages"][-1].content if not isinstance(answer, str): raise TypeError("Expected a text response from the model") - turns.append(ConversationTurn(user=question, assistant=answer)) + message_count += len(result["messages"]) last_answer = answer - if tool_result is None: + if not questions: raise ValueError("At least one question is required") - tool_bytes = tool_result.encode() return ExternalStorageResult( - tool_result_bytes=len(tool_bytes), - tool_result_sha256=hashlib.sha256(tool_bytes).hexdigest(), - turns=len(turns), + tool_result_bytes=tool_result_bytes, + turns=len(questions), last_answer=last_answer, + conversation_id=conversation_id, + message_count=message_count, ) diff --git a/tests/deepagents_plugin/external_storage_test.py b/tests/deepagents_plugin/external_storage_test.py index 65f250c40..b230f7cd0 100644 --- a/tests/deepagents_plugin/external_storage_test.py +++ b/tests/deepagents_plugin/external_storage_test.py @@ -1,25 +1,26 @@ -"""Verify large tool and conversation payloads use native S3 External Storage.""" +"""Verify complete S3 transcripts without full-history activity inputs.""" -import hashlib import uuid from collections.abc import Iterator from datetime import timedelta import boto3 import pytest +from langchain_core.messages import AIMessage, BaseMessage, HumanMessage from moto.server import ThreadedMotoServer from temporalio.api.enums.v1 import EventType from temporalio.api.sdk.v1 import ExternalStorageReference from temporalio.client import Client from temporalio.converter import DataConverter +from temporalio.deepagents import DeepAgentsPlugin from temporalio.worker import Replayer, Worker +from deepagents_plugin.external_storage import storage from deepagents_plugin.external_storage.client import S3_BUCKET, connect_client -from deepagents_plugin.external_storage.main import create_plugin +from deepagents_plugin.external_storage.storage import CONTEXT_MESSAGES from deepagents_plugin.external_storage.workflow import ( PAYLOAD_BYTES, ExternalStorageAgent, - ExternalStorageResult, ) from tests.deepagents_plugin.helpers import ( INVOKE_MODEL, @@ -48,7 +49,10 @@ def s3_endpoint() -> Iterator[str]: server.stop() -async def test_external_storage(client: Client, s3_endpoint: str) -> None: +@pytest.mark.parametrize("extra_turns", [0, 20]) +async def test_external_storage( + client: Client, s3_endpoint: str, extra_turns: int, monkeypatch: pytest.MonkeyPatch +) -> None: queue = f"deepagents-storage-{uuid.uuid4()}" target_host = client.service_client.config.target_host questions = [ @@ -57,11 +61,20 @@ async def test_external_storage(client: Client, s3_endpoint: str) -> None: "The project uses Python.", "It is due Friday.", "Remind me of the project name, language, and deadline.", + *[f"Follow-up message {index}." for index in range(extra_turns)], ] - async with connect_client( - create_plugin, target_host=target_host, s3_endpoint=s3_endpoint - ) as stored_client: - assert stored_client.data_converter.external_storage is not None + contexts: list[list[BaseMessage]] = [] + scripted_reply = storage.scripted_reply + + def record_context(messages: list[BaseMessage]) -> AIMessage: + contexts.append(messages) + return scripted_reply(messages) + + monkeypatch.setattr(storage, "scripted_reply", record_context) + async with connect_client(target_host=target_host, s3_endpoint=s3_endpoint) as ( + stored_client, + transcripts, + ): async with Worker( stored_client, task_queue=queue, @@ -73,20 +86,38 @@ async def test_external_storage(client: Client, s3_endpoint: str) -> None: questions, id=queue, task_queue=queue, - execution_timeout=timedelta(seconds=60), + execution_timeout=timedelta(seconds=90), ) result = await handle.result() history = await handle.fetch_history() - assert result == ExternalStorageResult( - tool_result_bytes=PAYLOAD_BYTES, - tool_result_sha256=hashlib.sha256(b"x" * PAYLOAD_BYTES).hexdigest(), - turns=5, - last_answer="Cedar is a Python project due Friday.", + assert result.tool_result_bytes == PAYLOAD_BYTES + assert result.turns == len(questions) + assert result.last_answer == ( + "Acknowledged." if extra_turns else "Cedar is a Python project due Friday." ) + assert result.message_count == 2 * len(questions) + 2 counts = await count_scheduled_activities(handle) - assert counts[INVOKE_MODEL] == 6 + assert counts[INVOKE_MODEL] == len(questions) + 1 assert counts[INVOKE_TOOL] == 1 + assert all(len(context) <= CONTEXT_MESSAGES for context in contexts) + if extra_turns: + assert questions[0] not in [m.content for m in contexts[-1]] + + messages = await transcripts.read( + result.conversation_id, 0, result.message_count + ) + assert [m.content for m in messages if m.type == "human"] == questions + assert [m.type for m in messages[:4]] == ["human", "ai", "tool", "ai"] + assert isinstance(messages[1], AIMessage) + assert messages[1].tool_calls[0]["name"] == "read_file" + assert messages[2].content == "x" * PAYLOAD_BYTES + objects = await transcripts.client.list_objects_v2( + Bucket=S3_BUCKET, Prefix=f"conversations/{result.conversation_id}/" + ) + contents = objects["Contents"] + assert len(contents) == result.message_count + assert sum(obj["Size"] for obj in contents) < PAYLOAD_BYTES + 50_000 scheduled = { event.event_id: event.activity_task_scheduled_event_attributes @@ -107,19 +138,58 @@ async def test_external_storage(client: Client, s3_endpoint: str) -> None: for attrs in scheduled.values() if attrs.activity_type.name == INVOKE_MODEL ] - for payload in [tool_result, *model_inputs]: + for payload in [tool_result, model_inputs[1]]: reference = DataConverter.default.payload_converter.from_payload(payload) assert isinstance(reference, ExternalStorageReference) assert reference.driver_name == "aws.s3driver" assert payload.ByteSize() < 1024 + for payload in model_inputs[2:]: + request = (await stored_client.data_converter.decode([payload]))[0] + assert len(request["messages"]) == 2 # System instructions + latest user. + assert not isinstance( + DataConverter.default.payload_converter.from_payload(payload), + ExternalStorageReference, + ) assert "x" * 1024 not in history.to_json() - # A fresh client can decode the externally stored payloads for replay. - async with connect_client( - create_plugin, target_host=target_host, s3_endpoint=s3_endpoint - ) as replay_client: + async with connect_client(target_host=target_host, s3_endpoint=s3_endpoint) as ( + replay_client, + fresh_transcripts, + ): + assert ( + await fresh_transcripts.read( + result.conversation_id, 0, result.message_count + ) + == messages + ) + # Retry the first request after later turns: reuse the committed reply. + retry = await fresh_transcripts.model_provider("fake:conversation").ainvoke( + [messages[0]] + ) + assert retry == messages[1] + assert len(contexts) == len(questions) + 1 await Replayer( workflows=[ExternalStorageAgent], data_converter=replay_client.data_converter, - plugins=[create_plugin(replay_client.data_converter)], + plugins=[DeepAgentsPlugin(data_converter=replay_client.data_converter)], ).replay_workflow(history) + assert len(contexts) == len(questions) + 1 + + +async def test_transcript_messages_are_immutable( + s3_endpoint: str, client: Client +) -> None: + async with connect_client( + target_host=client.service_client.config.target_host, s3_endpoint=s3_endpoint + ) as (_, transcripts): + conversation_id = str(uuid.uuid4()) + original = HumanMessage(content="Keep this exact message.") + assert await transcripts.put(conversation_id, 0, original) == original + assert await transcripts.put(conversation_id, 0, original) == original + assert ( + await transcripts.put( + conversation_id, 0, HumanMessage(content="Different.") + ) + == original + ) + assert await transcripts.read(conversation_id, 0, 1) == [original] From 16a01167dc666dca2a162462a112b1b23d473f67 Mon Sep 17 00:00:00 2001 From: Brian Strauch Date: Thu, 15 Oct 2026 14:54:00 -0700 Subject: [PATCH 11/13] Move conversation model factory into client setup --- deepagents_plugin/external_storage/client.py | 8 ++++++-- deepagents_plugin/external_storage/storage.py | 3 --- tests/deepagents_plugin/external_storage_test.py | 9 +++++---- 3 files changed, 11 insertions(+), 9 deletions(-) diff --git a/deepagents_plugin/external_storage/client.py b/deepagents_plugin/external_storage/client.py index 839d17deb..ac54cdf60 100644 --- a/deepagents_plugin/external_storage/client.py +++ b/deepagents_plugin/external_storage/client.py @@ -12,7 +12,10 @@ from temporalio.deepagents import DeepAgentsPlugin from temporalio.envconfig import ClientConfig -from deepagents_plugin.external_storage.storage import TranscriptStore +from deepagents_plugin.external_storage.storage import ( + ConversationModel, + TranscriptStore, +) S3_ENDPOINT = "http://localhost:5000" S3_BUCKET = "temporal-payloads" @@ -46,7 +49,8 @@ async def connect_client( data_converter = replace(DataConverter.default, external_storage=storage) transcripts = TranscriptStore(s3_client, S3_BUCKET) plugin = DeepAgentsPlugin( - data_converter=data_converter, model_provider=transcripts.model_provider + data_converter=data_converter, + model_provider=lambda _: ConversationModel(store=transcripts), ) client = await Client.connect(**config, plugins=[plugin]) yield client, transcripts diff --git a/deepagents_plugin/external_storage/storage.py b/deepagents_plugin/external_storage/storage.py index ab6e4a532..f88f257ea 100644 --- a/deepagents_plugin/external_storage/storage.py +++ b/deepagents_plugin/external_storage/storage.py @@ -79,9 +79,6 @@ async def read( raise ApplicationError("Transcript message is missing", non_retryable=True) return [message for message in messages if message is not None] - def model_provider(self, name: str) -> "ConversationModel": - return ConversationModel(store=self) - class ConversationModel(BaseChatModel): """Worker-side wrapper; the plugin still runs every model call as an activity.""" diff --git a/tests/deepagents_plugin/external_storage_test.py b/tests/deepagents_plugin/external_storage_test.py index b230f7cd0..b5922233c 100644 --- a/tests/deepagents_plugin/external_storage_test.py +++ b/tests/deepagents_plugin/external_storage_test.py @@ -17,7 +17,10 @@ from deepagents_plugin.external_storage import storage from deepagents_plugin.external_storage.client import S3_BUCKET, connect_client -from deepagents_plugin.external_storage.storage import CONTEXT_MESSAGES +from deepagents_plugin.external_storage.storage import ( + CONTEXT_MESSAGES, + ConversationModel, +) from deepagents_plugin.external_storage.workflow import ( PAYLOAD_BYTES, ExternalStorageAgent, @@ -163,9 +166,7 @@ def record_context(messages: list[BaseMessage]) -> AIMessage: == messages ) # Retry the first request after later turns: reuse the committed reply. - retry = await fresh_transcripts.model_provider("fake:conversation").ainvoke( - [messages[0]] - ) + retry = await ConversationModel(store=fresh_transcripts).ainvoke([messages[0]]) assert retry == messages[1] assert len(contexts) == len(questions) + 1 await Replayer( From 9b9bc14b5d4d1f567c15901f6a5d9bb296c80486 Mon Sep 17 00:00:00 2001 From: Brian Strauch Date: Mon, 19 Oct 2026 11:18:14 -0700 Subject: [PATCH 12/13] Remove conversation storage from Deep Agents sample --- deepagents_plugin/README.md | 7 +- deepagents_plugin/external_storage/README.md | 54 ++---- deepagents_plugin/external_storage/client.py | 30 ++- deepagents_plugin/external_storage/main.py | 22 +-- deepagents_plugin/external_storage/storage.py | 171 ------------------ .../external_storage/workflow.py | 76 +++----- .../external_storage_test.py | 127 ++++--------- 7 files changed, 105 insertions(+), 382 deletions(-) delete mode 100644 deepagents_plugin/external_storage/storage.py diff --git a/deepagents_plugin/README.md b/deepagents_plugin/README.md index d7afa4cf3..dbaf1ae0b 100644 --- a/deepagents_plugin/README.md +++ b/deepagents_plugin/README.md @@ -26,7 +26,7 @@ one side. | [subagents](subagents) | Durability propagates across the agent tree — sub-agent model calls become activities with no per-sub-agent wiring. | | [streaming](streaming) | Stream model chunks to external subscribers via `streaming_topic` + `WorkflowStream`, keeping the durable result identical. | | [langsmith_tracing](langsmith_tracing) | Compose `DeepAgentsPlugin` with `LangSmithPlugin` for durable execution + LLM tracing. | -| [external_storage](external_storage) | Native External Storage for a 6 MiB tool result, plus an append-only S3 conversation transcript; scripted model, no API keys. | +| [external_storage](external_storage) | Native External Storage for a 6 MiB tool result; scripted model, no API keys. | ## Prerequisites @@ -90,7 +90,7 @@ uv run deepagents_plugin/hello_world/run_workflow.py The `langsmith_tracing` and `external_storage` samples instead bundle the worker and starter into a single driver. The storage sample also needs a mock S3 service; -see their [setup instructions](../external_storage): +see its [setup instructions](external_storage): ```bash uv run deepagents_plugin/langsmith_tracing/main.py @@ -115,8 +115,7 @@ uv run deepagents_plugin/external_storage/main.py durable result unchanged. - **Observability** — compose with `LangSmithPlugin` for tracing. - **Large payload storage** — configure native `ExternalStorage` on the client's - data converter, and retain conversation messages once in S3 with bounded model - context. + data converter to offload a 6 MiB tool result and the following model input. ## Related diff --git a/deepagents_plugin/external_storage/README.md b/deepagents_plugin/external_storage/README.md index 7212c6eb2..36153e709 100644 --- a/deepagents_plugin/external_storage/README.md +++ b/deepagents_plugin/external_storage/README.md @@ -1,38 +1,17 @@ # External Storage -This sample uses S3 for two purposes: - -* A Deep Agent tool returns a **6 MiB** document. The tool result and the next - model activity input are stored in S3, with small references in workflow - history. -* The complete conversation is retained as **one immutable JSON object per - message**, including assistant tool calls and the full tool result. Each new - user turn passes a conversation ID, message offset, and the new question; - earlier turns are loaded inside the model activity. - -The workflow creates one agent and reuses it for every question. Each invocation -puts the conversation ID and message offset in the user message's -`additional_kwargs`. The plugin's `model_provider` returns the small worker-side -wrapper in `storage.py`, which reads that reference inside the model activity. -The agent loop stays in the workflow, and each model and tool call still runs as -its own plugin activity. No custom activity or Deep Agents backend is needed. - -Transcript objects live under `conversations//.json`. -Conditional S3 writes preserve existing messages and let a retried model call -reuse its committed reply, even after later turns have been added. One workflow -owns each conversation. System instructions remain model configuration, rather -than conversation messages. - -Only the latest **16 messages** are loaded as model context; older messages stay -in S3. This keeps both transcript storage and cumulative context reads linear in -the conversation's total bytes for this fixed window. Retaining every message -does not require sending every message to every model call. A production agent -can add token-based budgeting, summaries, or retrieval for older details. - -Temporal's separate `ExternalStorage` configuration uses its default 256 KiB -threshold. It offloads the large tool result and the following model activity -input. Ordinary conversation inputs stay small and inline, instead of saving a -new full-transcript snapshot on every turn. +This sample runs a Deep Agent whose activity-backed `read_file` tool returns a +**6 MiB** document. Temporal's native `ExternalStorage` stores the tool result +and the following model activity input in S3, leaving small references in +workflow history. The workflow returns only the document's byte count, SHA-256, +and final answer. + +The client configures `ExternalStorage` on a data converter and passes it to +`DeepAgentsPlugin`, which composes it with its LangChain-aware converter. The +worker inherits that configuration. Payloads above the default **256 KiB** +threshold are uploaded and downloaded automatically; the workflow input, first +model input, and final result stay inline. The agent loop runs in the workflow, +and each model and tool call runs as its own plugin activity. The S3 driver uses the local mock service from the [general External Storage sample](../../external_storage). No AWS credentials, @@ -66,8 +45,8 @@ Run the demo: uv run deepagents_plugin/external_storage/main.py ``` -The output includes the workflow ID, document size, transcript S3 prefix and -message count, and final answer. Inspect the workflow history with: +The output includes the workflow ID, verified document size and SHA-256, and +final answer. Inspect the workflow history with: ```bash temporal workflow show --workflow-id @@ -80,6 +59,5 @@ and set the UI's Remote Codec Endpoint to `http://localhost:8081`. For real S3, use an existing bucket and normal AWS credentials. Configure compatible storage drivers on every client, worker, and replayer that reads the -history. Keep Temporal payload objects for as long as execution, reset, or replay -may need them, and keep transcript objects for the application's conversation -retention period. The local mock S3 service is in memory. +history. Keep payload objects for as long as execution, reset, or replay may +need them. The local mock S3 service is in memory. diff --git a/deepagents_plugin/external_storage/client.py b/deepagents_plugin/external_storage/client.py index ac54cdf60..094f6c6ab 100644 --- a/deepagents_plugin/external_storage/client.py +++ b/deepagents_plugin/external_storage/client.py @@ -5,18 +5,15 @@ from dataclasses import replace import aioboto3 +from langchain_core.messages import AIMessage from temporalio.client import Client from temporalio.contrib.aws.s3driver import S3StorageDriver from temporalio.contrib.aws.s3driver.aioboto3 import new_aioboto3_client from temporalio.converter import DataConverter, ExternalStorage from temporalio.deepagents import DeepAgentsPlugin +from temporalio.deepagents.testing import mock_model_provider from temporalio.envconfig import ClientConfig -from deepagents_plugin.external_storage.storage import ( - ConversationModel, - TranscriptStore, -) - S3_ENDPOINT = "http://localhost:5000" S3_BUCKET = "temporal-payloads" @@ -26,7 +23,7 @@ async def connect_client( *, target_host: str | None = None, s3_endpoint: str = S3_ENDPOINT, -) -> AsyncIterator[tuple[Client, TranscriptStore]]: +) -> AsyncIterator[Client]: """Keep the S3 client alive while Temporal reads and writes payloads.""" config = ClientConfig.load_client_connect_config() config.setdefault("target_host", "localhost:7233") @@ -47,10 +44,23 @@ async def connect_client( ) storage = ExternalStorage(drivers=[driver]) data_converter = replace(DataConverter.default, external_storage=storage) - transcripts = TranscriptStore(s3_client, S3_BUCKET) + # Script the model so the demo needs no LLM provider or API key. plugin = DeepAgentsPlugin( data_converter=data_converter, - model_provider=lambda _: ConversationModel(store=transcripts), + model_provider=mock_model_provider( + [ + AIMessage( + content="", + tool_calls=[ + { + "name": "read_file", + "args": {"file_path": "large-document.txt"}, + "id": "call-read", + } + ], + ), + AIMessage(content="I received the complete document."), + ] + ), ) - client = await Client.connect(**config, plugins=[plugin]) - yield client, transcripts + yield await Client.connect(**config, plugins=[plugin]) diff --git a/deepagents_plugin/external_storage/main.py b/deepagents_plugin/external_storage/main.py index c0702f932..bb6fbcf37 100644 --- a/deepagents_plugin/external_storage/main.py +++ b/deepagents_plugin/external_storage/main.py @@ -1,11 +1,12 @@ -"""Run an offline conversation with S3 transcripts and large tool payloads.""" +"""Run an offline agent with native External Storage for a 6 MiB tool result.""" import asyncio +import hashlib import uuid from temporalio.worker import Worker -from deepagents_plugin.external_storage.client import S3_BUCKET, connect_client +from deepagents_plugin.external_storage.client import connect_client from deepagents_plugin.external_storage.workflow import ( PAYLOAD_BYTES, TASK_QUEUE, @@ -15,14 +16,7 @@ async def main() -> None: workflow_id = f"deepagents-external-storage-{uuid.uuid4()}" - questions = [ - "Read large-document.txt and acknowledge receiving it.", - "I am working on a project called Cedar.", - "The project uses Python.", - "It is due Friday.", - "Remind me of the project name, language, and deadline.", - ] - async with connect_client() as (client, _): + async with connect_client() as client: async with Worker( client, task_queue=TASK_QUEUE, @@ -30,18 +24,16 @@ async def main() -> None: ): result = await client.execute_workflow( ExternalStorageAgent.run, - questions, + "Read large-document.txt and acknowledge receiving it.", id=workflow_id, task_queue=TASK_QUEUE, ) assert result.tool_result_bytes == PAYLOAD_BYTES + assert result.tool_result_sha256 == hashlib.sha256(b"x" * PAYLOAD_BYTES).hexdigest() print(f"Workflow: {workflow_id}") print(f"Tool result: {result.tool_result_bytes:,} bytes (6 MiB)") - print( - f"Transcript: s3://{S3_BUCKET}/conversations/" - f"{result.conversation_id}/ ({result.message_count} messages)" - ) + print(f"SHA-256: {result.tool_result_sha256}") print(f"Final answer: {result.last_answer}") diff --git a/deepagents_plugin/external_storage/storage.py b/deepagents_plugin/external_storage/storage.py deleted file mode 100644 index f88f257ea..000000000 --- a/deepagents_plugin/external_storage/storage.py +++ /dev/null @@ -1,171 +0,0 @@ -"""Retain each conversation message once, outside Temporal's payload storage.""" - -import asyncio -import json -from collections.abc import Sequence -from typing import TYPE_CHECKING, Any - -from botocore.exceptions import ClientError -from langchain_core.callbacks import ( - AsyncCallbackManagerForLLMRun, - CallbackManagerForLLMRun, -) -from langchain_core.language_models import BaseChatModel -from langchain_core.messages import ( - AIMessage, - BaseMessage, - SystemMessage, - ToolMessage, - messages_from_dict, - messages_to_dict, -) -from langchain_core.outputs import ChatGeneration, ChatResult -from temporalio.deepagents.testing import FakeModel -from temporalio.exceptions import ApplicationError - -if TYPE_CHECKING: - from types_aiobotocore_s3.client import S3Client - -CONTEXT_MESSAGES = 16 - - -class TranscriptStore: - def __init__(self, client: "S3Client", bucket: str) -> None: - self.client = client - self.bucket = bucket - - async def get(self, conversation_id: str, index: int) -> BaseMessage | None: - try: - response = await self.client.get_object( - Bucket=self.bucket, - Key=f"conversations/{conversation_id}/{index:08d}.json", - ) - except ClientError as error: - if error.response["Error"]["Code"] == "NoSuchKey": - return None - raise - async with response["Body"] as body: - return messages_from_dict([json.loads(await body.read())])[0] - - async def put( - self, conversation_id: str, index: int, message: BaseMessage - ) -> BaseMessage: - try: - await self.client.put_object( - Bucket=self.bucket, - Key=f"conversations/{conversation_id}/{index:08d}.json", - Body=json.dumps(messages_to_dict([message])[0]).encode(), - ContentType="application/json", - IfNoneMatch="*", - ) - return message - except ClientError as error: - if error.response["Error"]["Code"] != "PreconditionFailed": - raise - existing = await self.get(conversation_id, index) - if existing is None: - raise RuntimeError( - "Transcript message disappeared after a conditional write" - ) - return existing - - async def read( - self, conversation_id: str, start: int, stop: int - ) -> list[BaseMessage]: - messages = await asyncio.gather( - *[self.get(conversation_id, index) for index in range(start, stop)] - ) - if any(message is None for message in messages): - raise ApplicationError("Transcript message is missing", non_retryable=True) - return [message for message in messages if message is not None] - - -class ConversationModel(BaseChatModel): - """Worker-side wrapper; the plugin still runs every model call as an activity.""" - - store: TranscriptStore - - @property - def _llm_type(self) -> str: - return "s3-conversation" - - def bind_tools(self, tools: Sequence[Any], **kwargs: Any) -> Any: - # The demo scripts its tool call rather than asking a real provider. - return self - - def _generate( - self, - messages: list[BaseMessage], - stop: list[str] | None = None, - run_manager: CallbackManagerForLLMRun | None = None, - **kwargs: Any, - ) -> ChatResult: - raise NotImplementedError("Use the async model") - - async def _agenerate( - self, - messages: list[BaseMessage], - stop: list[str] | None = None, - run_manager: AsyncCallbackManagerForLLMRun | None = None, - **kwargs: Any, - ) -> ChatResult: - current = [m for m in messages if not isinstance(m, SystemMessage)] - reference = current[0].additional_kwargs - conversation_id = reference["conversation_id"] - offset = reference["message_offset"] - end = offset + len(current) - for index, message in enumerate(current, offset): - existing = await self.store.put(conversation_id, index, message) - # LangGraph can regenerate message IDs on replay; S3 positions are - # the stable identity. Tool call IDs remain part of the comparison. - if existing.model_dump(exclude={"id"}) != message.model_dump( - exclude={"id"} - ): - raise ApplicationError( - "Conflicting transcript message", non_retryable=True - ) - reply = await self.store.get(conversation_id, end) - if reply is None: - recent = await self.store.read( - conversation_id, max(0, end - CONTEXT_MESSAGES), end - ) - # Drop leading tool results if their calls fell outside the window. - while recent and isinstance(recent[0], ToolMessage): - recent.pop(0) - context = [m for m in messages if isinstance(m, SystemMessage)] + recent - response = await FakeModel([scripted_reply(recent)]).ainvoke(context) - # Conditional writes make committed replies reusable after retries. - reply = await self.store.put(conversation_id, end, response) - return ChatResult(generations=[ChatGeneration(message=reply)]) - - -def scripted_reply(messages: list[BaseMessage]) -> AIMessage: - latest = messages[-1] - if isinstance(latest, ToolMessage): - return AIMessage(content="I received the complete document.") - if str(latest.content).startswith("Read large-document.txt"): - return AIMessage( - content="", - tool_calls=[ - { - "name": "read_file", - "args": {"file_path": "large-document.txt"}, - "id": "call-read", - } - ], - ) - replies = { - "I am working on a project called Cedar.": "The project is called Cedar.", - "The project uses Python.": "Cedar uses Python.", - "It is due Friday.": "Cedar is due Friday.", - } - if str(latest.content).startswith("Remind me"): - context = "\n".join(str(message.content) for message in messages) - return AIMessage( - content=( - "Cedar is a Python project due Friday." - if all(fact in context for fact in ("Cedar", "Python", "Friday")) - else "Those details are outside my recent context." - ) - ) - return AIMessage(content=replies.get(str(latest.content), "Acknowledged.")) diff --git a/deepagents_plugin/external_storage/workflow.py b/deepagents_plugin/external_storage/workflow.py index da32f6d00..a6263d04a 100644 --- a/deepagents_plugin/external_storage/workflow.py +++ b/deepagents_plugin/external_storage/workflow.py @@ -1,9 +1,10 @@ -"""Exercise native External Storage with a large tool result and a conversation.""" +"""Exercise native External Storage with a 6 MiB tool result.""" +import hashlib from dataclasses import dataclass from datetime import timedelta -from langchain_core.messages import HumanMessage, ToolMessage +from langchain_core.messages import ToolMessage from langchain_core.tools import tool from temporalio import workflow from temporalio.common import RetryPolicy @@ -16,10 +17,8 @@ @dataclass class ExternalStorageResult: tool_result_bytes: int - turns: int + tool_result_sha256: str last_answer: str - conversation_id: str - message_count: int @tool @@ -32,62 +31,35 @@ async def read_file(file_path: str) -> str: @workflow.defn class ExternalStorageAgent: @workflow.run - async def run(self, questions: list[str]) -> ExternalStorageResult: + async def run(self, question: str) -> ExternalStorageResult: reader = tool_as_activity( read_file, start_to_close_timeout=timedelta(seconds=30), activity_options={"retry_policy": RetryPolicy(maximum_attempts=1)}, ) - conversation_id = workflow.info().run_id - message_count = 0 - tool_result_bytes = 0 - last_answer = "" agent = create_temporal_deep_agent( - model="fake:conversation", + model="fake:external-storage", tools=[reader], - system_prompt=( - "Answer using the recent conversation. For the first request, " - "read the document and acknowledge receiving it." - ), + system_prompt="Read the requested document and acknowledge receiving it.", activity_options={"start_to_close_timeout": timedelta(seconds=30)}, ) - for index, question in enumerate(questions): - result = await agent.ainvoke( - { - "messages": [ - HumanMessage( - content=question, - additional_kwargs={ - "conversation_id": conversation_id, - "message_offset": message_count, - }, - ) - ] - } - ) - if index == 0: - message = next( - message - for message in result["messages"] - if isinstance(message, ToolMessage) and message.name == "read_file" - ) - if not isinstance(message.content, str): - raise TypeError("Expected the document tool result to be text") - tool_result_bytes = len(message.content.encode()) - - answer = result["messages"][-1].content - if not isinstance(answer, str): - raise TypeError("Expected a text response from the model") - message_count += len(result["messages"]) - last_answer = answer - - if not questions: - raise ValueError("At least one question is required") + result = await agent.ainvoke( + {"messages": [{"role": "user", "content": question}]} + ) + message = next( + message + for message in result["messages"] + if isinstance(message, ToolMessage) and message.name == "read_file" + ) + if not isinstance(message.content, str): + raise TypeError("Expected the document tool result to be text") + answer = result["messages"][-1].content + if not isinstance(answer, str): + raise TypeError("Expected a text response from the model") + tool_bytes = message.content.encode() return ExternalStorageResult( - tool_result_bytes=tool_result_bytes, - turns=len(questions), - last_answer=last_answer, - conversation_id=conversation_id, - message_count=message_count, + tool_result_bytes=len(tool_bytes), + tool_result_sha256=hashlib.sha256(tool_bytes).hexdigest(), + last_answer=answer, ) diff --git a/tests/deepagents_plugin/external_storage_test.py b/tests/deepagents_plugin/external_storage_test.py index b5922233c..421eeb015 100644 --- a/tests/deepagents_plugin/external_storage_test.py +++ b/tests/deepagents_plugin/external_storage_test.py @@ -1,12 +1,14 @@ -"""Verify complete S3 transcripts without full-history activity inputs.""" +"""Verify a 6 MiB tool result uses native S3 External Storage.""" +import hashlib import uuid from collections.abc import Iterator from datetime import timedelta import boto3 import pytest -from langchain_core.messages import AIMessage, BaseMessage, HumanMessage +from langchain_core.load import load +from langchain_core.messages import ToolMessage from moto.server import ThreadedMotoServer from temporalio.api.enums.v1 import EventType from temporalio.api.sdk.v1 import ExternalStorageReference @@ -15,15 +17,11 @@ from temporalio.deepagents import DeepAgentsPlugin from temporalio.worker import Replayer, Worker -from deepagents_plugin.external_storage import storage from deepagents_plugin.external_storage.client import S3_BUCKET, connect_client -from deepagents_plugin.external_storage.storage import ( - CONTEXT_MESSAGES, - ConversationModel, -) from deepagents_plugin.external_storage.workflow import ( PAYLOAD_BYTES, ExternalStorageAgent, + ExternalStorageResult, ) from tests.deepagents_plugin.helpers import ( INVOKE_MODEL, @@ -52,32 +50,12 @@ def s3_endpoint() -> Iterator[str]: server.stop() -@pytest.mark.parametrize("extra_turns", [0, 20]) -async def test_external_storage( - client: Client, s3_endpoint: str, extra_turns: int, monkeypatch: pytest.MonkeyPatch -) -> None: +async def test_external_storage(client: Client, s3_endpoint: str) -> None: queue = f"deepagents-storage-{uuid.uuid4()}" target_host = client.service_client.config.target_host - questions = [ - "Read large-document.txt and acknowledge receiving it.", - "I am working on a project called Cedar.", - "The project uses Python.", - "It is due Friday.", - "Remind me of the project name, language, and deadline.", - *[f"Follow-up message {index}." for index in range(extra_turns)], - ] - contexts: list[list[BaseMessage]] = [] - scripted_reply = storage.scripted_reply - - def record_context(messages: list[BaseMessage]) -> AIMessage: - contexts.append(messages) - return scripted_reply(messages) - - monkeypatch.setattr(storage, "scripted_reply", record_context) - async with connect_client(target_host=target_host, s3_endpoint=s3_endpoint) as ( - stored_client, - transcripts, - ): + async with connect_client( + target_host=target_host, s3_endpoint=s3_endpoint + ) as stored_client: async with Worker( stored_client, task_queue=queue, @@ -86,7 +64,7 @@ def record_context(messages: list[BaseMessage]) -> AIMessage: ): handle = await stored_client.start_workflow( ExternalStorageAgent.run, - questions, + "Read large-document.txt and acknowledge receiving it.", id=queue, task_queue=queue, execution_timeout=timedelta(seconds=90), @@ -94,33 +72,14 @@ def record_context(messages: list[BaseMessage]) -> AIMessage: result = await handle.result() history = await handle.fetch_history() - assert result.tool_result_bytes == PAYLOAD_BYTES - assert result.turns == len(questions) - assert result.last_answer == ( - "Acknowledged." if extra_turns else "Cedar is a Python project due Friday." + assert result == ExternalStorageResult( + tool_result_bytes=PAYLOAD_BYTES, + tool_result_sha256=hashlib.sha256(b"x" * PAYLOAD_BYTES).hexdigest(), + last_answer="I received the complete document.", ) - assert result.message_count == 2 * len(questions) + 2 counts = await count_scheduled_activities(handle) - assert counts[INVOKE_MODEL] == len(questions) + 1 + assert counts[INVOKE_MODEL] == 2 assert counts[INVOKE_TOOL] == 1 - assert all(len(context) <= CONTEXT_MESSAGES for context in contexts) - if extra_turns: - assert questions[0] not in [m.content for m in contexts[-1]] - - messages = await transcripts.read( - result.conversation_id, 0, result.message_count - ) - assert [m.content for m in messages if m.type == "human"] == questions - assert [m.type for m in messages[:4]] == ["human", "ai", "tool", "ai"] - assert isinstance(messages[1], AIMessage) - assert messages[1].tool_calls[0]["name"] == "read_file" - assert messages[2].content == "x" * PAYLOAD_BYTES - objects = await transcripts.client.list_objects_v2( - Bucket=S3_BUCKET, Prefix=f"conversations/{result.conversation_id}/" - ) - contents = objects["Contents"] - assert len(contents) == result.message_count - assert sum(obj["Size"] for obj in contents) < PAYLOAD_BYTES + 50_000 scheduled = { event.event_id: event.activity_task_scheduled_event_attributes @@ -146,51 +105,35 @@ def record_context(messages: list[BaseMessage]) -> AIMessage: assert isinstance(reference, ExternalStorageReference) assert reference.driver_name == "aws.s3driver" assert payload.ByteSize() < 1024 - for payload in model_inputs[2:]: - request = (await stored_client.data_converter.decode([payload]))[0] - assert len(request["messages"]) == 2 # System instructions + latest user. + workflow_input = history.events[ + 0 + ].workflow_execution_started_event_attributes.input.payloads[0] + workflow_result = history.events[ + -1 + ].workflow_execution_completed_event_attributes.result.payloads[0] + for payload in [workflow_input, model_inputs[0], workflow_result]: assert not isinstance( DataConverter.default.payload_converter.from_payload(payload), ExternalStorageReference, ) assert "x" * 1024 not in history.to_json() - async with connect_client(target_host=target_host, s3_endpoint=s3_endpoint) as ( - replay_client, - fresh_transcripts, - ): - assert ( - await fresh_transcripts.read( - result.conversation_id, 0, result.message_count - ) - == messages + # A fresh client can read the full tool result and model input after shutdown. + async with connect_client( + target_host=target_host, s3_endpoint=s3_endpoint + ) as replay_client: + decoded_result = (await replay_client.data_converter.decode([tool_result]))[0] + tool_message = load(decoded_result["message"]) + assert isinstance(tool_message, ToolMessage) + assert tool_message.content == "x" * PAYLOAD_BYTES + request = (await replay_client.data_converter.decode([model_inputs[1]]))[0] + messages = [load(message) for message in request["messages"]] + assert any( + isinstance(message, ToolMessage) and message.content == tool_message.content + for message in messages ) - # Retry the first request after later turns: reuse the committed reply. - retry = await ConversationModel(store=fresh_transcripts).ainvoke([messages[0]]) - assert retry == messages[1] - assert len(contexts) == len(questions) + 1 await Replayer( workflows=[ExternalStorageAgent], data_converter=replay_client.data_converter, plugins=[DeepAgentsPlugin(data_converter=replay_client.data_converter)], ).replay_workflow(history) - assert len(contexts) == len(questions) + 1 - - -async def test_transcript_messages_are_immutable( - s3_endpoint: str, client: Client -) -> None: - async with connect_client( - target_host=client.service_client.config.target_host, s3_endpoint=s3_endpoint - ) as (_, transcripts): - conversation_id = str(uuid.uuid4()) - original = HumanMessage(content="Keep this exact message.") - assert await transcripts.put(conversation_id, 0, original) == original - assert await transcripts.put(conversation_id, 0, original) == original - assert ( - await transcripts.put( - conversation_id, 0, HumanMessage(content="Different.") - ) - == original - ) - assert await transcripts.read(conversation_id, 0, 1) == [original] From 1b09931974dfa08290ffe5351bd98bf380a364b4 Mon Sep 17 00:00:00 2001 From: Brian Strauch Date: Tue, 20 Oct 2026 20:34:06 -0700 Subject: [PATCH 13/13] Isolate external storage demo runs by task queue --- deepagents_plugin/external_storage/main.py | 5 ++- .../external_storage/workflow.py | 1 - .../external_storage_test.py | 34 +++++++++++++++++++ 3 files changed, 36 insertions(+), 4 deletions(-) diff --git a/deepagents_plugin/external_storage/main.py b/deepagents_plugin/external_storage/main.py index bb6fbcf37..fa2f781cf 100644 --- a/deepagents_plugin/external_storage/main.py +++ b/deepagents_plugin/external_storage/main.py @@ -9,7 +9,6 @@ from deepagents_plugin.external_storage.client import connect_client from deepagents_plugin.external_storage.workflow import ( PAYLOAD_BYTES, - TASK_QUEUE, ExternalStorageAgent, ) @@ -19,14 +18,14 @@ async def main() -> None: async with connect_client() as client: async with Worker( client, - task_queue=TASK_QUEUE, + task_queue=workflow_id, workflows=[ExternalStorageAgent], ): result = await client.execute_workflow( ExternalStorageAgent.run, "Read large-document.txt and acknowledge receiving it.", id=workflow_id, - task_queue=TASK_QUEUE, + task_queue=workflow_id, ) assert result.tool_result_bytes == PAYLOAD_BYTES diff --git a/deepagents_plugin/external_storage/workflow.py b/deepagents_plugin/external_storage/workflow.py index a6263d04a..dc34173ea 100644 --- a/deepagents_plugin/external_storage/workflow.py +++ b/deepagents_plugin/external_storage/workflow.py @@ -11,7 +11,6 @@ from temporalio.deepagents import create_temporal_deep_agent, tool_as_activity PAYLOAD_BYTES = 6 * 1024 * 1024 -TASK_QUEUE = "deepagents-external-storage" @dataclass diff --git a/tests/deepagents_plugin/external_storage_test.py b/tests/deepagents_plugin/external_storage_test.py index 421eeb015..c5004da35 100644 --- a/tests/deepagents_plugin/external_storage_test.py +++ b/tests/deepagents_plugin/external_storage_test.py @@ -1,9 +1,11 @@ """Verify a 6 MiB tool result uses native S3 External Storage.""" +import asyncio import hashlib import uuid from collections.abc import Iterator from datetime import timedelta +from functools import partial import boto3 import pytest @@ -17,6 +19,7 @@ from temporalio.deepagents import DeepAgentsPlugin from temporalio.worker import Replayer, Worker +from deepagents_plugin.external_storage import main as demo from deepagents_plugin.external_storage.client import S3_BUCKET, connect_client from deepagents_plugin.external_storage.workflow import ( PAYLOAD_BYTES, @@ -137,3 +140,34 @@ async def test_external_storage(client: Client, s3_endpoint: str) -> None: data_converter=replay_client.data_converter, plugins=[DeepAgentsPlugin(data_converter=replay_client.data_converter)], ).replay_workflow(history) + + +async def test_concurrent_demos( + client: Client, + s3_endpoint: str, + monkeypatch: pytest.MonkeyPatch, + capsys: pytest.CaptureFixture[str], +) -> None: + monkeypatch.setattr( + demo, + "connect_client", + partial( + connect_client, + target_host=client.service_client.config.target_host, + s3_endpoint=s3_endpoint, + ), + ) + # main() also verifies the full document's size and SHA-256 for each run. + await asyncio.wait_for(asyncio.gather(demo.main(), demo.main()), timeout=90) + output = capsys.readouterr().out + workflow_ids = { + line.removeprefix("Workflow: ") + for line in output.splitlines() + if line.startswith("Workflow: ") + } + assert len(workflow_ids) == 2 + assert output.count("Final answer: I received the complete document.") == 2 + for workflow_id in workflow_ids: + history = await client.get_workflow_handle(workflow_id).fetch_history() + started = history.events[0].workflow_execution_started_event_attributes + assert started.task_queue.name == workflow_id