Skip to content

[BUG] Agent hangs when agent(None) is passed #642

@zastrowm

Description

@zastrowm

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

dev

Python Version

3.12

Operating System

macOS

Installation Method

git clone

Steps to Reproduce

Code:

import logging
from strands import Agent
from strands.models.bedrock import BedrockModel

sonnet4 = BedrockModel(
    max_tokens=4096,
    model_id="us.anthropic.claude-sonnet-4-20250514-v1:0",
    params={
        "temperature": 0.5,
    }
)

logging.basicConfig(level=logging.DEBUG)
logger = logging.getLogger(__name__)

agent = Agent(
    model=sonnet4,
    tools=[],
    system_prompt="You are a helpful assistant"
)
print(f"About to call agent(None)")
try:
    response = agent(None)
    print(f"SUCCESS: Agent handled None message")
    print(f"Response type: {type(response)}")
    print(f"Response: {response}")
except Exception as e:
    print(f"EXCEPTION: Agent failed with None message")
    print(f"Exception type: {type(e)}")
    print(f"Exception message: {e}")

Expected Behavior

Does not hang

Actual Behavior

It hangs and never ends!

Additional Context

Probably because nothing is ever added to the queue:

Possible Solution

No response

Related Issues

No response

Metadata

Metadata

Assignees

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