Skip to content

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

@ctoh-skechers

Description

@ctoh-skechers

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions