LangChain Templates

LangChain Templates

6 min read

Today we're excited to announce the release of LangChain Templates. LangChain Templates offers a collection of easily deployable reference architectures that anyone can use. We've worked with some of our partners to create a set of easy-to-use templates to help developers get to production more quickly. We will continue to add to this over time. This is a new way to create, share, maintain, download, and customize chains and agents. They are all in a standard format with allows them to easily be deployed with LangServe, allowing you to easily get production-ready APIs and a playground for free.

Quick Start: Go here for a guide on how to get started with LangChain Templates.

YouTube Walkthrough: We filmed a quick walkthrough of how to use LangChain Templates.

LangSmith: LangChain Templates seamlessly integrate with LangSmith - our logging and debugging tool. Sign up here.

Hosted LangServe: We will be releasing a hosted version of LangServe for one-click deployments of LangChain applications. Sign up here.

Additional Resources

Featured Templates: Explore the many templates available to use - from advanced RAG to agents.

All Templates: Explore all templates available.

Contributing: Want to contribute your own template? It's pretty easy! These instructions walk through how to do that.

LangServe: Learn more about the best way to deploy LangChain chains and agents.

LangServe Webinar: We will be doing a webinar this Thursday to discuss more about LangServe and LangChain Templates. Register here.


What was our motivation LangChain Templates? These templates can be either chains or agents, and represent a full-features context-aware reasoning applications. Over time we've seen:

  • Developers want to create many different types of applications
  • Developers want to better understand internals of applications
  • Developers want to modify internal of applications
  • Developers want an easy way to deploy application

Developers want to create many different types of applications

We've recently seen a proliferation of chains and agents being added to LangChain. There are a few different flavors:

  • Tool specific chains
  • Language model specific chains
  • New architectures

It's natural that all these types of chains are added, and says something about the current state of the field.

Tool Specific Chains

We are seeing a lot of chains/agents aimed at best interacting with particular tools. This is consistent with what we know about language models: they are fantastic generalists, so of course it makes sense that we would want to use with different tools. The exact chain/agent that makes the most sense for one particular tool may actually differ subtly from another

Language Model Specific Chains

We are seeing that not all language models are interchangeable for all tasks. At the most obvious level, they may require different prompts. But they may also require different output parsing, maybe even slightly different context to be provided.

New Architectures

We are seeing new architectures emerge for how best to build applications. We will discuss this in a future post. This implies the field is still very early and people are trying to figure out how best to work with language models.

This had lead to a proliferation of chains and agents getting contributed to LangChain. We realized a while ago we couldn't accept every possible variation (or LangChain would become incredibly bloated). We started moving more and more to cookbooks, but those aren't as discoverable or as usable.

Developers want to understand internals of applications

While it's convenient to have an entire chain wrapped up in a class, it does obfuscate what exactly is going on inside. We've introduced LangSmith to help with debugging and observability, and while that helps it's not the same as being able to easily see that code.

Developers want to modify internals of applications

We've seen a lot of developers wanting to modify the internals of chains. This could be changing some of the orchestration, changing some of the context loading, changing some of the prompts. This is extremely related to the first point.

As such we've seen a lot of people fork LangChain and modify the code internally. Some of them open up a PR with more minor changes for prompts/output parsers. This raises an interesting challenge for us though: it's extremely tough to evaluate language model applications, so even though these prompt/output parser changes may be helpful for one person's application, we're hesitant to merge these in for fear that it may affect some other unsuspecting user.

Developers want an easy way to deploy chains

There are two drivers here.

One driver: we see that one of the things that successful teams do is deploy an application quickly, to gather user interaction data. This user interaction data is useful for many purposes.

  • First: are people even interacting with it? If no, then that may imply this particular product/feature does not have product market fit and you'd want to investigate that.
  • Second: how are people using? If they are using it in unexpected ways, that may change some of the focus for development.
  • Third: where is the chain not performing well? It's often tough to now how exactly to improve the chain without seeing concrete datapoints on where is performing well.

Therefore, the faster we can allow teams to deploy their applications, the quicker they can iterate.

A second driver: a lot of organizations typically have not deployed Python applications in their infrastructure, and are looking for a battle-tested way to do so.

What are LangChain Templates

In response to the above, we began working on LangChain Templates. LangChain Templates offers a collection of easily deployable reference architectures that anyone can use. We have created a collection of end-to-end templates for creating different types of applications. These templates are in a standard format that makes them easy to deploy with LangServe. We've also exposed an easy way to create new projects and load templates in.

How you consume these modules? You can first create a project, which contains a folder for chains. You can then easily download a module into a that application project. You can easily inspect and modify a chain (since it is being downloaded, rather than pip installed). You can then deploy the whole project using langserve.

What is in LangChain Templates

One of the things that we are most excited about with LangChain Templates is that it enables us to much more easily add a variety of chains and agents. Some of the ones we're particularly excited by:

OSS Models

We've heard a lot that LangChain seems OpenAI-centric. That is not our intention, but it is true that the default prompts for most chains are designed to work will with OpenAI. With LangChain Templates, we're incredibly excited to be able to add templates that work best for other models - especially open source. We've already added some for RAG and SQL-question-answering, and we're excited to add more.

Advanced RAG

There are a lot of different methods and algorithms for advanced RAG, and we're excited to be able to highlight them more properly. We've added templates for all the papers we highlighted last week in our blog post on Query Transformations. We've also worked with partners to take some of the heuristics we've developed (like Parent Document Retriever) and get them to work with their database - see the Neo4J Parent Document Retriever template.

Use Case Specific Chains

We hope this opens the path for highlighting more and more use case specific chains. For example, we worked with Sphinx Bio to add a template aimed at identifying coordinates of plate data within a messy Excel file. Something like this would have been too specific to include in the core LangChain package, but fits perfectly here.

How does LangChain Templates solve the earlier problems?

Above we had listed out a few different problems we were observing. We think LangChain Templates goes a long way in addressing these problems.

Developers want to create many different types of applications

By adding templates for chains and agents in this format, we are no longer putting them in LangChain which should prevent bloat. This is also more organized and easier to work with than cookbooks.

Developers want to better understand internals of applications

By downloading chains (rather than pip - installing) the source code for chains and agents is right in your application. That makes it easy to inspect it.

Developers want to modify internal of applications

Again, by downloading chains (rather than pip - installing) the source code for chains and agents is right in your application. That makes it easy to modify it.

Developers want an easy way to deploy applications

All templates are in a standard format which makes it easy to deploy them with LangServe.


The goal of LangChain is to make it as easy as possible for developers to build context-aware reasoning applications. We believe this is a big step in that direction. We're incredibly grateful to our partners who have helped provide initial templates, and we look forward to working with the community to add more!

Big thank you to:

  • All our ecosystem partners who contributed templates
  • Jason Liu for suggesting this method of adding templates
  • Rajtilak Bhattacharjee for helping us with the langchain-cli package name
  • All our community members who helped test this: Greg Kamradt, Ryan Brandt, Misbah Syed, Hai, Lucas Hänke de Cansino, Hamel Husain