Skip to content

Latest commit

 

History

History

tools

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 
 
 

README.md

Tools

Three Strands tool patterns wired into one TemporalAgent:

Pattern When to use it
@tool from strands Pure, deterministic logic with no I/O. Runs in workflow context.
@activity.defn wrapped via activity_as_tool Anything with I/O, non-determinism, or significant runtime — gets durable retries and timeouts.
strands_tools.<tool> wrapped in an @activity.defn Reuse Strands ecosystem tools (environment, http_request, python_repl, …) while keeping workflow code deterministic.

A single prompt exercises all three. The resulting Temporal history shows an invoke_model for each model turn, plus fetch_weather and environment activity calls; the letter_counter call runs in-workflow and doesn't show up as an activity.

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)
  • Wrapping strands_tools tools so runtime host access happens in an activity

Running the Sample

# Terminal 1
uv run strands_plugin/tools/run_worker.py

# Terminal 2
uv run strands_plugin/tools/run_workflow.py

Files

File Description
workflow.py The three tools, the TemporalAgent, and ToolsWorkflow
run_worker.py Registers StrandsPlugin + the two activities, starts the worker
run_workflow.py Executes the workflow and prints the result