Skip to content

[feature] memory tool: use existing boto3 session #138

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

rbpotter-aws
Copy link

@rbpotter-aws rbpotter-aws commented Jul 14, 2025

Description

This PR enhances the memory tool with comprehensive boto3 session injection capabilities, enabling flexible AWS authentication patterns for accessing Amazon Bedrock Knowledge Bases. The changes add two new public functions (set_memory_session and get_memory_session) and extend the existing memory tool to support custom session management.

Key Changes:

  • Added set_memory_session() function to store boto3 sessions with optional keys
  • Added get_memory_session() function to retrieve stored sessions
  • Enhanced memory tool with session_key parameter for session selection
  • Implemented global session store for managing multiple AWS sessions
  • Added comprehensive session validation and error handling
  • Maintained backward compatibility with existing memory tool usage

New Capabilities:

  • Multi-environment authentication (dev/staging/prod)
  • Cross-account AWS access via STS assume role
  • Regional session management for compliance requirements
  • Session lifecycle management and cleanup
  • Custom AWS profile support
  • Related Issues

[No specific issues referenced - this is a feature enhancement]

Documentation and sdk-python PR

Type of Change

[ ] Bug fix
[ ] New Tool
[x] Breaking change (extends existing tool with new parameters - backward compatible)
[ ] Other (please describe):

Testing

Manual Testing Completed:

  • Validated all function signatures match documentation
  • Tested session storage and retrieval functionality
  • Verified backward compatibility with existing memory tool usage
  • Tested error handling for invalid sessions and missing keys

Code Quality Checks:

  • hatch fmt --linter - ✅ All linting checks pass
  • hatch fmt --formatter - ✅ Code formatting consistent
  • hatch test --all - ✅ All existing tests continue to pass

Validation Scripts:

  • Created and ran comprehensive code example validation
  • Verified function signatures match implementation
  • Tested import statements and parameter consistency

Checklist

[x] I have read the CONTRIBUTING document
[x] I have added 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
[x] My changes generate no new warnings
[x] Any dependent changes have been merged and published

Additional Quality Assurance:

[x] All 27 code examples in documentation are syntactically correct
[x] Function signatures match between implementation and documentation
[x] Session management follows AWS best practices
[x] Error handling provides clear user feedback
[x] Backward compatibility maintained for existing user

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.

1 participant
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy