René's URL Explorer Experiment


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

direct link

Domain: realpython.com


Hey, it has json ld scripts:
{
  "@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.

" } } ] } }

authorReal Python
twitter:cardsummary_large_image
twitter:imagehttps://files.realpython.com/media/Showcase-Langgraph_Watermarked.6435fda68bc4.jpg
og:imagehttps://files.realpython.com/media/Showcase-Langgraph_Watermarked.6435fda68bc4.jpg
twitter:creator@realpython
og:typearticle

Links:

https://realpython.com/
Start Herehttps://realpython.com/start-here/
Learn Python https://realpython.com/langgraph-python/
Python Tutorials →In-depth articles and video courseshttps://realpython.com/search?kind=article&kind=course&order=newest
Learning Paths →Guided study plans for accelerated learninghttps://realpython.com/learning-paths/
Quizzes & Exercises →Check your learning progresshttps://realpython.com/quizzes/
Browse Topics →Focus on a specific area or skill levelhttps://realpython.com/tutorials/all/
Community Chat →Learn with other Pythonistashttps://realpython.com/community/
Office Hours →Live Q&A calls with Python expertshttps://realpython.com/office-hours/
Podcast →Hear what’s new in the world of Pythonhttps://realpython.com/podcasts/rpp/
Books →Round out your knowledge and learn offlinehttps://realpython.com/products/books/
Reference →Concise definitions for common Python termshttps://realpython.com/ref/
Code Mentor →BetaPersonalized code assistance & learning toolshttps://realpython.com/mentor/
Unlock All Content →https://realpython.com/account/join/
More https://realpython.com/langgraph-python/
Learner Storieshttps://realpython.com/learner-stories/
Python Newsletterhttps://realpython.com/newsletter/
Python Job Boardhttps://www.pythonjobshq.com
Meet the Teamhttps://realpython.com/team/
Become a Tutorial Writerhttps://realpython.com/write-for-us/
Become a Video Instructorhttps://realpython.com/become-an-instructor/
Searchhttps://realpython.com/search
https://realpython.com/search
Joinhttps://realpython.com/account/join/
Sign‑Inhttps://realpython.com/account/login/?next=%2Flanggraph-python%2F
Browse Topicshttps://realpython.com/tutorials/all/
Guided Learning Pathshttps://realpython.com/learning-paths/
Basicshttps://realpython.com/search?level=basics
Intermediatehttps://realpython.com/search?level=intermediate
Advancedhttps://realpython.com/search?level=advanced
aihttps://realpython.com/tutorials/ai/
algorithmshttps://realpython.com/tutorials/algorithms/
apihttps://realpython.com/tutorials/api/
best-practiceshttps://realpython.com/tutorials/best-practices/
careerhttps://realpython.com/tutorials/career/
communityhttps://realpython.com/tutorials/community/
databaseshttps://realpython.com/tutorials/databases/
data-sciencehttps://realpython.com/tutorials/data-science/
data-structureshttps://realpython.com/tutorials/data-structures/
data-vizhttps://realpython.com/tutorials/data-viz/
devopshttps://realpython.com/tutorials/devops/
djangohttps://realpython.com/tutorials/django/
dockerhttps://realpython.com/tutorials/docker/
editorshttps://realpython.com/tutorials/editors/
flaskhttps://realpython.com/tutorials/flask/
front-endhttps://realpython.com/tutorials/front-end/
gamedevhttps://realpython.com/tutorials/gamedev/
guihttps://realpython.com/tutorials/gui/
machine-learninghttps://realpython.com/tutorials/machine-learning/
newshttps://realpython.com/tutorials/news/
numpyhttps://realpython.com/tutorials/numpy/
projectshttps://realpython.com/tutorials/projects/
pythonhttps://realpython.com/tutorials/python/
stdlibhttps://realpython.com/tutorials/stdlib/
testinghttps://realpython.com/tutorials/testing/
toolshttps://realpython.com/tutorials/tools/
web-devhttps://realpython.com/tutorials/web-dev/
web-scrapinghttps://realpython.com/tutorials/web-scraping/
Table of Contentshttps://realpython.com/langgraph-python/#toc
Install LangGraphhttps://realpython.com/langgraph-python/#install-langgraph
Create Test Caseshttps://realpython.com/langgraph-python/#create-test-cases
Work With State Graphshttps://realpython.com/langgraph-python/#work-with-state-graphs
LangChain Chains and Their Limitationshttps://realpython.com/langgraph-python/#langchain-chains-and-their-limitations
Build Your First State Graphhttps://realpython.com/langgraph-python/#build-your-first-state-graph
Work With Conditional Edgeshttps://realpython.com/langgraph-python/#work-with-conditional-edges
Create a Conditional Edgehttps://realpython.com/langgraph-python/#create-a-conditional-edge
Use Conditional Edges for Cycleshttps://realpython.com/langgraph-python/#use-conditional-edges-for-cycles
Develop Graph Agentshttps://realpython.com/langgraph-python/#develop-graph-agents
Structure Agents as Graphshttps://realpython.com/langgraph-python/#structure-agents-as-graphs
Test Your Graph Agenthttps://realpython.com/langgraph-python/#test-your-graph-agent
Conclusionhttps://realpython.com/langgraph-python/#conclusion
Frequently Asked Questionshttps://realpython.com/langgraph-python/#frequently-asked-questions
https://realpython.com/feedback/survey/article/langgraph-python/liked/?from=article-sidebar
https://realpython.com/feedback/survey/article/langgraph-python/disliked/?from=article-sidebar
Harrison Hoffmanhttps://realpython.com/langgraph-python/#author
https://realpython.com/langgraph-python/#reader-comments
intermediatehttps://realpython.com/tutorials/intermediate/
aihttps://realpython.com/tutorials/ai/
data-sciencehttps://realpython.com/tutorials/data-science/
Install LangGraphhttps://realpython.com/langgraph-python/#install-langgraph
Create Test Caseshttps://realpython.com/langgraph-python/#create-test-cases
Work With State Graphshttps://realpython.com/langgraph-python/#work-with-state-graphs
LangChain Chains and Their Limitationshttps://realpython.com/langgraph-python/#langchain-chains-and-their-limitations
Build Your First State Graphhttps://realpython.com/langgraph-python/#build-your-first-state-graph
Work With Conditional Edgeshttps://realpython.com/langgraph-python/#work-with-conditional-edges
Create a Conditional Edgehttps://realpython.com/langgraph-python/#create-a-conditional-edge
Use Conditional Edges for Cycleshttps://realpython.com/langgraph-python/#use-conditional-edges-for-cycles
Develop Graph Agentshttps://realpython.com/langgraph-python/#develop-graph-agents
Structure Agents as Graphshttps://realpython.com/langgraph-python/#structure-agents-as-graphs
Test Your Graph Agenthttps://realpython.com/langgraph-python/#test-your-graph-agent
Conclusionhttps://realpython.com/langgraph-python/#conclusion
Frequently Asked Questionshttps://realpython.com/langgraph-python/#frequently-asked-questions
Remove adshttps://realpython.com/account/join/
LangChainhttps://realpython.com/build-llm-rag-chatbot-with-langchain/
object-oriented programminghttps://realpython.com/python3-object-oriented-programming/
Click here to download the free sample code https://realpython.com/bonus/langgraph-python-code/
https://realpython.com/quizzes/langgraph-python/
LangGraph: Build Stateful AI Agents in Pythonhttps://realpython.com/quizzes/langgraph-python/
https://realpython.com/langgraph-python/#install-langgraph
PyPIhttps://pypi.org/
piphttps://realpython.com/what-is-pip/
Python REPLhttps://realpython.com/python-repl/
pydantichttps://realpython.com/python-pydantic/
API keyhttps://openai.com/api/
environment variablehttps://en.wikipedia.org/wiki/Environment_variable
Remove adshttps://realpython.com/account/join/
https://realpython.com/langgraph-python/#create-test-cases
https://realpython.com/langgraph-python/#work-with-state-graphs
https://files.realpython.com/media/Screenshot_2024-11-25_at_2.28.24_PM.ab4b12f7d677.png
https://realpython.com/langgraph-python/#langchain-chains-and-their-limitations
JSONhttps://realpython.com/python-json/
computed fieldhttps://docs.pydantic.dev/2.0/usage/computed_fields/
propertieshttps://realpython.com/python-property/
LangChain Expression Language (LCEL)https://realpython.com/build-llm-rag-chatbot-with-langchain/#chains-and-langchain-expression-language-lcel
global variablehttps://realpython.com/python-use-global-variable-in-function/
EMAILS[0]https://realpython.com/langgraph-python/#create-test-cases
Remove adshttps://realpython.com/account/join/
https://realpython.com/langgraph-python/#build-your-first-state-graph
loggerhttps://realpython.com/python-logging/
httpxhttps://pypi.org/project/httpx/
typed dictionaryhttps://typing.readthedocs.io/en/latest/spec/typeddict.html#typeddict
https://files.realpython.com/media/Screenshot_2025-01-01_at_1.07.01_PM.2dc7eb21ff52.png
Remove adshttps://realpython.com/account/join/
https://realpython.com/langgraph-python/#work-with-conditional-edges
https://realpython.com/langgraph-python/#create-a-conditional-edge
https://files.realpython.com/media/Screenshot_2025-01-19_at_11.24.08_PM.fb5f18a97d55.png
Remove adshttps://realpython.com/account/join/
https://realpython.com/langgraph-python/#use-conditional-edges-for-cycles
https://files.realpython.com/media/Screenshot_2025-02-10_at_7.52.54_PM.1999221b69c3.png
Remove adshttps://realpython.com/account/join/
https://realpython.com/langgraph-python/#develop-graph-agents
LangChain tutorialhttps://realpython.com/build-llm-rag-chatbot-with-langchain/#agents
https://realpython.com/langgraph-python/#structure-agents-as-graphs
decoratedhttps://realpython.com/primer-on-python-decorators/
docstringhttps://realpython.com/how-to-write-docstrings-in-python/
LangGraph’s documentationhttps://langchain-ai.github.io/langgraph/concepts/low_level/#messagesstate
https://files.realpython.com/media/Screenshot_2025-03-01_at_11.41.54_AM.7f75d6337550.png
Remove adshttps://realpython.com/account/join/
https://realpython.com/langgraph-python/#test-your-graph-agent
example emailshttps://realpython.com/langgraph-python/#create-test-cases
Remove adshttps://realpython.com/account/join/
https://realpython.com/langgraph-python/#conclusion
Click here to download the free sample code https://realpython.com/bonus/langgraph-python-code/
https://realpython.com/langgraph-python/#frequently-asked-questions
https://realpython.com/quizzes/langgraph-python/
LangGraph: Build Stateful AI Agents in Pythonhttps://realpython.com/quizzes/langgraph-python/
https://realpython.com/feedback/survey/article/langgraph-python/liked/?from=article-footer
https://realpython.com/feedback/survey/article/langgraph-python/disliked/?from=article-footer
https://realpython.com/team/hhoffman/
» More about Harrisonhttps://realpython.com/team/hhoffman/
https://realpython.com/team/bweleschuk/
Brendahttps://realpython.com/team/bweleschuk/
https://realpython.com/team/gahjelle/
Geir Arnehttps://realpython.com/team/gahjelle/
https://realpython.com/team/mbreuss/
Martinhttps://realpython.com/team/mbreuss/
Level Up Your Python Skills »https://realpython.com/account/join/?utm_source=rp_article_footer&utm_content=langgraph-python
Level Up Your Python Skills »https://realpython.com/account/join/?utm_source=rp_article_footer&utm_content=langgraph-python
https://realpython.com/feedback/survey/article/langgraph-python/liked/?from=article-comments
https://realpython.com/feedback/survey/article/langgraph-python/disliked/?from=article-comments
LinkedInhttps://www.linkedin.com/sharing/share-offsite/?url=https%3A%2F%2Frealpython.com%2Flanggraph-python%2F
Twitterhttps://twitter.com/intent/tweet/?text=Interesting%20Python%20article%20on%20%40realpython%3A%20LangGraph%3A%20Build%20Stateful%20AI%20Agents%20in%20Python&url=https%3A%2F%2Frealpython.com%2Flanggraph-python%2F
Blueskyhttps://bsky.app/intent/compose?text=Interesting%20Python%20article%20on%20%40realpython.com%3A%20LangGraph%3A%20Build%20Stateful%20AI%20Agents%20in%20Python%20https%3A%2F%2Frealpython.com%2Flanggraph-python%2F
Facebookhttps://facebook.com/sharer/sharer.php?u=https%3A%2F%2Frealpython.com%2Flanggraph-python%2F
Get tips for asking good questionshttps://realpython.com/python-beginner-tips/#tip-9-ask-good-questions
get answers to common questions in our support portalhttps://support.realpython.com
Real Python Community Chathttps://realpython.com/community/
“Office Hours” Live Q&A Sessionhttps://realpython.com/office-hours/
intermediatehttps://realpython.com/tutorials/intermediate/
aihttps://realpython.com/tutorials/ai/
data-sciencehttps://realpython.com/tutorials/data-science/
Build an LLM RAG Chatbot With LangChainhttps://realpython.com/build-llm-rag-chatbot-with-langchain/?utm_source=realpython&utm_medium=web&utm_campaign=related-post&utm_content=langgraph-python
Managing Python Projects With uv: An All-in-One Solutionhttps://realpython.com/python-uv/?utm_source=realpython&utm_medium=web&utm_campaign=related-post&utm_content=langgraph-python
LlamaIndex in Python: A RAG Guide With Exampleshttps://realpython.com/llamaindex-examples/?utm_source=realpython&utm_medium=web&utm_campaign=related-post&utm_content=langgraph-python
Logging in Pythonhttps://realpython.com/python-logging/?utm_source=realpython&utm_medium=web&utm_campaign=related-post&utm_content=langgraph-python
SOLID Design Principles: Improve Object-Oriented Code in Pythonhttps://realpython.com/solid-principles-python/?utm_source=realpython&utm_medium=web&utm_campaign=related-post&utm_content=langgraph-python
https://realpython.com/account/signup/?intent=continue_reading&utm_source=rp&utm_medium=web&utm_campaign=rwn&utm_content=v1&next=%2Flanggraph-python%2F
Continue »https://realpython.com/account/signup/?intent=continue_reading&utm_source=rp&utm_medium=web&utm_campaign=rwn&utm_content=v1&next=%2Flanggraph-python%2F
Sign-Inhttps://realpython.com/account/login/?next=/langgraph-python/
Start Herehttps://realpython.com/start-here/
Learning Resourceshttps://realpython.com/search
Code Mentorhttps://realpython.com/mentor/
Python Referencehttps://realpython.com/ref/
Python Cheat Sheethttps://realpython.com/cheatsheets/python/
Support Centerhttps://support.realpython.com/
Learning Pathshttps://realpython.com/learning-paths/
Quizzes & Exerciseshttps://realpython.com/quizzes/
Browse Topicshttps://realpython.com/tutorials/all/
Live Courseshttps://realpython.com/live/
Bookshttps://realpython.com/books/
Podcasthttps://realpython.com/podcasts/rpp/
Newsletterhttps://realpython.com/newsletter/
Community Chathttps://realpython.com/community/
Office Hourshttps://realpython.com/office-hours/
Learner Storieshttps://realpython.com/learner-stories/
Plans & Pricinghttps://realpython.com/account/join/
Team Planshttps://realpython.com/account/join-team/
For Businesshttps://realpython.com/account/join-team/inquiry/
For Schoolshttps://realpython.com/account/join-team/education-inquiry/
Reviewshttps://realpython.com/learner-stories/
About Ushttps://realpython.com/about/
Teamhttps://realpython.com/team/
Mission & Valueshttps://realpython.com/mission/
Editorial Guidelineshttps://realpython.com/editorial-guidelines/
Sponsorshipshttps://realpython.com/sponsorships/
Careershttps://realpython.workable.com
Press Kithttps://realpython.com/media-kit/
Merchhttps://realpython.com/merch
https://www.youtube.com/realpython
https://x.com/realpython
https://www.linkedin.com/company/realpython-com
https://www.facebook.com/LearnRealPython
https://github.com/realpython/
Privacy Policyhttps://realpython.com/privacy-policy/
Terms of Usehttps://realpython.com/terms/
Securityhttps://realpython.com/security/
Contacthttps://realpython.com/contact/
https://realpython.com/

Viewport: width=device-width, initial-scale=1, shrink-to-fit=no, viewport-fit=cover

Robots: max-image-preview:large


URLs of crawlers that visited me.