Skip to content

Conversation

@cagataycali
Copy link
Member

Overview

This PR fixes the memory tool data source type detection bug reported in issue #90.

Problem

The memory tool was hardcoded to assume 'CUSTOM' data source type, causing failures when users had multiple data sources where the first one wasn't CUSTOM type (e.g., S3 data sources).

Solution

  • Added method that properly identifies data source types
  • Prioritizes CUSTOM data sources but falls back to first available if none found
  • Updated all operations (store_document, delete_document, get_document) to use proper type detection
  • Enhanced error messages for unsupported data source types with clear guidance
  • Updated tests to mock the new get_data_source API calls

Key Improvements

  1. Robust Data Source Discovery: Searches through ALL data sources, not just the first
  2. Type Validation: Explicitly checks each data source's type configuration
  3. Clear Error Messages: Users get specific errors for S3 and other unsupported types
  4. Backward Compatibility: Existing CUSTOM-only setups continue to work seamlessly

Testing

  • ✅ All existing unit tests pass
  • ✅ Added test coverage for new data source detection logic
  • ✅ Pre-commit hooks (formatting, linting, type checking) all pass

Closes

Fixes #90

References

…ource support

- Add _detect_data_source_type() method to properly identify CUSTOM vs other data source types
- Update store_document(), delete_document(), and get_document() to use proper type detection
- Prioritize CUSTOM data sources but fallback to first available if none found
- Add clear error messages for unsupported data source types (S3, etc.)
- Update tests to mock the new get_data_source calls
- Resolves issue with memory tool failing when users have multiple data sources

Fixes strands-agents#90
@cagataycali cagataycali requested a review from a team as a code owner July 22, 2025 18:56
@cagataycali cagataycali enabled auto-merge (squash) July 22, 2025 19:29
@cagataycali cagataycali merged commit c445966 into strands-agents:main Jul 22, 2025
14 checks passed
@cagataycali cagataycali deleted the fix/memory-tool-datasource-detection branch July 22, 2025 20:31
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.

[BUG] memory tool fail to store kb if user have 2 datasources and first one is not CUSTOM

2 participants