Skip to content

Add Strands plugin samples#310

Merged
brianstrauch merged 18 commits into
mainfrom
strands-plugin-samples
Jun 5, 2026
Merged

Add Strands plugin samples#310
brianstrauch merged 18 commits into
mainfrom
strands-plugin-samples

Conversation

@brianstrauch

Copy link
Copy Markdown
Member

Summary

  • Adds a strands_plugin/ directory with samples for the Temporal Strands plugin: hello world, tools (in-workflow @tool, activity_as_tool, strands_tools wrapped as activity), human-in-the-loop, hooks, MCP, structured output, streaming, tool interrupt, and continue-as-new.
  • Adds matching tests under tests/strands_plugin/ with a shared _mock_model so the suite runs without hitting a real model.
  • Adds a strands extra in pyproject.toml for the sample dependencies.

Temporary: [tool.uv.sources] pins temporalio to the strands branch of sdk-python since the strands extra isn't published yet. Remove that block once temporalio[strands] ships to PyPI.

Test plan

  • uv sync --group strands
  • uv run pytest tests/strands_plugin
  • Spot-run hello_world, tools, and mcp samples end-to-end against a local Temporal server

🤖 Generated with Claude Code

Demonstrates the Temporal Strands plugin: hello world, tools (in-workflow,
custom activity, strands_tools), HITL, hooks, MCP, structured output,
streaming, interrupt, and continue-as-new.

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
@brianstrauch brianstrauch requested a review from a team as a code owner May 20, 2026 20:48
brianstrauch and others added 3 commits May 20, 2026 14:39
`user_says` → `turn`, now a `@workflow.update` returning the assistant's
reply directly so callers no longer need a separate `messages` query to
discover what the agent said. The run loop drains in-flight handlers via
`workflow.all_handlers_finished` before continue-as-new.

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
The activity was toggling its `_APPROVED` state (add on raise, discard on
success), so after the human approved once, a follow-up tool call from the
model would interrupt again with no further approval coming — hanging the
test. Drop the discard so once approved, the name stays approved.

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
ruff's `I001` rule groups `temporalio` with other third-party imports
rather than its own block, which broke `poe lint` on CI.

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
@brianstrauch brianstrauch force-pushed the strands-plugin-samples branch from 1e8e365 to 1faf2fe Compare May 20, 2026 23:40
brianstrauch and others added 6 commits May 21, 2026 12:38
Picks up c84320c6 on the strands branch, which rewrites the MCP
populate_cache and call_tool activity to use ClientSession directly
instead of MCPClient.start/stop. The old code created a background
event loop on one thread and closed it from another, which deadlocked
mcp_test on Python 3.10 once trio_asyncio's policy was installed at
import time by tests/trio_async/workflow_test.py.

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
Disambiguates from the hook-based human_in_the_loop sample by naming this
one after where the interrupt is raised (a Temporal activity). Also fixes
the parent README's broken `tool_interrupt` link.

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
Comment thread strands_plugin/README.md Outdated
Comment thread tests/strands_plugin/continue_as_new_test.py Outdated
lennessyy and others added 3 commits June 1, 2026 10:37
The dependency group is named strands-agents, not strands.

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
Replace test_continue_as_new_chat, which never tripped the continue-as-new
branch, with test_continue_as_new_carries_history. A low
limit.historyCount.suggestContinueAsNew threshold makes the server suggest
continue-as-new after one turn, so the test verifies the original run ends in
CONTINUED_AS_NEW and the fresh run resumes with the carried-over messages
before taking another turn and ending the chat.

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
@brianstrauch brianstrauch requested a review from xumaple June 1, 2026 18:12
lennessyy and others added 4 commits June 1, 2026 15:19
temporalio 1.28.0's langsmith extra already pins langsmith>=0.7.34,<0.9,
so the manual constraint-dependencies entry is redundant.

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
ruff format requires two blank lines before the trailing @@@SNIPEND
markers added in 12f9d5d.

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
@brianstrauch brianstrauch requested a review from a team as a code owner June 5, 2026 17:34
@brianstrauch brianstrauch merged commit 5ceb3c8 into main Jun 5, 2026
14 of 19 checks passed
@brianstrauch brianstrauch deleted the strands-plugin-samples branch June 5, 2026 18:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants