feat(checkpoint-bedrock): Add bedrock checkpointer #1087
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.
Overview
This PR introduces a new package
@langchain/langgraph-checkpoint-bedrock
that implements a CheckpointSaver for LangGraph.js using Amazon Bedrock Agent Runtime sessions for persistence. This implementation allows LangGraph applications to securely store and retrieve conversation state and context across multi-step generative AI workflows without requiring custom backend solutions.Features
• Implements BedrockSessionSaver class that extends BaseCheckpointSaver from LangGraph
• Provides seamless integration with Amazon Bedrock Agent Runtime sessions API
• Supports storing and retrieving checkpoint data with proper serialization
• Handles pending writes and task sends for complex workflow states
• Implements checkpoint listing with filtering capabilities
• Supports session creation with optional customer-managed KMS keys for enhanced security
• Provides flexible AWS credential configuration options
Implementation Details
• Uses Amazon Bedrock Agent Runtime sessions to store LangGraph checkpoints
• Implements the full CheckpointSaver interface including put, getTuple, putWrites, and list methods
• Organizes checkpoint data using invocations and invocation steps in Bedrock sessions
• Handles serialization/deserialization of complex checkpoint data structures
• Implements proper error handling for AWS service exceptions
• Provides utility functions for AWS configuration and checkpoint management
Security Considerations
• Supports AWS IAM for access control to session data
• Implements optional customer-managed KMS key encryption
• Follows AWS best practices for credential management
Testing
• Includes unit tests for utility functions
• Provides integration tests for the full checkpoint lifecycle
Documentation
• Comprehensive README with installation and usage instructions
• Code examples for common use cases
• Detailed JSDoc comments for all public APIs
Dependencies
• Requires @aws-sdk/client-bedrock-agent-runtime as a peer dependency