Skip to content

Conversation

@JackYPCOnline
Copy link
Contributor

Description

This PR adds parallel reading support to S3SessionManager.list_messages() to improve performance when retrieving multiple messages from S3. The implementation uses ThreadPoolExecutor to fetch messages concurrently, significantly reducing latency for sessions with many messages.

This PR is a revision of #1186

Fix magic number and cumbersome parameters validation.

Related Issues

Documentation PR

Type of Change

Bug fix
New feature
Breaking change
Documentation update
Other (please describe):

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

  • [x ] I ran hatch run prepare

Checklist

  • [x ] I have read the CONTRIBUTING document
  • [x ] I have added any necessary tests that prove my fix is effective or my feature works
  • [x ] I have updated the documentation accordingly
  • [x ] I have added an appropriate example to the documentation to outline the feature, or no new docs are needed
  • [x ] My changes generate no new warnings
  • [x ] 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.

CrysisDeu and others added 2 commits December 19, 2025 08:52
- Add max_parallel_reads parameter to S3SessionManager.__init__()
- Implement parallel S3 reads using ThreadPoolExecutor in list_messages()
- Support both instance-level and per-call max_parallel_reads configuration
- Add comprehensive tests for parallel reading functionality
- Maintain backward compatibility (default max_parallel_reads=1)
@JackYPCOnline JackYPCOnline marked this pull request as ready for review December 19, 2025 17:00
@codecov
Copy link

codecov bot commented Dec 19, 2025

Codecov Report

❌ Patch coverage is 77.77778% with 4 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
src/strands/session/s3_session_manager.py 77.77% 3 Missing and 1 partial ⚠️

📢 Thoughts on this report? Let us know!

@zastrowm
Copy link
Member

Note that we did attempt this at one other point, but had to revert: #1013

I think long-term we'd want to support asyncio as well, as otherwise we're forcing threads on folks who just want to use async all the way

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants