diff --git a/src/oss/python/integrations/providers/aws.mdx b/src/oss/python/integrations/providers/aws.mdx index e98405e30..6c88fd51d 100644 --- a/src/oss/python/integrations/providers/aws.mdx +++ b/src/oss/python/integrations/providers/aws.mdx @@ -177,6 +177,63 @@ See a [usage example](/oss/integrations/document_loaders/glue_catalog). from langchain_community.document_loaders.glue_catalog import GlueCatalogLoader ``` +## Memory +> You can use AWS databases to store `LangGraph` checkpointers. These could include `Amazon DynamoDB`, `Amazon Aurora`, or `ElastiCache for Valkey`. +> To use these, install the `langgraph-checkpoint-aws` library: + + + ```bash pip + pip install langgraph-checkpoint-aws + ``` + + ```bash uv + uv add langgraph-checkpoint-aws + ``` + + +### Overview +> LangGraph checkpointers are used to save the state of a LangGraph thread at its current point in time. +> This allows you to pause and resume threads, or to recover from failures without losing progress. +> Refer to the [LangGraph Checkpointers documentation](/guides/langgraph/checkpointers/) for more information. + +### DynamoDB Checkpointer +> If your preferred database is DynamoDB, you can integrate the Dynamo DB Checkpointer for LangGraph. + +> See a [usage example](https://github.com/langchain-ai/langchain-aws/blob/main/libs/langgraph-checkpoint-aws/README.md#4-dynamodb-checkpoint-storage), +> and for a demo, refer to this [Jupiter Notebook](https://github.com/langchain-ai/langchain-aws/blob/main/samples/memory/dynamodb_saver.ipynb). + +### Valkey Checkpointer +> If your preferred database is ElastiCache for Valkey, you can integrate the Valkey Checkpointer for LangGraph. + +> See a [usage example](https://github.com/langchain-ai/langchain-aws/blob/main/libs/langgraph-checkpoint-aws/README.md#5-valkey-checkpoint-storage), +> and for a demo, refer to this [Jupiter Notebook](https://github.com/langchain-ai/langchain-aws/blob/main/samples/memory/valkey_saver.ipynb) + +### Aurora Checkpointer +> If your preferred database is `Amazon Aurora`, you can integrate the `Postgres` Checkpointer for LangGraph. +> To use this checkpointer you'll need to install the `langgraph-checkpoint-postgres` library: + + + ```bash pip + pip install langgraph-checkpoint-postgres + ``` + + ```bash uv + uv add langgraph-checkpoint-postgres + ``` + + +> A simple example of using the `PostgresSaver` checkpointer instance is shown below (without connection pooling): + + ```python + from langgraph.checkpoint.postgres import PostgresSaver + + with PostgresSaver.from_conn_string(os.getenv("DB_URI")) as checkpointer: + # use the checkpointer + ``` + + +> See the [reference documentation](https://reference.langchain.com/python/langgraph/checkpoints/#langgraph.checkpoint.postgres) for details. + ## Vector stores ### Amazon OpenSearch Service @@ -259,6 +316,53 @@ vds = InMemoryVectorStore.from_documents( ``` See a [usage example](/oss/integrations/vectorstores/memorydb). +### Amazon ElastiCache for Valkey + +[Amazon ElastiCache for Valkey](https://docs.aws.amazon.com/AmazonElastiCache/latest/dg/engine-versions.html) is a fully +managed, Valkey-compatible caching service that delivers ultra-fast performance. Valkey supports native vector search +capabilities to store, index and search over vector embeddings with microsecond latency an up to 99% recall. + +We need to install the `langchain-aws` and `valkey-glide` packages: + + +```bash pip + pip install langchain-aws valkey-glide +``` + +```bash uv + uv add langchain-aws valkey-glide +``` + + +See an usage example [here](https://github.com/langchain-ai/langchain-aws/blob/main/libs/langgraph-checkpoint-aws/README.md#7-valkey-store-for-document-storage). + +For a demo reference, check [this Jupyter Notebook](https://github.com/langchain-ai/langchain-aws/blob/main/samples/memory/valkey_store.ipynb) + +### Amazon Aurora PostgreSQL (pgvector) + +[Amazon Aurora PostgreSQL-Compatible Edition](https://docs.aws.amazon.com/AmazonRDS/latest/AuroraUserGuide/AuroraPostgreSQL.Reference.html) with +the [pgvector](https://github.com/pgvector/pgvector) extension provides a powerful solution for storing and searching vector embeddings. `pgvector` adds +the ability to store, and search over ML-generated vector embeddings, supporting both exact and approximate near neighbor search. + +Developers can use Aurora PostgreSQL with `pgvector` as a unified store for both RAG retrieval and agentic long-term memory, +simplifying architecture by consolidating semantic search capabilities in a single managed database. + +To leverage this integration, we need to install the `langchain-postgres` package: + + +```bash pip + pip install langchain-postgres +``` + +```bash uv + uv add langchain-postgres +``` + + +Refer to [pgvector integration documentation](https://docs.langchain.com/oss/python/integrations/vectorstores/pgvector) for detailed usage instructions. + +For a comprehensive guide on using `pgvector` with Aurora PostgreSQL for RAG applications, consider reading [this AWS Blog post](https://aws.amazon.com/blogs/database/leverage-pgvector-and-amazon-aurora-postgresql-for-natural-language-processing-chatbots-and-sentiment-analysis/). + ## Retrievers ### Amazon Kendra