generated from amazon-archives/__template_MIT-0
-
Notifications
You must be signed in to change notification settings - Fork 73
Open
Labels
Description
Hi folks,
I'm trying to use the Qwen3-4B deployment from notebook 0-setup/2-setup-sageamaker-endpoint.ipynb in the Strands lab 4-frameworks/strands-agents/strands-agents.ipynb.
It seems like the model is only generating tool call responses when any tools are provided, and not properly generating either final answer messages or responses to off-topic questions?
Expected behaviour
When using the SageMaker-deployed Qwen model in a Strands agent with some basic tool(s):
- If the user's question is irrelevant to the tools, a standard answer is generated
- If the user's question is relevant to a tool, the tool is called and then the agent generates an answer based on the result
Observed behaviour
A simplified example, using the strands_tools.calculator:
agent = Agent(model, tools=[calculator])
result = agent("Hi, how are you today?")
# Yields empty response - agent.messages is:
[{'role': 'user', 'content': [{'text': 'Hi, how are you today?'}]},
{'role': 'assistant', 'content': []}]...or when the tool is relevant:
agent = Agent(model, tools=[calculator])
result = agent("What's the square root of 3969?")
# Uses the tool *but does not summarize the result* - agent.messages is:
[{'role': 'user', 'content': [{'text': "What's the square root of 3969?"}]},
{'role': 'assistant',
'content': [{'toolUse': {'toolUseId': 'chatcmpl-tool-0c22d91405be4e54a2c8432d19e306df',
'name': 'calculator',
'input': {'expression': 'sqrt(3969)', 'mode': 'evaluate'}}}]},
{'role': 'user',
'content': [{'toolResult': {'status': 'success',
'content': [{'text': 'Result: 63'}],
'toolUseId': 'chatcmpl-tool-0c22d91405be4e54a2c8432d19e306df'}}]},
{'role': 'assistant', 'content': []}]When I create the Agent without tools, it generates answers normally (probably it should be possible to split out the reasoning into a separate structure also, but whatever):
agent = Agent(model)
result = agent("Hi, how are you today")
# agent.messages is:
[{'role': 'user', 'content': [{'text': 'Hi, how are you today?'}]},
{'role': 'assistant',
'content': [{'text': '<think>\nOkay, the user greeted me with "Hi, how are you today?" I need to respond appropriately. Since I\'m an AI, I don\'t have feelings, but I can simulate a friendly response.\n\nFirst, I should acknowledge their greeting. Then, mention that I\'m here to help. Maybe add a bit of enthusiasm to keep the conversation engaging. Also, offer assistance with whatever they need. Keep it simple and positive. Let me put that together.\n</think>\n\nHello! I\'m just a language model, so I don\'t have feelings, but I\'m here and ready to help! How can I assist you today? 😊'}]}]