Skip to content
39 changes: 39 additions & 0 deletions src/strands/vended_tools/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
"""Vended tools for Strands agents.

These are production-ready tools that ship with the SDK and integrate
with the :class:`~strands.sandbox.base.Sandbox` abstraction. They work
transparently whether the agent uses a local :class:`~strands.sandbox.host.HostSandbox`
or a remote sandbox implementation.

Each tool reads its configuration from ``tool_context.agent.state`` using
a namespaced key (e.g., ``strands_shell_tool``). This means configuration
persists across tool calls and survives session serialization.

Available tools:

- :func:`~strands.vended_tools.shell.shell` — Execute shell commands
- :func:`~strands.vended_tools.editor.editor` — View, create, and edit files
- :func:`~strands.vended_tools.python_repl.python_repl` — Execute Python code

Example::

from strands import Agent
from strands.vended_tools import shell, editor, python_repl

agent = Agent(tools=[shell, editor, python_repl])

# Configure tools via agent state (persists across calls)
agent.state.set("strands_shell_tool", {
"timeout": 60,
})
"""

from .editor import editor
from .python_repl import python_repl
from .shell import shell

__all__ = [
"editor",
"python_repl",
"shell",
]
25 changes: 25 additions & 0 deletions src/strands/vended_tools/_utils.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
"""Shared utilities for vended tools.

Provides common helper functions used across all vended tools to avoid
code duplication.
"""

from typing import Any

from ..types.tools import ToolContext


def get_tool_config(tool_context: ToolContext, state_key: str) -> dict[str, Any]:
"""Read tool configuration from agent state.

All vended tools store their configuration in agent state under
a namespaced key. This helper standardizes the pattern.

Args:
tool_context: The tool context providing access to agent state.
state_key: The state key for the tool's configuration.

Returns:
Configuration dict. Empty dict if no config is set.
"""
return tool_context.agent.state.get(state_key) or {}
Loading