Lesson 1 of 11
Chapter 18 . LangGraph . Lesson 1 of 11

Your first graph

A graph is a set of nodes joined by edges. Every node reads the shared state and returns only what it changed.

01Real-world example

Illustration: A CI step receives a test-run record and adds one field, such as a build ID, before passing it on.
A CI step receives a test-run record and adds one field, such as a build ID, before passing it on.

02The graph

Your first graph as a graph
greet is a node. It reads the state and hands back one new key: greeting.

03How the code does it

  • class State(TypedDict) declares the keys every node can read: tester and greeting.
  • greet() returns only {"greeting": ...}. LangGraph merges that into the state; it never replaces the whole dict.
  • add_edge(START, "greet") and add_edge("greet", END) make the only path. compile() validates it and returns a runnable app.
  • app.get_graph().draw_mermaid() prints the graph you built, so you can check the wiring before you add logic.

Key points

  • State is a plain dict shared by every node
  • A node returns only what it changed
  • Build it, compile() it, invoke() it

04Run it

terminal
cd chapter_18_LangGraph/src/chapters
python 001_Hello_Graph.py
output
Hello Pramod, your first graph ran.