LangGraph (original) (raw)

LangGraph Logo LangGraph Logo

LangGraph Logo

Version Downloads Open Issues Docs

Trusted by companies shaping the future of agents – including Klarna, Replit, Elastic, and more – LangGraph is a low-level orchestration framework for building, managing, and deploying long-running, stateful agents.

Get started

Install LangGraph:

Then, create an agent using prebuilt components:

[](#%5F%5Fcodelineno-1-1)# pip install -qU "langchain[anthropic]" to call the model [](#%5F%5Fcodelineno-1-2) [](#%5F%5Fcodelineno-1-3)from langgraph.prebuilt import create_react_agent [](#%5F%5Fcodelineno-1-4) [](#%5F%5Fcodelineno-1-5)def get_weather(city: str) -> str: [](#%5F%5Fcodelineno-1-6) """Get weather for a given city.""" [](#%5F%5Fcodelineno-1-7) return f"It's always sunny in {city}!" [](#%5F%5Fcodelineno-1-8) [](#%5F%5Fcodelineno-1-9)agent = create_react_agent( [](#%5F%5Fcodelineno-1-10) model="anthropic:claude-3-7-sonnet-latest", [](#%5F%5Fcodelineno-1-11) tools=[get_weather], [](#%5F%5Fcodelineno-1-12) prompt="You are a helpful assistant" [](#%5F%5Fcodelineno-1-13)) [](#%5F%5Fcodelineno-1-14) [](#%5F%5Fcodelineno-1-15)# Run the agent [](#%5F%5Fcodelineno-1-16)agent.invoke( [](#%5F%5Fcodelineno-1-17) {"messages": [{"role": "user", "content": "what is the weather in sf"}]} [](#%5F%5Fcodelineno-1-18))

For more information, see the Quickstart. Or, to learn how to build an agent workflow with a customizable architecture, long-term memory, and other complex task handling, see the LangGraph basics tutorials.

Core benefits

LangGraph provides low-level supporting infrastructure for any long-running, stateful workflow or agent. LangGraph does not abstract prompts or architecture, and provides the following central benefits:

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:

Note

Looking for the JS version of LangGraph? See the JS repo and the JS docs.

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.