LangGraph (original) (raw)

Docs Version
Downloads Open Issues

LangGraph — used by Replit, Uber, LinkedIn, GitLab and more — is a low-level orchestration framework for building controllable agents. While langchain provides integrations and composable components to streamline LLM application development, the LangGraph library enables agent orchestration — offering customizable architectures, long-term memory, and human-in-the-loop to reliably handle complex tasks.

[](#%5F%5Fcodelineno-0-1)npm install @langchain/langgraph @langchain/core

To learn more about how to use LangGraph, check out the docs. We show a simple example below of how to create a ReAct agent.

[](#%5F%5Fcodelineno-1-1)// npm install @langchain-anthropic [](#%5F%5Fcodelineno-1-2)import { createReactAgent } from "@langchain/langgraph/prebuilt"; [](#%5F%5Fcodelineno-1-3)import { ChatAnthropic } from "@langchain/anthropic"; [](#%5F%5Fcodelineno-1-4)import { tool } from "@langchain/core/tools"; [](#%5F%5Fcodelineno-1-5) [](#%5F%5Fcodelineno-1-6)import { z } from "zod"; [](#%5F%5Fcodelineno-1-7) [](#%5F%5Fcodelineno-1-8)const search = tool(async ({ query }) => { [](#%5F%5Fcodelineno-1-9) if (query.toLowerCase().includes("sf") || query.toLowerCase().includes("san francisco")) { [](#%5F%5Fcodelineno-1-10) return "It's 60 degrees and foggy." [](#%5F%5Fcodelineno-1-11) } [](#%5F%5Fcodelineno-1-12) return "It's 90 degrees and sunny." [](#%5F%5Fcodelineno-1-13)}, { [](#%5F%5Fcodelineno-1-14) name: "search", [](#%5F%5Fcodelineno-1-15) description: "Call to surf the web.", [](#%5F%5Fcodelineno-1-16) schema: z.object({ [](#%5F%5Fcodelineno-1-17) query: z.string().describe("The query to use in your search."), [](#%5F%5Fcodelineno-1-18) }), [](#%5F%5Fcodelineno-1-19)}); [](#%5F%5Fcodelineno-1-20) [](#%5F%5Fcodelineno-1-21)const model = new ChatAnthropic({ [](#%5F%5Fcodelineno-1-22) model: "claude-3-7-sonnet-latest" [](#%5F%5Fcodelineno-1-23)}); [](#%5F%5Fcodelineno-1-24) [](#%5F%5Fcodelineno-1-25)const agent = createReactAgent({ [](#%5F%5Fcodelineno-1-26) llm: model, [](#%5F%5Fcodelineno-1-27) tools: [search], [](#%5F%5Fcodelineno-1-28)}); [](#%5F%5Fcodelineno-1-29) [](#%5F%5Fcodelineno-1-30)const result = await agent.invoke( [](#%5F%5Fcodelineno-1-31) { [](#%5F%5Fcodelineno-1-32) messages: [{ [](#%5F%5Fcodelineno-1-33) role: "user", [](#%5F%5Fcodelineno-1-34) content: "what is the weather in sf" [](#%5F%5Fcodelineno-1-35) }] [](#%5F%5Fcodelineno-1-36) } [](#%5F%5Fcodelineno-1-37));

Full-stack Quickstart

Get started quickly by building a full-stack LangGraph application using the create-agent-chat-app CLI:

[](#%5F%5Fcodelineno-2-1)npx create-agent-chat-app@latest

The CLI sets up a chat interface and helps you configure your application, including:

Why use LangGraph?

LangGraph is built for developers who want to build powerful, adaptable AI agents. Developers choose LangGraph for:

LangGraph is trusted in production and powering agents for companies like:

LangGraph’s ecosystem

While LangGraph can be used standalone, it also integrates seamlessly with any LangChain product, giving developers a full suite of tools for building agents. To improve your LLM application development, pair LangGraph with:

Pairing with LangGraph Platform

While LangGraph is our open-source agent orchestration framework, enterprises that need scalable agent deployment can benefit from LangGraph Platform.

LangGraph Platform can help engineering teams:

Additional resources

Acknowledgements

LangGraph is inspired by Pregel and Apache Beam. The public interface draws inspiration from NetworkX. LangGraph is built by LangChain Inc, the creators of LangChain, but can be used without LangChain.