AI engineering glossary · Agents tools MCP

What is langGraph?

LangGraph: An open-source framework from the LangChain team for building agents as graphs of nodes and edges with shared state, loops, persistence and human-approval pauses. It is used when developers want explicit control over an agent's flow.

Level: intermediateTopic: Agents tools MCP

LangGraph: an example

A developer builds a support agent in LangGraph with a triage node, a lookup node and a human-approval node.

LangGraph in Python

A short example you can run (Python 3.11). The output below is what it really prints.

from typing import TypedDict
from langgraph.graph import StateGraph, START, END

class State(TypedDict):
    question: str
    draft: str

def write(state): return {"draft": f"Draft answer to: {state['question']}"}
def review(state): return {"draft": state["draft"] + " (reviewed)"}

g = StateGraph(State)
g.add_node("write", write); g.add_node("review", review)
g.add_edge(START, "write"); g.add_edge("write", "review"); g.add_edge("review", END)
app = g.compile()
print(app.invoke({"question": "What is MCP?", "draft": ""})["draft"])

Output

Draft answer to: What is MCP? (reviewed)

Related terms

More Agents tools MCP terms

Where you learn it

LangGraph is part of the AI Engineering Program, which teaches it with notes, a hands-on lab and an exam. The first lesson is free.

Before you go

Take the cheat sheet with you

One free PDF: the key AI-engineering terms, formulas and Python idioms. No spam; unsubscribe any time.