Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
This PR introduces a SessionManagement class to the Strands SDK that is in charge of persisting an agent to some datastore, and re-initializing the agent. The SessionManagement feature set includes:
Introduces an agent
id
attribute used as a unique id for differentiating agentsSessionManager: Interface for SessionManagers. This interface introduces a
append_message_to_agent_session
method that is called in the Agent class when adding a message to the agent messages array, as well as aninitialize_agent
class for initializing an agentAgentSessionManager: Implementation of the above interface for persisting a single agent to some datastore. This will also re-initialize the agent's messages and state.
Session models: Three new models to represent different data types for session persistence:
SessionDAO: DAO Interface with CRUDL operations for each of the above new models
FileSessionDAO: A implementation of the SessionDAO for storing a session in the local file system. This introduces the following directory and file structure to represent a Session:
S3SessionDAO: Same as the above FileSessionDAO, but stores sessions in S3
Things that still need to be addressed:
Changes for a follow-up pr:
#246
Documentation PR
TODO:
Type of Change
New feature
Testing
How have you tested the change?
• [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
• [ ] 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
• [x] My changes generate no new warnings
• [x] Any dependent changes have been merged and published
Additional Notes:
N/A
By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the
terms of your choice.