Skip to main content
This page covers all LangChain integrations with the Amazon Web Services (AWS) platform.

Chat models

Bedrock Mantle

The AWS Bedrock Mantle API exposes models through the OpenAI and Anthropic Messages protocols. ChatOpenAIMantle and ChatAnthropicMantle are the recommended interfaces for accessing these models. Both classes accept a Bedrock API key via the bedrock_api_key parameter or the AWS_BEARER_TOKEN_BEDROCK environment variable. When neither is available, both derive short-lived API keys from standard AWS credentials and refresh them transparently. ChatOpenAIMantle inherits from BaseChatOpenAI. See the corresponding Responses API docs for usage examples and capabilities. Refer to the AWS Mantle OpenAI-compatible API docs for supported models. ChatAnthropicMantle inherits from ChatAnthropic and targets the Anthropic Messages endpoint on Mantle. See the ChatAnthropic docs for usage examples and capabilities. Refer to the AWS Mantle Anthropic API docs for supported models.

Bedrock Converse

Amazon Bedrock is a fully managed service that offers a choice of high-performing foundation models (FMs) from leading AI companies like AI21 Labs, Anthropic, Cohere, Meta, OpenAI, Stability AI, and Amazon via a single API. Since Amazon Bedrock is serverless, you don’t have to manage any infrastructure, and you can securely integrate and deploy generative AI capabilities into your applications using the AWS services you are already familiar with.
AWS Bedrock maintains a Converse API that provides a unified conversational interface for Bedrock models. You can see a list of all models that are supported here. See a usage example.

Embedding models

Bedrock

See a usage example.

Vector stores

Amazon DynamoDB

Amazon DynamoDB is a fully managed NoSQL database. Use DynamoDBVectorStore to store documents as DynamoDB items and query them with a DynamoDB vector index, so operational data and retrieval share one table.

Amazon MemoryDB

Amazon MemoryDB is a durable, in-memory database service that delivers ultra-fast performance. MemoryDB is compatible with Redis OSS, a popular open source data store, enabling you to quickly build applications using the same flexible and friendly Redis OSS APIs, and commands that they already use today. InMemoryVectorStore class provides a vectorstore to connect with Amazon MemoryDB.
See a usage example.

Amazon S3 Vectors

Amazon S3 Vectors is cloud object storage with native support for storing and querying vectors. Use AmazonS3Vectors to store and query embeddings in an S3 vector bucket without provisioning infrastructure.
See a usage example.

Valkey

Valkey is an open source, high-performance key/value datastore that supports workloads such as caching, message queues, and can act as a primary database. Use ValkeyVectorStore to connect with Amazon ElastiCache for Valkey or Amazon MemoryDB for Valkey.
See a usage example.

Retrievers

Amazon Bedrock (Knowledge bases)

Knowledge bases for Amazon Bedrock is an Amazon Web Services (AWS) offering which lets you quickly build RAG applications by using your private data to customize foundation model response.
We need to install the langchain-aws library.
See a usage example.

Tools

Amazon Bedrock AgentCore Browser

Amazon Bedrock AgentCore Browser enables agents to interact with web pages through a managed Chrome browser for navigation, content extraction, and web automation.
See a usage example.

Amazon Bedrock AgentCore Code Interpreter

Amazon Bedrock AgentCore Code Interpreter enables agents to execute Python, JavaScript, and TypeScript code in secure, managed sandbox environments for calculations, data analysis, and visualizations.
See a usage example.
Amazon Bedrock AgentCore Web Search gives agents current information from the web with a source URL on every result, authenticated with your AWS credentials rather than a search API key. By default, the toolkit calls the Web Search API directly.
See a usage example.

Sandboxes

AgentCoreSandbox

Amazon Bedrock AgentCore Code Interpreter sandbox backend for deepagents.

Graphs

Amazon neptune

Amazon Neptune is a high-performance graph analytics and serverless database for superior scalability and availability.
For the Cypher and SPARQL integrations below, we need to install the langchain-aws library.

Amazon neptune with cypher

See a usage example.

Amazon neptune with SPARQL

Memory

Amazon Bedrock AgentCore Memory

Amazon Bedrock AgentCore Memory provides managed persistence for LangGraph agents, enabling conversation history and state management across sessions with automatic scaling and high availability.
Key features:
  • Managed infrastructure with no database setup required
  • Automatic scaling and high availability
  • Multi-agent support via actor_id isolation
  • Encryption at rest and in transit

Amazon Bedrock AgentCore Memory Store

Amazon Bedrock AgentCore Memory Store provides long-term memory with semantic search capabilities for LangGraph agents, enabling storage and retrieval of user preferences, facts, and extracted memories across sessions.

Chains

Amazon Comprehend moderation chain

Amazon Comprehend is a natural-language processing (NLP) service that uses machine learning to uncover valuable insights and connections in text.
We need to install the boto3 and nltk libraries.
The langchain-experimental package is no longer maintained. Examples that import from langchain_experimental may be outdated or broken. Use with caution.

Runtime

Amazon Bedrock AgentCore Runtime

Amazon Bedrock AgentCore Runtime provides managed, serverless execution for LangGraph agents with built-in observability, automatic scaling, and seamless integration with other AgentCore services.
Deployment uses two packages that install separately: the bedrock-agentcore Python SDK, which wraps a compiled graph in a runtime entrypoint, and the AgentCore CLI, which packages the project and deploys it. Install the SDK:
Wrap your compiled graph in an entrypoint:
Install the AgentCore CLI, which ships as an npm package:
The AgentCore CLI requires Node.js 20.12 or later, and its Python projects require uv. If a Python agentcore command is already on your PATH, it shadows the npm one, because both use the same command name. Uninstall the Python command, then open a new terminal.
Create a project from the LangChain template, then deploy and invoke the agent:
The agent-python-langchain template scaffolds a graph built with create_agent in app/agent/, along with a pyproject.toml and a CDK project under agentcore/. To deploy an entrypoint you wrote yourself, add an empty Python runtime to the project:
Put your entrypoint in app/MyAgent/main.py with a pyproject.toml next to it, then run agentcore deploy. The CLI reads your code and updates agentcore/agentcore.json on each dev, build, and deploy. For more information, see Get started with the AgentCore CLI. The agent-python-langchain template already declares the dependencies that traces require. For your own entrypoint, pyproject.toml must declare the AWS Distro for OpenTelemetry (ADOT), because AgentCore Runtime starts the entrypoint under opentelemetry-instrument. Add the LangChain instrumentor as well to render traces in CloudWatch generative AI observability:
ADOT discovers the instrumentor at startup, so the agent needs no instrumentation code. Deployments that the CLI manages run the entrypoint under opentelemetry-instrument already. To reproduce that locally, run:
For more information, see Set up LangGraph telemetry for AgentCore.
⌂ 换网址