generated from amazon-archives/__template_Apache-2.0
-
Notifications
You must be signed in to change notification settings - Fork 238
Open
Labels
bugSomething isn't workingSomething isn't working
Description
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.19.0
Tools Package Version
0.2.17
Tools used
use_aws
Python Version
3.11.4
Operating System
macOS 26.1
Installation Method
pip
Steps to Reproduce
import os
from strands import Agent
from strands_tools import use_aws
from strands.models.openai import OpenAIModel
model = OpenAIModel(
client_args={
"api_key": os.environ["OPENAI_API_KEY"],
},
model_id="gpt-4o",
)
agent("How many s3 buckets are present in my AWS environment in the us-east-1 region?")
python3 use_aws.py
Expected Behavior
agent answers without error
Actual Behavior
agent (regardless of model chosen) almost always fails to pass parameters to use_aws, resulting in the following KeyError:
tool_name=<use_aws> | failed to process tool
Traceback (most recent call last):
File "REDACTEDpython3.11/site-packages/strands/tools/executors/_executor.py", line 204, in _stream
async for event in selected_tool.stream(tool_use, invocation_state, **kwargs):
File "REDACTEDpython3.11/site-packages/strands/tools/tools.py", line 226, in stream
result = await asyncio.to_thread(self._tool_func, tool_use, **invocation_state)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/asyncio/threads.py", line 25, in to_thread
return await loop.run_in_executor(None, func_call)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/concurrent/futures/thread.py", line 58, in run
result = self.fn(*self.args, **self.kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "REDACTEDpython3.11/site-packages/opentelemetry/instrumentation/threading/__init__.py", line 171, in wrapped_func
return original_func(*func_args, **func_kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "REDACTEDpython3.11/site-packages/strands_tools/use_aws.py", line 283, in use_aws
parameters = tool_input["parameters"]
Additional Context
No response
Possible Solution
Make parameters optional.
tools/src/strands_tools/use_aws.py
Line 283 in ac6d590
| parameters = tool_input["parameters"] |
Use parameters = tool_input.get("parameters", {}).
These seems to make sense since the tool checks for "truthiness" of parameters later on anyway:
tools/src/strands_tools/use_aws.py
Line 298 in ac6d590
| if parameters: |
Related Issues
No response
My hurried solution
Added specific instructions on tool use in system_prompt to correct this error.
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working