Skip to content

fix: enable optional parameters in use_aws to prevent KeyError#449

Open
jwliu36 wants to merge 1 commit intostrands-agents:mainfrom
jwliu36:fix/use-aws-optional-parameters
Open

fix: enable optional parameters in use_aws to prevent KeyError#449
jwliu36 wants to merge 1 commit intostrands-agents:mainfrom
jwliu36:fix/use-aws-optional-parameters

Conversation

@jwliu36
Copy link
Copy Markdown

@jwliu36 jwliu36 commented Apr 9, 2026

Description

Make parameters optional in the use_aws tool to prevent a KeyError when the LLM omits it.

Some AWS operations like list_buckets don't require parameters. When using non-Bedrock models (e.g., OpenAI GPT-4o), the LLM often omits the parameters field entirely, causing a crash at tool_input["parameters"].

Changes:

  • Use tool_input.get("parameters", {}) instead of tool_input["parameters"]
  • Remove parameters from the required list in TOOL_SPEC
  • Add unit test for calling use_aws without parameters

Related Issues

Fixes #332

Documentation PR

N/A

Type of Change

Bug fix

Testing

How have you tested the change? Verify that the changes do not break functionality or introduce warnings in consuming repositories: agents-docs, agents-tools, agents-cli

  • I ran hatch run prepare

Checklist

  • I have read the CONTRIBUTING document
  • I have added any necessary tests that prove my fix is effective or my feature works
  • I have updated the documentation accordingly
  • I have added an appropriate example to the documentation to outline the feature
  • My changes generate no new warnings
  • Any dependent changes have been merged and published

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

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

1 participant