LangChain and Elasticsearch: Building LangGraph retrieval agent template

Elasticsearch and LangChain collaborate on a new retrieval agent template for LangGraph for agentic apps

The new LangGraph retrieval agent template is designed to simplify the development of Generative AI (GenAI) agentic applications that require agents to use Elasticsearch for agentic retrieval. This template comes pre-configured to use Elasticsearch, allowing developers to build agents with LangChain and Elasticsearch quickly.

To get started right away, access the project on Github: https://github.com/langchain-ai/retrieval-agent-template

What is LangGraph?

LangGraph helps developers build stateful, multi-actor applications with LLMs, used to create agent and multi-agent workflows. There are a few new concepts to learn, like cycles, branching, and persistence – these allow developers to implement loops, conditions, and error handling mechanisms in applications. This makes LangGraph a great choice for creating complex workflows, where agents can pause for user input or correction. For more details you can check the Intro to LangGraph course on LangChain Academy.

The new Retrieval Agent Template focuses on question-answering tasks by leveraging knowledge retrieval with Elasticsearch. Users can set up agents capable of retrieving relevant information based on natural language queries. The template provides an easy, configurable interface to Elasticsearch, making it a great starting point for developers looking to build search retrieval-based agents​.

About LangGraph’s default Elasticsearch template

Elasticsearch Vector Database Capabilities: The template leverages Elasticsearch’s Vector Storage and Search capabilities to enable more precise and relevant knowledge retrieval.

Retrieval Agent Capability: This enables an agent to use Retrieval-Augmented Generation (RAG), helping Large Language Models (LLMs) provide more accurate and context-rich answers by retrieving the most relevant information from data stored within Elasticsearch.

Integration with LangGraph Studio: With LangGraph Studio, developers can better understand and build complex agentic applications. It provides intuitive visualization and debugging tools in a user-friendly interface, making it easier to develop, optimize, and troubleshoot AI applications.

Start building with LangGraph retrieval agent template

Elastic and LangChain are excited to give developers a headstart building the next generation of intelligent, knowledge-driven AI agents using this template.

Access the retrieval agent template on GitHub, or visit Search Labs for cookbooks using Elasticsearch and LangChain. Happy searching agenting!

Ready to try this out on your own? Start a free trial.

Elasticsearch has integrations for tools from LangChain, Cohere and more. Join our Beyond RAG Basics webinar to build your next GenAI app!

Related content

What is Context Engineering?

September 4, 2025

What is Context Engineering?

Have you heard of this new term context engineering, but aren't sure what it is? Join us as we explain what it is and how RAG with Elasticsearch can help.

Using ES|QL COMPLETION + an LLM to write a Chuck Norris fact generator in 5 minutes

August 28, 2025

Using ES|QL COMPLETION + an LLM to write a Chuck Norris fact generator in 5 minutes

Discover how to use the ES|QL COMPLETION command to turn your Elasticsearch data into creative output using an LLM in just a few lines of code.

Building intelligent duplicate detection with Elasticsearch and AI

Building intelligent duplicate detection with Elasticsearch and AI

Explore how organizations can leverage Elasticsearch to detect and handle duplicates in loan or insurance applications.

LlamaIndex and Elasticsearch Rerankers: Unbeatable simplicity

July 24, 2025

LlamaIndex and Elasticsearch Rerankers: Unbeatable simplicity

Learn how to transition from Llamaindex RankGPT reranker to Elastic built-in semantic reranker.

Longer context ≠ better: Why RAG still matters

July 11, 2025

Longer context ≠ better: Why RAG still matters

Learn why the RAG strategy is still relevant and gives the most efficient and better results.

Ready to build state of the art search experiences?

Sufficiently advanced search isn’t achieved with the efforts of one. Elasticsearch is powered by data scientists, ML ops, engineers, and many more who are just as passionate about search as your are. Let’s connect and work together to build the magical search experience that will get you the results you want.

Try it yourself