Skip to content

Conversation

pgrayy
Copy link
Member

@pgrayy pgrayy commented Aug 19, 2025

Description

Certain models (e.g., nova) require the messages array to start with a user message. The summarization manager however adds its summarization as an assistant message to the beginning of the array and thus is incompatible with certain models. To fix, I am changing the role to user.

Related Issues

#611

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: Updated existing unit tests
  • Ran hatch test tests_integ/test_summarizing_conversation_manager_integration.py
    - Locally altered the tests to use the nova pro model to properly ensure fix works.

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, or no new docs are needed
  • 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.

Copy link
Member

@Unshure Unshure left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Curious if you thought about just changing the role of the summary message to user?

@pgrayy
Copy link
Member Author

pgrayy commented Aug 22, 2025

Curious if you thought about just changing the role of the summary message to user?

I did think about this yes and actually tested with it. There were 2 (minor) concerns I had though:

  1. Technically speaking, it would be a backwards incompatible change. Very likely though most customers wouldn't notice. I can't really think of a use case where they would be looking specifically at the summary message role either from their stored session or the messages array.
  2. Setting the role to user could then lead to 2 adjacent user messages in the messages array and that made me wonder if some models would reject this pattern. At least with the models I tested, this did not cause any problems. Still, I thought I would be safe and setup a conventional pattern of user message followed by assistant message.

Again these are minor concerns and so I could get behind just switching the role type. It would certainly simplify the PR.


Made the change. See latest revision.

JackYPCOnline
JackYPCOnline previously approved these changes Aug 22, 2025
@Unshure Unshure merged commit d9f8d8a into strands-agents:main Aug 28, 2025
12 checks passed
dbschmigelski pushed a commit to dbavro19/sdk-python that referenced this pull request Aug 28, 2025
…s#698)

* summarization manager - add summary prompt to messages

* summarize conversation - assistant to user role

* fix test

* add period
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.

3 participants