Skip to content

[BUG] Tools loaded by passing a file path only load the last defined tool in file #612

@jmorgan-restrata

Description

@jmorgan-restrata

Checks

  • I have updated to the lastest minor and patch version of Strands
  • I have checked the documentation and this is not expected behavior
  • I have searched ./issues and there are no duplicates of my issue

Strands Version

1.3.0

Python Version

3.11.13

Operating System

Linux

Installation Method

pip

Steps to Reproduce

Create a file called multiple_tools.py with multiple unique @tool definitions

Pass tool as file path to Agent:

agent = Agent(
    tools=['/tools/multiple_tools.py']
)

Expected Behavior

The agent should have access to all the tools defined in multiple_tools.py

Actual Behavior

The agent only has access to the last defined @tool in the file - the rest are ignored.

Additional Context

If you create a file called multiple_tools.py with multiple @tool definitions and use load_tools_from_directory=True

agent = Agent(load_tools_from_directory=True)

All tools defined by @tool are loaded into the agent.

If you instead pass the file path only the last tool is loaded.

Possible Solution

N/A

Related Issues

#508

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions