Skip to content

[BUG] Agent/model does not pass use_aws parameters; make it optional #332

@brsolomon-deloitte

Description

@brsolomon-deloitte

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

  1. 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.

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:

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

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions