Title: LangGraph: Build Stateful AI Agents in Python – Real Python
Open Graph Title: LangGraph: Build Stateful AI Agents in Python – Real Python
Description: LangGraph is a versatile Python library designed for stateful, cyclic, and multi-actor Large Language Model (LLM) applications. This tutorial will give you an overview of LangGraph fundamentals through hands-on examples, and the tools needed to build your own LLM workflows and agents in LangGraph.
Open Graph Description: LangGraph is a versatile Python library designed for stateful, cyclic, and multi-actor Large Language Model (LLM) applications. This tutorial will give you an overview of LangGraph fundamentals through hands-on examples, and the tools needed to build your own LLM workflows and agents in LangGraph.
Mail addresses
?subject=Python article for you&body=LangGraph: Build Stateful AI Agents in Python on Real Python
https://realpython.com/langgraph-python/
Opengraph URL: https://realpython.com/langgraph-python/
X: @realpython
Domain: realpython.com
{
"@context": "http://schema.org",
"@type": "Article",
"headline": "LangGraph: Build Stateful AI Agents in Python",
"image": {
"@type": "ImageObject",
"url": "https://files.realpython.com/media/Showcase-Langgraph_Watermarked.6435fda68bc4.jpg",
"width": 1920,
"height": 1080
},
"mainEntityOfPage": {
"@type": "WebPage",
"@id": "https://realpython.com/langgraph-python/",
"lastReviewed": "2024-11-15",
"author": {
"@type": "Person",
"name": "Harrison Hoffman",
"image": "https://realpython.com/cdn-cgi/image/width=605,height=605,fit=crop,gravity=auto,format=auto/https://files.realpython.com/media/Screenshot_2024-01-17_at_9.18.04_AM.7a08390ba349.png",
"url": "https://realpython.com/team/hhoffman/",
"affiliation": {
"@type": "Organization",
"@id": "https://realpython.com/#organization",
"name": "Real Python",
"url": "https://realpython.com",
"logo": "https://realpython.com/static/real-python-logo-square-512.157ae6bf64ed.png"
}
},
"reviewedBy": [
{
"@type": "Person",
"name": "Brenda Weleschuk",
"image": "https://realpython.com/cdn-cgi/image/width=320,height=320,fit=crop,gravity=auto,format=auto/https://files.realpython.com/media/IMG_3324_1.50b309355fc1.jpg",
"url": "https://realpython.com/team/bweleschuk/",
"affiliation": {
"@type": "Organization",
"@id": "https://realpython.com/#organization",
"name": "Real Python",
"url": "https://realpython.com",
"logo": "https://realpython.com/static/real-python-logo-square-512.157ae6bf64ed.png"
}
},
{
"@type": "Person",
"name": "Geir Arne Hjelle",
"image": "https://realpython.com/cdn-cgi/image/width=800,height=800,fit=crop,gravity=auto,format=auto/https://files.realpython.com/media/gahjelle.470149ee709e.jpg",
"url": "https://realpython.com/team/gahjelle/",
"affiliation": {
"@type": "Organization",
"@id": "https://realpython.com/#organization",
"name": "Real Python",
"url": "https://realpython.com",
"logo": "https://realpython.com/static/real-python-logo-square-512.157ae6bf64ed.png"
}
},
{
"@type": "Person",
"name": "Martin Breuss",
"image": "https://realpython.com/cdn-cgi/image/width=456,height=456,fit=crop,gravity=auto,format=auto/https://files.realpython.com/media/martin_breuss_python_square.efb2b07faf9f.jpg",
"url": "https://realpython.com/team/mbreuss/",
"affiliation": {
"@type": "Organization",
"@id": "https://realpython.com/#organization",
"name": "Real Python",
"url": "https://realpython.com",
"logo": "https://realpython.com/static/real-python-logo-square-512.157ae6bf64ed.png"
}
}
]
},
"datePublished": "2025-03-19T14:00:00+00:00",
"dateModified": "2024-11-15T14:47:22.105095+00:00",
"publisher": {
"@type": "Organization",
"@id": "https://realpython.com/#organization",
"name": "Real Python",
"url": "https://realpython.com",
"logo": {
"@type": "ImageObject",
"url": "https://realpython.com/static/real-python-logo-square-512.157ae6bf64ed.png",
"width": 512,
"height": 512
},
"description": "Real Python is a leading provider of online Python education and one of the largest language-specific online communities for software developers. It publishes high-quality learning resources, such as tutorials, books, and courses to an audience of millions of developers, data scientists, and machine learning engineers each month.",
"slogan": "Become a Python Expert",
"email": "info@realpython.com",
"sameAs": [
"https://github.com/realpython",
"https://www.youtube.com/realpython",
"https://twitter.com/realpython",
"https://x.com/realpython",
"https://www.linkedin.com/company/realpython-com/",
"https://www.facebook.com/learnrealpython",
"https://www.instagram.com/realpython",
"https://www.tiktok.com/@realpython.com"
]
},
"author": {
"@type": "Person",
"name": "Harrison Hoffman",
"image": "https://realpython.com/cdn-cgi/image/width=605,height=605,fit=crop,gravity=auto,format=auto/https://files.realpython.com/media/Screenshot_2024-01-17_at_9.18.04_AM.7a08390ba349.png",
"url": "https://realpython.com/team/hhoffman/",
"affiliation": {
"@type": "Organization",
"@id": "https://realpython.com/#organization",
"name": "Real Python",
"url": "https://realpython.com",
"logo": "https://realpython.com/static/real-python-logo-square-512.157ae6bf64ed.png"
}
},
"description": "LangGraph is a versatile Python library designed for stateful, cyclic, and multi-actor Large Language Model (LLM) applications. This tutorial will give you an overview of LangGraph fundamentals through hands-on examples, and the tools needed to build your own LLM workflows and agents in LangGraph.",
"hasPart": {
"@type": "FAQPage",
"mainEntity": [
{
"@type": "Question",
"name": "What is LangGraph?",
"acceptedAnswer": {
"@type": "Answer",
"text": "LangGraph is a Python library that helps you build stateful, cyclic, and multi-actor workflows for Large Language Model (LLM) applications, expanding upon LangChain’s capabilities.
"
}
},
{
"@type": "Question",
"name": "How does LangGraph differ from LangChain?",
"acceptedAnswer": {
"@type": "Answer",
"text": "LangGraph builds on LangChain by providing tools to create complex workflows with state management, conditional logic, and cycles, making it ideal for handling real-world LLM application complexities.
"
}
},
{
"@type": "Question",
"name": "Can you use LangGraph without LangChain?",
"acceptedAnswer": {
"@type": "Answer",
"text": "Yes, you can use LangGraph without LangChain, although they’re highly compatible and often used together to leverage LangChain’s foundational structures with LangGraph’s advanced capabilities.
"
}
},
{
"@type": "Question",
"name": "What is a state graph in LangGraph?",
"acceptedAnswer": {
"@type": "Answer",
"text": "A state graph in LangGraph is a directed graph representation of LLM workflows, where nodes represent actions like function calls, and edges dictate the workflow’s sequence, enabling conditional and cyclic operations.
"
}
},
{
"@type": "Question",
"name": "How do you create conditional workflows in LangGraph?",
"acceptedAnswer": {
"@type": "Answer",
"text": "You create conditional workflows in LangGraph by using conditional edges, which allow you to define different paths based on the evaluation of conditions within your graph’s state.
"
}
},
{
"@type": "Question",
"name": "How can you create a conditional edge in a LangGraph StateGraph?",
"acceptedAnswer": {
"@type": "Answer",
"text": "You create a conditional edge by defining a function that determines the next node based on the current state. You then register this function with workflow.add_conditional_edges() to conditionally control the graph’s flow.
"
}
},
{
"@type": "Question",
"name": "What are the main components of a LangGraph agent?",
"acceptedAnswer": {
"@type": "Answer",
"text": "A LangGraph agent consists of an LLM for decision-making and a set of tools for performing tasks. The agent’s architecture is often cyclic and conditional, allowing it to autonomously process and act on input data.
"
}
}
]
}
}
| author | Real Python |
| twitter:card | summary_large_image |
| twitter:image | https://files.realpython.com/media/Showcase-Langgraph_Watermarked.6435fda68bc4.jpg |
| og:image | https://files.realpython.com/media/Showcase-Langgraph_Watermarked.6435fda68bc4.jpg |
| twitter:creator | @realpython |
| og:type | article |
Links:
Viewport: width=device-width, initial-scale=1, shrink-to-fit=no, viewport-fit=cover
Robots: max-image-preview:large