# LangGraph

## Quickstart

These guides are designed to help you get started with LangGraph.

- [LangGraph Quickstart](https://docs.langchain.com/oss/javascript/langgraph/tutorials/quickstart/): Build a chatbot that can use tools and keep track of conversation history. Add human-in-the-loop capabilities and explore how time-travel works.
- [Common Workflows](https://docs.langchain.com/oss/javascript/langgraph/tutorials/workflows/): Overview of the most common workflows using LLMs implemented with LangGraph.
- [LangGraph Server Quickstart](https://docs.langchain.com/oss/javascript/langgraph/tutorials/langgraph-platform/local-server/): Launch a LangGraph server locally and interact with it using REST API and LangGraph Studio Web UI.
- [Deploy with LangGraph Cloud Quickstart](https://docs.langchain.com/oss/javascript/langgraph/cloud/quick_start/): Deploy a LangGraph app using LangGraph Cloud.

## Concepts

These guides provide explanations of the key concepts behind the LangGraph framework.

- [Why LangGraph?](https://docs.langchain.com/oss/javascript/langgraph/concepts/high_level/): Motivation for LangGraph, a library for building agentic applications with LLMs.
- [LangGraph Glossary](https://docs.langchain.com/oss/javascript/langgraph/concepts/low_level/): LangGraph workflows are designed as graphs, with nodes representing different components and edges representing the flow of information between them. This guide provides an overview of the key concepts associated with LangGraph graph primitives.
- [Common Agentic Patterns](https://docs.langchain.com/oss/javascript/langgraph/concepts/agentic_concepts/): An agent uses an LLM to pick its own control flow to solve more complex problems! Agents are a key building block in many LLM applications. This guide explains the different types of agent architectures and how they can be used to control the flow of an application.
- [Multi-Agent Systems](https://docs.langchain.com/oss/javascript/langgraph/concepts/multi_agent/): Complex LLM applications can often be broken down into multiple agents, each responsible for a different part of the application. This guide explains common patterns for building multi-agent systems.
- [Breakpoints](https://docs.langchain.com/oss/javascript/langgraph/concepts/breakpoints/): Breakpoints allow pausing the execution of a graph at specific points. Breakpoints allow stepping through graph execution for debugging purposes.
- [Human-in-the-Loop](https://docs.langchain.com/oss/javascript/langgraph/concepts/human_in_the_loop/): Explains different ways of integrating human feedback into a LangGraph application.
- [Time Travel](https://docs.langchain.com/oss/javascript/langgraph/concepts/time-travel/): Time travel allows you to replay past actions in your LangGraph application to explore alternative paths and debug issues.
- [Persistence](https://docs.langchain.com/oss/javascript/langgraph/concepts/persistence/): LangGraph has a built-in persistence layer, implemented through checkpointers. This persistence layer helps to support powerful capabilities like human-in-the-loop, memory, time travel, and fault-tolerance.
- [Memory](https://docs.langchain.com/oss/javascript/langgraph/concepts/memory/): Memory in AI applications refers to the ability to process, store, and effectively recall information from past interactions. With memory, your agents can learn from feedback and adapt to users' preferences.
- [Streaming](https://docs.langchain.com/oss/javascript/langgraph/concepts/streaming/): Streaming is crucial for enhancing the responsiveness of applications built on LLMs. By displaying output progressively, even before a complete response is ready, streaming significantly improves user experience (UX), particularly when dealing with the latency of LLMs.
- [Functional API](https://docs.langchain.com/oss/javascript/langgraph/concepts/functional_api/): `@entrypoint` and `@task` decorators that allow you to add LangGraph functionality to an existing codebase.
- [FAQ](https://docs.langchain.com/oss/javascript/langgraph/concepts/faq/): Frequently asked questions about LangGraph.

## How-tos

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.

### Fine-grained Control

These guides demonstrate LangGraph features that grant fine-grained control over the execution of your graph.

- [How to create map-reduce branches for parallel execution](https://docs.langchain.com/oss/javascript/langgraph/how-tos/map-reduce/)
- [How to update state and jump to nodes in graphs and subgraphs](https://docs.langchain.com/oss/javascript/langgraph/how-tos/command/)
- [How to defer node execution](https://docs.langchain.com/oss/javascript/langgraph/how-tos/defer-node-execution/)
- [How to add runtime configuration to your graph](https://docs.langchain.com/oss/javascript/langgraph/how-tos/configuration/)

### Persistence
 
Persistence makes it easy to persist state across graph runs (per-thread persistence) and across threads (cross-thread persistence). 

These how-to guides show how to add persistence to your graph.

- [How to add thread-level persistence to your graph](https://docs.langchain.com/oss/javascript/langgraph/how-tos/persistence/)
- [How to add thread-level persistence to a subgraph](https://docs.langchain.com/oss/javascript/langgraph/how-tos/subgraph-persistence/)
- [How to add cross-thread persistence to your graph](https://docs.langchain.com/oss/javascript/langgraph/how-tos/cross-thread-persistence/)
- [How to use Postgres checkpointer for persistence](https://docs.langchain.com/oss/javascript/langgraph/how-tos/persistence_postgres/)

See the below guides for how-to add persistence to your workflow using the [Functional API](https://docs.langchain.com/oss/javascript/langgraph/concepts/functional_api/):

- [How to add thread-level persistence (functional API)](https://docs.langchain.com/oss/javascript/langgraph/how-tos/persistence-functional/)
- [How to add cross-thread persistence (functional API)](https://docs.langchain.com/oss/javascript/langgraph/how-tos/cross-thread-persistence-functional/)

### 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](https://docs.langchain.com/oss/javascript/langgraph/how-tos/memory/manage-conversation-history/)
- [How to delete messages](https://docs.langchain.com/oss/javascript/langgraph/how-tos/memory/delete-messages/)
- [How to add summary conversation memory](https://docs.langchain.com/oss/javascript/langgraph/how-tos/memory/add-summary-conversation-history/)
- [How to add long-term memory (cross-thread)](https://docs.langchain.com/oss/javascript/langgraph/how-tos/memory/cross-thread-persistence/)
- [How to use semantic search for long-term memory](https://docs.langchain.com/oss/javascript/langgraph/how-tos/memory/semantic-search/)

### Human-in-the-loop

Human-in-the-loop functionality allows you to involve humans in the decision-making process of your graph.

These how-to guides show how to implement human-in-the-loop workflows in your graph.

- [How to wait for user input](https://docs.langchain.com/oss/javascript/langgraph/how-tos/human_in_the_loop/wait-user-input/): A basic example that shows how to implement a human-in-the-loop workflow in your graph using the `interrupt` function.
- [How to review tool calls](https://docs.langchain.com/oss/javascript/langgraph/how-tos/human_in_the_loop/review-tool-calls/): Incorporate human-in-the-loop for reviewing/editing/accepting tool call requests before they executed using the `interrupt` function.
- [How to add static breakpoints](https://docs.langchain.com/oss/javascript/langgraph/how-tos/human_in_the_loop/breakpoints/): Use for debugging purposes. For human-in-the-loop workflows, we recommend the [`interrupt` function](https://docs.langchain.com/oss/javascript/langgraph/reference/types/#langgraph.types.interrupt) instead.
- [How to edit graph state](https://docs.langchain.com/oss/javascript/langgraph/how-tos/human_in_the_loop/edit-graph-state/): Edit graph state using `graph.update_state` method. Use this if implementing a **human-in-the-loop** workflow via **static breakpoints**.

See the below guides for how-to implement human-in-the-loop workflows with the Functional API.

- [How to wait for user input (Functional API)](https://docs.langchain.com/oss/javascript/langgraph/how-tos/wait-user-input-functional/)
- [How to review tool calls (Functional API)](https://docs.langchain.com/oss/javascript/langgraph/how-tos/review-tool-calls-functional/)

### Time Travel

[Time travel](https://docs.langchain.com/oss/javascript/langgraph/concepts/time-travel/) allows you to replay past actions in your LangGraph application to explore alternative paths and debug issues. These how-to guides show how to use time travel in your graph.

- [How to view and update past graph state](https://docs.langchain.com/oss/javascript/langgraph/how-tos/time-travel/)

### Streaming

[Streaming](https://docs.langchain.com/oss/javascript/langgraph/concepts/streaming/) is crucial for enhancing the responsiveness of applications built on LLMs. By displaying output progressively, even before a complete response is ready, streaming significantly improves user experience (UX), particularly when dealing with the latency of LLMs.

- [How to stream the full state of your graph](https://docs.langchain.com/oss/javascript/langgraph/how-tos/stream-values/)
- [How to stream state updates of your graph](https://docs.langchain.com/oss/javascript/langgraph/how-tos/stream-updates/)
- [How to stream LLM tokens](https://docs.langchain.com/oss/javascript/langgraph/how-tos/stream-tokens/)
- [How to stream LLM tokens without LangChain models](https://docs.langchain.com/oss/javascript/langgraph/how-tos/streaming-tokens-without-langchain/)
- [How to stream custom data](https://docs.langchain.com/oss/javascript/langgraph/how-tos/streaming-content/)
- [How to configure multiple streaming modes](https://docs.langchain.com/oss/javascript/langgraph/how-tos/stream-multiple/)
- [How to stream events from within a tool](https://docs.langchain.com/oss/javascript/langgraph/how-tos/streaming-events-from-within-tools/)
- [How to stream from the final node](https://docs.langchain.com/oss/javascript/langgraph/how-tos/streaming-from-final-node/)

### Tool calling

- [How to call tools using ToolNode](https://docs.langchain.com/oss/javascript/langgraph/how-tos/tool-calling/)
- [How to force an agent to call a tool](https://docs.langchain.com/oss/javascript/langgraph/how-tos/force-calling-a-tool-first/)
- [How to handle tool calling errors](https://docs.langchain.com/oss/javascript/langgraph/how-tos/tool-calling-errors/)
- [How to pass runtime values to tools](https://docs.langchain.com/oss/javascript/langgraph/how-tos/pass-run-time-values-to-tools/)
- [How to update graph state from tools](https://docs.langchain.com/oss/javascript/langgraph/how-tos/update-state-from-tools/)

### Subgraphs

[Subgraphs](https://docs.langchain.com/oss/javascript/langgraph/concepts/low_level/#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](https://docs.langchain.com/oss/javascript/langgraph/how-tos/subgraph/)
- [How to view and update state in subgraphs](https://docs.langchain.com/oss/javascript/langgraph/how-tos/subgraphs-manage-state/)
- [How to transform inputs and outputs of a subgraph](https://docs.langchain.com/oss/javascript/langgraph/how-tos/subgraph-transform-state/)

### Multi-agent

- [How to build a multi-agent network](https://docs.langchain.com/oss/javascript/langgraph/how-tos/multi-agent-network/)
- [How to add multi-turn conversation in a multi-agent application](https://docs.langchain.com/oss/javascript/langgraph/how-tos/multi-agent-multi-turn-convo/)

See the [multi-agent tutorials](https://docs.langchain.com/oss/javascript/langgraph/tutorials/index/#multi-agent-systems) for implementations of other multi-agent architectures.

See the below guides for how-to implement multi-agent workflows with the [Functional API](https://docs.langchain.com/oss/javascript/langgraph/concepts/functional_api/):

- [How to build a multi-agent network (functional API)](https://docs.langchain.com/oss/javascript/langgraph/how-tos/multi-agent-network-functional/)
- [How to add multi-turn conversation in a multi-agent application (functional API)](https://docs.langchain.com/oss/javascript/langgraph/how-tos/multi-agent-multi-turn-convo-functional/)

### State management

- [How to define graph state](https://docs.langchain.com/oss/javascript/langgraph/how-tos/define-state/)
- [Have a separate input and output schema](https://docs.langchain.com/oss/javascript/langgraph/how-tos/input_output_schema/)
- [Pass private state between nodes inside the graph](https://docs.langchain.com/oss/javascript/langgraph/how-tos/pass_private_state/)

### Other

- [How to add runtime configuration to your graph](https://docs.langchain.com/oss/javascript/langgraph/how-tos/configuration/)
- [How to add node retries](https://docs.langchain.com/oss/javascript/langgraph/how-tos/node-retry-policies/)
- [How to cache expensive nodes](https://docs.langchain.com/oss/javascript/langgraph/how-tos/node-caching/)
- [How to let an agent return tool results directly](https://docs.langchain.com/oss/javascript/langgraph/how-tos/dynamically-returning-directly/)
- [How to have an agent respond in structured format](https://docs.langchain.com/oss/javascript/langgraph/how-tos/respond-in-format/)
- [How to manage agent steps](https://docs.langchain.com/oss/javascript/langgraph/how-tos/managing-agent-steps/)

### Prebuilt ReAct Agent

- [How to create a ReAct agent](https://docs.langchain.com/oss/javascript/langgraph/how-tos/create-react-agent/)
- [How to add memory to a ReAct agent](https://docs.langchain.com/oss/javascript/langgraph/how-tos/react-memory/)
- [How to add a system prompt to a ReAct agent](https://docs.langchain.com/oss/javascript/langgraph/how-tos/react-system-prompt/)
- [How to add Human-in-the-loop to a ReAct agent](https://docs.langchain.com/oss/javascript/langgraph/how-tos/react-human-in-the-loop/)
- [How to return structured output from a ReAct agent](https://docs.langchain.com/oss/javascript/langgraph/how-tos/react-return-structured-output/)

See the below guide for how-to build ReAct agents with the [Functional API](https://docs.langchain.com/oss/javascript/langgraph/concepts/functional_api/):

- [How to create a ReAct agent from scratch (Functional API)](https://docs.langchain.com/oss/javascript/langgraph/how-tos/react-agent-from-scratch-functional/)

## 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](https://docs.langchain.com/oss/javascript/langgraph/concepts/deployment_options/).

!!! 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)](https://docs.langchain.com/oss/javascript/langgraph/cloud/deployment/setup/)
- [How to set up app for deployment (pyproject.toml)](https://docs.langchain.com/oss/javascript/langgraph/cloud/deployment/setup_pyproject/)
- [How to set up app for deployment (JavaScript)](https://docs.langchain.com/oss/javascript/langgraph/cloud/deployment/setup_javascript/)
- [How to customize Dockerfile](https://docs.langchain.com/oss/javascript/langgraph/cloud/deployment/custom_docker/)
- [How to test locally](https://docs.langchain.com/oss/javascript/langgraph/cloud/deployment/test_locally/)
- [How to integrate LangGraph into your React application](https://docs.langchain.com/oss/javascript/langgraph/cloud/how-tos/use_stream_react/)

### 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](https://docs.langchain.com/oss/javascript/langgraph/cloud/deployment/cloud/)
- [How to deploy to a self-hosted environment](https://docs.langchain.com/oss/javascript/langgraph/how-tos/deploy-self-hosted/)
- [How to interact with the deployment using RemoteGraph](https://docs.langchain.com/oss/javascript/langgraph/how-tos/use-remote-graph/)

### Assistants

[Assistants](https://docs.langchain.com/oss/javascript/langgraph/concepts/assistants/) are a configured instance of a template.

- [How to configure agents](https://docs.langchain.com/oss/javascript/langgraph/cloud/how-tos/configuration_cloud/)
- [How to version assistants](https://docs.langchain.com/oss/javascript/langgraph/cloud/how-tos/assistant_versioning/)

### Threads

- [How to copy threads](https://docs.langchain.com/oss/javascript/langgraph/cloud/how-tos/copy_threads/)
- [How to check status of your threads](https://docs.langchain.com/oss/javascript/langgraph/cloud/how-tos/check_thread_status/)

### Runs

LangGraph Cloud supports multiple types of runs besides streaming runs.

- [How to run an agent in the background](https://docs.langchain.com/oss/javascript/langgraph/cloud/how-tos/background_run/)
- [How to run multiple agents in the same thread](https://docs.langchain.com/oss/javascript/langgraph/cloud/how-tos/same-thread/)
- [How to create cron jobs](https://docs.langchain.com/oss/javascript/langgraph/cloud/how-tos/cron_jobs/)
- [How to create stateless runs](https://docs.langchain.com/oss/javascript/langgraph/cloud/how-tos/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](https://docs.langchain.com/oss/javascript/langgraph/cloud/how-tos/stream_values/)
- [How to stream updates](https://docs.langchain.com/oss/javascript/langgraph/cloud/how-tos/stream_updates/)
- [How to stream messages](https://docs.langchain.com/oss/javascript/langgraph/cloud/how-tos/stream_messages/)
- [How to stream events](https://docs.langchain.com/oss/javascript/langgraph/cloud/how-tos/stream_events/)
- [How to stream in debug mode](https://docs.langchain.com/oss/javascript/langgraph/cloud/how-tos/stream_debug/)
- [How to stream multiple modes](https://docs.langchain.com/oss/javascript/langgraph/cloud/how-tos/stream_multiple/)

### Frontend & Generative UI

With LangGraph Platform you can integrate LangGraph agents into your React applications and colocate UI components with your agent code.

- [How to integrate LangGraph into your React application](https://docs.langchain.com/oss/javascript/langgraph/cloud/how-tos/use_stream_react/)
- [How to implement Generative User Interfaces with LangGraph](https://docs.langchain.com/oss/javascript/langgraph/cloud/how-tos/generative_ui_react/)

### 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](https://docs.langchain.com/oss/javascript/langgraph/cloud/how-tos/human_in_the_loop_breakpoint/)
- [How to wait for user input](https://docs.langchain.com/oss/javascript/langgraph/cloud/how-tos/human_in_the_loop_user_input/)
- [How to edit graph state](https://docs.langchain.com/oss/javascript/langgraph/cloud/how-tos/human_in_the_loop_edit_state/)
- [How to replay and branch from prior states](https://docs.langchain.com/oss/javascript/langgraph/cloud/how-tos/human_in_the_loop_time_travel/)
- [How to review tool calls](https://docs.langchain.com/oss/javascript/langgraph/cloud/how-tos/human_in_the_loop_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](https://docs.langchain.com/oss/javascript/langgraph/cloud/how-tos/interrupt_concurrent/)
- [How to use the rollback option](https://docs.langchain.com/oss/javascript/langgraph/cloud/how-tos/rollback_concurrent/)
- [How to use the reject option](https://docs.langchain.com/oss/javascript/langgraph/cloud/how-tos/reject_concurrent/)
- [How to use the enqueue option](https://docs.langchain.com/oss/javascript/langgraph/cloud/how-tos/enqueue_concurrent/)

### Webhooks

- [How to integrate webhooks](https://docs.langchain.com/oss/javascript/langgraph/cloud/how-tos/webhooks/)

### Cron Jobs

- [How to create cron jobs](https://docs.langchain.com/oss/javascript/langgraph/cloud/how-tos/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](https://docs.langchain.com/oss/javascript/langgraph/cloud/how-tos/test_deployment/)
- [How to connect to a local deployment](https://docs.langchain.com/oss/javascript/langgraph/cloud/how-tos/test_local_deployment/)
- [How to test your graph in LangGraph Studio](https://docs.langchain.com/oss/javascript/langgraph/cloud/how-tos/invoke_studio/)
- [How to interact with threads in LangGraph Studio](https://docs.langchain.com/oss/javascript/langgraph/cloud/how-tos/threads_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.

- [GRAPH_RECURSION_LIMIT](https://docs.langchain.com/oss/javascript/langgraph/troubleshooting/errors/GRAPH_RECURSION_LIMIT/)
- [INVALID_CONCURRENT_GRAPH_UPDATE](https://docs.langchain.com/oss/javascript/langgraph/troubleshooting/errors/INVALID_CONCURRENT_GRAPH_UPDATE/)
- [INVALID_GRAPH_NODE_RETURN_VALUE](https://docs.langchain.com/oss/javascript/langgraph/troubleshooting/errors/INVALID_GRAPH_NODE_RETURN_VALUE/)
- [MULTIPLE_SUBGRAPHS](https://docs.langchain.com/oss/javascript/langgraph/troubleshooting/errors/MULTIPLE_SUBGRAPHS/)
- [UNREACHABLE_NODE](https://docs.langchain.com/oss/javascript/langgraph/troubleshooting/errors/UNREACHABLE_NODE/)