Skip to content

Conversation

@CrysisDeu
Copy link
Contributor

@CrysisDeu CrysisDeu commented Nov 16, 2025

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.

Key Changes:

  • Implemented parallel S3 reads using ThreadPoolExecutor in list_messages()
  • Maintains message order regardless of completion order
  • Handles individual message read failures gracefully without stopping the entire operation
  • Added comprehensive test coverage including edge cases and mock-based verification

Backward Compatibility:

  • Existing code continues to work without modification
  • No breaking changes to the API

Related Issues

#1164

Documentation PR

Type of Change

New feature

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

Testing Details:

  • Added 9 new test cases covering:
    • Default behavior (sequential reads)
    • Edge cases (few messages, many messages, pagination)
    • Mock-based verification of ThreadPoolExecutor configuration
  • All existing tests continue to pass (1520 passed, 4 skipped)
  • Verified message ordering is preserved
  • Tested error handling for individual message read failures
  • No new warnings introduced (existing warnings are pre-existing deprecation warnings)

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.

JackYPCOnline
JackYPCOnline previously approved these changes Dec 19, 2025
@codecov
Copy link

codecov bot commented Dec 19, 2025

Codecov Report

❌ Patch coverage is 94.44444% with 1 line in your changes missing coverage. Please review.

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

📢 Thoughts on this report? Let us know!

zastrowm
zastrowm previously approved these changes Dec 22, 2025
Copy link
Member

@pgrayy pgrayy left a comment

Choose a reason for hiding this comment

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

See comment about exception handling.

@JackYPCOnline JackYPCOnline dismissed stale reviews from zastrowm and themself via 69ebb61 December 23, 2025 20:30
@JackYPCOnline JackYPCOnline force-pushed the feature/s3-parallel-message-reads branch from b47ece1 to 69ebb61 Compare December 23, 2025 20:30
@github-actions github-actions bot added size/m and removed size/m labels Dec 23, 2025
@JackYPCOnline JackYPCOnline requested a review from pgrayy December 23, 2025 20:31
@github-actions github-actions bot added size/s and removed size/s labels Jan 14, 2026
@Unshure Unshure temporarily deployed to manual-approval January 14, 2026 21:50 — with GitHub Actions Inactive
CrysisDeu and others added 4 commits January 15, 2026 13:57
- 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)
@Unshure Unshure force-pushed the feature/s3-parallel-message-reads branch from 90c4cce to 8f90c46 Compare January 15, 2026 19:05
@github-actions github-actions bot added size/s and removed size/s labels Jan 15, 2026
@Unshure Unshure force-pushed the feature/s3-parallel-message-reads branch from 8f90c46 to 489b584 Compare January 15, 2026 19:21
@github-actions github-actions bot added size/s and removed size/s labels Jan 15, 2026
@Unshure Unshure force-pushed the feature/s3-parallel-message-reads branch from 489b584 to 3acf791 Compare January 15, 2026 19:29
@github-actions github-actions bot added size/s and removed size/s labels Jan 15, 2026
@Unshure Unshure temporarily deployed to manual-approval January 15, 2026 19:43 — with GitHub Actions Inactive
@Unshure Unshure dismissed their stale review January 15, 2026 20:02

I made updates

@strands-agents strands-agents deleted a comment from strands-agent Jan 16, 2026
@Unshure Unshure merged commit 51cbe7b into strands-agents:main Jan 20, 2026
16 of 17 checks passed
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.

5 participants