Skip to content

[BUG] Agent made with Bedrock model Claude Haiku 4.5, and using a Bedrock Guardrail, throws an error every tool call. #1153

@jacksonalvarez12

Description

@jacksonalvarez12

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

Python Version

3.13.3

Operating System

Windows 11

Installation Method

pip

Steps to Reproduce

I created a very minimal reproduction below. The guardrail is set up with very basic setting, and a custom word denied of 'Pineapple'

@tool
def get_weather():
    time.sleep(1)
    return 'cloudy'

model = BedrockModel(
    guardrail_id='XXXXX',
    guardrail_version='1',
    guardrail_trace="enabled",
    temperature=0.5,
    model_id='us.anthropic.claude-haiku-4-5-20251001-v1:0'
)

agent = Agent(
        model=model,
        tools=[get_weather],
        system_prompt="Answer the user's prmopt. You have access to one tool, get_weather",
        # TODO: Investigate if this is needed with claude
        # conversation_manager=SummarizingConversationManager()
    )

async for event in agent.stream_async(prompt):
      event_to_send = get_event_to_send(event)
      if event_to_send is not None:
          yield event_to_send

Expected Behavior

When the user asks for the weather, they should be told that its cloudy, simple enough.

Actual Behavior

This error is thrown everytime the agent is prompted to call the tool

Server error: An error occurred (internalServerException) when calling the ConverseStream operation: The system
encountered an unexpected error during processing. Try your request again.
{'error': 'An error occurred (internalServerException) when calling the ConverseStream operation: The system encountered
an unexpected error during processing. Try your request again.', 'error_name': 'EventStreamError'}

The agent never throws when given a prompt that doesn't trigger it to call the tool. And the guardrail works as expected, returning a blocked message: "Sorry, the model cannot answer this question" when asked to say the word 'Pineapple'.

When the guardrail is taken off, I cannot reproduce the error. And when a different model is used, like gpt-oss, nova-pro, or claude sonnet 4.5, I cannot reproduce the error.

Additional Context

I would think this issue is just with Bedrock itself, but I've had other issues with tool calls specifically with the gpt-oss model, so I'm starting to the think the issue is with how the Strands Agent passes tool specs or calls tools.

Possible Solution

No response

Related Issues

No response

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