How-to guides¶
Here you’ll find answers to “How do I...?” types of questions. These guides are goal-oriented and concrete; they're meant to help you complete a specific task. For conceptual explanations see the Conceptual guide. For end-to-end walk-throughs see Tutorials. For comprehensive descriptions of every class and function see the API Reference.
Installation¶
LangGraph¶
Controllability¶
LangGraph.js is known for being a highly controllable agent framework. These how-to guides show how to achieve that controllability.
- How to create branches for parallel execution
- How to create map-reduce branches for parallel execution
Persistence¶
LangGraph.js makes it easy to persist state across graph runs. The guides below shows how to add persistence to your graph.
- How to add thread-level persistence to your graph
- How to add thread-level persistence to subgraphs
- How to add cross-thread persistence
- How to use a Postgres checkpointer for persistence
Memory¶
LangGraph makes it easy to manage conversation memory in your graph. These how-to guides show how to implement different strategies for that.
- How to manage conversation history
- How to delete messages
- How to add summary of the conversation history
Human-in-the-loop¶
One of LangGraph.js's main benefits is that it makes human-in-the-loop workflows easy. These guides cover common examples of that.
- How to add breakpoints
- How to add dynamic breakpoints
- How to edit graph state
- How to wait for user input
- How to view and update past graph state
- How to review tool calls
Streaming¶
LangGraph is built to be streaming first. These guides show how to use different streaming modes.
- How to stream the full state of your graph
- How to stream state updates of your graph
- How to stream LLM tokens
- How to stream LLM tokens without LangChain models
- How to stream custom data
- How to configure multiple streaming modes
- How to stream events from within a tool
- How to stream from the final node
Tool calling¶
- How to call tools using ToolNode
- How to force an agent to call a tool
- How to handle tool calling errors
- How to pass runtime values to tools
Subgraphs¶
Subgraphs allow you to reuse an existing graph from another graph. These how-to guides show how to use subgraphs:
- How to add and use subgraphs
- How to view and update state in subgraphs
- How to transform inputs and outputs of a subgraph
State management¶
- How to define graph state
- Have a separate input and output schema
- Pass private state between nodes inside the graph
Other¶
- How to add runtime configuration to your graph
- How to add node retries
- How to let agent return tool results directly
- How to have agent respond in structured format
- How to manage agent steps
Prebuilt ReAct Agent¶
- How to create a ReAct agent
- How to add memory to a ReAct agent
- How to add a system prompt to a ReAct agent
- How to add Human-in-the-loop to a ReAct agent
LangGraph Platform¶
This section includes how-to guides for LangGraph Platform.
LangGraph Platform is a commercial solution for deploying agentic applications in production, built on the open-source LangGraph framework. It provides four deployment options to fit a range of needs: a free tier, a self-hosted version, a cloud SaaS, and a Bring Your Own Cloud (BYOC) option. You can explore these options in detail in the deployment options guide.
Tip
- LangGraph is an MIT-licensed open-source library, which we are committed to maintaining and growing for the community.
- You can always deploy LangGraph applications on your own infrastructure using the open-source LangGraph project without using LangGraph Platform.
Application Structure¶
Learn how to set up your app for deployment to LangGraph Platform:
- How to set up app for deployment (requirements.txt)
- How to set up app for deployment (pyproject.toml)
- How to set up app for deployment (JavaScript)
- How to customize Dockerfile
- How to test locally
Deployment¶
LangGraph applications can be deployed using LangGraph Cloud, which provides a range of services to help you deploy, manage, and scale your applications.
- How to deploy to LangGraph cloud
- How to deploy to a self-hosted environment
- How to interact with the deployment using RemoteGraph
Assistants¶
Assistants are a configured instance of a template.
Threads¶
Runs¶
LangGraph Cloud supports multiple types of runs besides streaming runs.
- How to run an agent in the background
- How to run multiple agents in the same thread
- How to create cron jobs
- How to create stateless runs
Streaming¶
Streaming the results of your LLM application is vital for ensuring a good user experience, especially when your graph may call multiple models and take a long time to fully complete a run. Read about how to stream values from your graph in these how to guides:
- How to stream values
- How to stream updates
- How to stream messages
- How to stream events
- How to stream in debug mode
- How to stream multiple modes
Human-in-the-loop¶
When creating complex graphs, leaving every decision up to the LLM can be dangerous, especially when the decisions involve invoking certain tools or accessing specific documents. To remedy this, LangGraph allows you to insert human-in-the-loop behavior to ensure your graph does not have undesired outcomes. Read more about the different ways you can add human-in-the-loop capabilities to your LangGraph Cloud projects in these how-to guides:
- How to add a breakpoint
- How to wait for user input
- How to edit graph state
- How to replay and branch from prior states
- How to review tool calls
Double-texting¶
Graph execution can take a while, and sometimes users may change their mind about the input they wanted to send before their original input has finished running. For example, a user might notice a typo in their original request and will edit the prompt and resend it. Deciding what to do in these cases is important for ensuring a smooth user experience and preventing your graphs from behaving in unexpected ways. The following how-to guides provide information on the various options LangGraph Cloud gives you for dealing with double-texting:
- How to use the interrupt option
- How to use the rollback option
- How to use the reject option
- How to use the enqueue option
Webhooks¶
Cron Jobs¶
LangGraph Studio¶
LangGraph Studio is a built-in UI for visualizing, testing, and debugging your agents.
- How to connect to a LangGraph Cloud deployment
- How to connect to a local deployment
- How to test your graph in LangGraph Studio
- How to interact with threads in LangGraph Studio
Troubleshooting¶
These are the guides for resolving common errors you may find while building with LangGraph. Errors referenced below will have an lc_error_code
property corresponding to one of the below codes when they are thrown in code.