Registry / llm-agents / langgraph-checkpoint-aws

langgraph-checkpoint-aws

JSON →
library1.1.0pypypi✓ verified 83d ago

The `langgraph-checkpoint-aws` library provides a LangGraph checkpointer implementation that leverages AWS Bedrock Session Management Service (SMS) for session storage and AWS ElastiCache Valkey (Redis) for state management. It enables stateful and resumable LangGraph agents, allowing them to persist and retrieve their execution state across invocations. The current version is 1.0.7, and its release cadence is tied to the LangChain ecosystem, implying active development and frequent updates.

pip install langgraph-checkpoint-aws
INSTALL
IMPORT
SIG · LANGGRAPH-CHECKPOI
L
langgraph-checkpoint-aws
llm-agentspythonv1.1.0
Install
9.6s avg
Import
Disk
107MB
Pass rate
10/ 10
Env Coverage10 / 10
glibc
3.93.13
musl
3.93.13
Install & Compatibility
Where this runs
tested against v1.1.0 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
py 3.103.920 runs
installs and imports cleanly · install 0.0s · import 0.000s · 104.4MB
glibc
py 3.103.920 runs
installs and imports cleanly · install 9.6s · import 0.000s · 112MB
107MB installed
● package 107MB
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

BedrockSessionSaver
from langgraph_checkpoint_aws import BedrockSessionSaver
from langgraph_checkpoint_aws import AWSSessionManagerValkeySaver
AsyncBedrockSessionSaver
from langgraph_checkpoint_aws import AsyncBedrockSessionSaver
DynamoDBSaver
from langgraph_checkpoint_aws import DynamoDBSaver

This quickstart demonstrates how to initialize `AWSSessionManagerValkeySaver` and integrate it with a basic LangGraph `StateGraph`. It requires AWS credentials configured in your environment (e.g., via `~/.aws/credentials` or environment variables) and a running Redis/Valkey instance accessible via `REDIS_URL`. The example simulates two runs to show how `thread_id` is used with the checkpointer to persist and retrieve state.

import os import redis import boto3 from langgraph.graph import StateGraph, START from langgraph.checkpoint.base import Checkpoint from langgraph_checkpoint_aws import AWSSessionManagerValkeySaver # 1. Setup AWS client (ensure AWS credentials are configured, e.g., via ~/.aws/credentials or env vars) # The Checkpointer primarily uses DynamoDB via Bedrock Session Management Service. aws_region = os.environ.get("AWS_REGION", "us-east-1") boto3_session = boto3.Session(region_name=aws_region) # 2. Setup Valkey/Redis client # Ensure a Redis/Valkey instance is running and accessible (e.g., local or ElastiCache) redis_url = os.environ.get("REDIS_URL", "redis://localhost:6379/0") try: redis_client = redis.from_url(redis_url) redis_client.ping() # Test connection except redis.exceptions.ConnectionError: print(f"WARNING: Could not connect to Redis at {redis_url}. Please ensure a Redis/Valkey instance is running.") redis_client = None # Mark as failed # 3. Define a simple LangGraph state class AgentState(dict): """A dictionary-like state for the graph.""" pass # 4. Instantiate the AWSSessionManagerValkeySaver # 'application_id' is used to partition state within Bedrock SMS/DynamoDB. application_id = os.environ.get("AWS_APPLICATION_ID", "my_langgraph_app_dev") if redis_client: checkpointer = AWSSessionManagerValkeySaver( boto3_session=boto3_session, redis_client=redis_client, application_id=application_id # Optional: You can specify a custom DynamoDB table name if not using the default Bedrock SMS table. # table_name="MyCustomLangGraphCheckpoints" ) # 5. Build a simple LangGraph with the checkpointer graph_builder = StateGraph(AgentState) graph_builder.add_node("start_node", lambda state: {"message": "Hello from LangGraph!"}) graph_builder.set_entry_point("start_node") graph_builder.set_finish_point("start_node") # Compile the graph with the checkpointer app = graph_builder.compile(checkpointer=checkpointer) # 6. Run the graph with a configurable thread_id for checkpointing thread_id = "unique_session_123" config = {"configurable": {"thread_id": thread_id}} print(f"Running LangGraph with checkpointer for thread_id: {thread_id}") # The first run will create a checkpoint result = app.invoke({}, config=config) print(f"First run output: {result}") # Subsequent runs with the same thread_id will load the checkpoint # (in a more complex graph, state would be loaded and updated) result_again = app.invoke({}, config=config) print(f"Second run output (should be same for this simple graph): {result_again}") print("\nSuccessfully configured AWSSessionManagerValkeySaver and ran a simple graph.") print("Check your AWS Bedrock Session Manager (DynamoDB) and Valkey/Redis instance for stored state.") else: print("Checkpointer instantiation skipped due to Redis connection failure.") print("Please ensure REDIS_URL and AWS credentials are correctly configured.")
Debug
Known issues
gotchaEnsure AWS credentials and necessary IAM permissions are configured for your environment. The checkpointer interacts with AWS DynamoDB (via Bedrock Session Management Service) and potentially other AWS services. Missing permissions (e.g., `dynamodb:PutItem`, `dynamodb:GetItem`, `dynamodb:UpdateItem`) will lead to `AccessDeniedException` errors.
fix
Configure AWS credentials (e.g., `~/.aws/credentials`, environment variables like `AWS_ACCESS_KEY_ID`, `AWS_SECRET_ACCESS_KEY`) and ensure the IAM role/user has appropriate permissions for DynamoDB actions on the Bedrock Session Manager table or a custom table if specified.
affects: All versions
gotchaThe checkpointer requires a running and accessible Redis or Valkey instance. Connection errors (`redis.exceptions.ConnectionError`) are common if the host, port, or password are incorrect, or if the instance is not running or is behind a firewall.
fix
Verify the `redis_client` connection parameters (host, port, password, URL) passed to `AWSSessionManagerValkeySaver`. Ensure the Redis/Valkey server is running and network accessible from where your application is executing. Use `redis.from_url` with a full URL like `redis://user:password@host:port/db`.
affects: All versions
gotchaThe `application_id` parameter for `AWSSessionManagerValkeySaver` is crucial for partitioning state within Bedrock Session Management Service (DynamoDB). Using different `application_id` values will result in separate state storage for the same `thread_id`.
fix
Consistently use the same `application_id` across all instances of your LangGraph application that should share the same state. Consider using environment variables or a configuration file to manage this value.
affects: All versions
Upgrade
Version history
1.1.0latest on PyPI · released Jun 2, 2026
Audit
Dependencies
langchain-awsrequiredProvides core AWS integrations for LangChain/LangGraph.
boto3requiredOfficial AWS SDK for Python, used for interacting with AWS services like DynamoDB (via Bedrock SMS).
redisrequiredPython client for Redis, used for Valkey (Redis-compatible) state management.
valkey-pyrequiredPython client for Valkey, also used for Valkey (Redis-compatible) state management.
Agent activity
23 hits · last 30 days
node
20
OpenAI (training)
1
Resources
langgraph-checkpoint-aws — pip install langgraph-checkpoint-aws · libregistry