fix(tools): support legacy strands module-based tool pattern#14
Merged
fix(tools): support legacy strands module-based tool pattern#14
Conversation
- Update tool loader to fall back to strands module pattern when no @tool-decorated functions found - Import strands load_tools_from_module for TOOL_SPEC-based tool compatibility - Add test coverage for TOOL_SPEC module pattern, private tools, and error cases
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
load_tools_from_module()now falls back to strands'load_tools_from_module()when no@tool-decorated functions are found. This adds support for legacy module-based tools that use theTOOL_SPEC+ same-name function pattern (e.g.strands_tools.http_request).Previously,
strands_tools.http_requestrequired the explicit colon syntax (strands_tools.http_request:http_request). Now the bare module path works, matching strands SDK behavior.Modules with no
@toolfunctions and noTOOL_SPECnow raiseAttributeErrorinstead of silently returning[].Related Issues
N/A
Type of Change
YAML / API Impact
Backwards-compatible. Tool specs that previously required
:function_namesuffix for module-based tools now work without it. No schema changes. Modules with neither@toolnorTOOL_SPECnow raise instead of silently producing no tools — this surfaces config errors earlier.Testing
How have you tested the change?
uv run just check(lint + type check)uv run just testfor overall testingexamples/still workChecklist
By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.