sdk-python icon indicating copy to clipboard operation
sdk-python copied to clipboard

[FEATURE] For Messages that contain more than 5 documents strip out the older ones

Open ctoh-skechers opened this issue 8 months ago • 2 comments

Problem Statement

It appears that currently Strands attempts to send all documents in as a single Bedrock call. This can be a problem as if the user at any point has more than 5 documents within the message history, this will cause a Validation Exception on the Bedrock side.

Ideally, Strands should be smart enough to recognize that it needs to send those documents as separate requests and thus avoid some of the file limitations of Bedrock, that normally you would just avoid programmatically by sending the info in separate API calls.

Proposed Solution

Strands Agents should know enough about what's in its message history to know not to send 6+ documents into a single Bedrock API call. Perhaps a solution, would be to convert older files in the message into a summarized document rather than an actual doc block

{
   "document": { }
}

Use Case

If Strands Agents is being used in any normal chat related interface that allows for file uploads/attachments, when users are interacting with the agent and uploading files, the agent will hang on the 6th file upload and the session memory becomes corrupted into a state where it is unrecoverable due to the exception.

Alternatives Solutions

No response

Additional Context

No response

ctoh-skechers avatar Mar 11 '26 19:03 ctoh-skechers

Hi @ctoh-skechers , can you assign this issue to me ? I would like to work on this.

shivamnegi1705 avatar Mar 17 '26 21:03 shivamnegi1705

Thanks for raising this, instead of a direct fix, I would rather recommand it to be inclued in our larger context management story https://github.com/lizradway/strands-mono/blob/main/context-management/docs/ROADMAP.md @lizradway

JackYPCOnline avatar Mar 31 '26 15:03 JackYPCOnline