-
Notifications
You must be signed in to change notification settings - Fork 284
fix: Properly handle prompt=None & avoid agent hanging #643
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
"hatch fmt --formatter", | ||
"hatch fmt --linter", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I want formatting to be first before linting, so I moved this up
5f6f85f
to
3ad53b6
Compare
logger.debug("formatting request") | ||
request = self.format_request(messages, tool_specs, system_prompt) | ||
logger.debug("request=<%s>", request) | ||
try: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This was the cause of the hang - since an exception was being thrown here and the queue never had anything in it:
sdk-python/src/strands/models/bedrock.py
Line 391 in 8b1de4d
event = await queue.get() |
Previously (strands-agents#642) bedrock would hang during message conversion because the exception was not being caught and thus the queue was always empty. Now all exceptions during conversion are caught
73ca87f
to
b47b675
Compare
Description
Avoid hanging when
prompt=None
is passed into Agent - catch all exceptionsBedrockModel._stream
so that theawait queue.get()
always completessdk-python/src/strands/models/bedrock.py
Line 391 in 8b1de4d
Revisions
Related Issues
#642
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
hatch run prepare
Checklist
By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.