Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions src/strands/tools/tools.py
Original file line number Diff line number Diff line change
Expand Up @@ -189,6 +189,15 @@ def tool_spec(self) -> ToolSpec:
"""
return self._tool_spec

@property
def supports_hot_reload(self) -> bool:
"""Check if this tool supports automatic reloading when modified.

Returns:
Always true for function-based tools.
"""
return True

@property
def tool_type(self) -> str:
"""Identifies this as a Python-based tool implementation.
Expand Down
12 changes: 10 additions & 2 deletions tests/strands/tools/test_registry.py
Original file line number Diff line number Diff line change
Expand Up @@ -124,8 +124,16 @@ def function() -> str:

def test_register_tool_duplicate_name_without_hot_reload():
"""Test that registering a tool with duplicate name raises ValueError when hot reload is not supported."""
tool_1 = PythonAgentTool(tool_name="duplicate_tool", tool_spec=MagicMock(), tool_func=lambda: None)
tool_2 = PythonAgentTool(tool_name="duplicate_tool", tool_spec=MagicMock(), tool_func=lambda: None)
# Create mock tools that don't support hot reload
tool_1 = MagicMock()
tool_1.tool_name = "duplicate_tool"
tool_1.supports_hot_reload = False
tool_1.is_dynamic = False

tool_2 = MagicMock()
tool_2.tool_name = "duplicate_tool"
tool_2.supports_hot_reload = False
tool_2.is_dynamic = False

tool_registry = ToolRegistry()
tool_registry.register_tool(tool_1)
Expand Down
2 changes: 1 addition & 1 deletion tests/strands/tools/test_tools.py
Original file line number Diff line number Diff line change
Expand Up @@ -487,7 +487,7 @@ def test_tool_type(identity_tool):

@pytest.mark.parametrize("identity_tool", ["identity_invoke", "identity_invoke_async"], indirect=True)
def test_supports_hot_reload(identity_tool):
assert not identity_tool.supports_hot_reload
assert identity_tool.supports_hot_reload


@pytest.mark.parametrize("identity_tool", ["identity_invoke", "identity_invoke_async"], indirect=True)
Expand Down
Loading