In LangGraph, a node is a pure-ish function state -> state (call an LLM, hit a DB, format output) and an edge decides what runs next. A conditional edge is the key primitive: it reads the current state and routes execution, making decisions explicit instead of buried in prompt text.
flowchart LR
START --> Retrieve
Retrieve --> Grade{Relevant?}
Grade -- yes --> Generate
Grade -- no --> Rewrite
Rewrite --> Retrieve
Generate --> END
Why decision nodes beat 'an if inside a prompt'. When routing logic lives as a visible Grade{Relevant?} node with labelled branches, you can render it, test each branch in isolation, and trace which path a given run took. When the same logic is hidden inside a mega-prompt, you can only debug by re-reading model output and guessing.
The loop is the feature. Rewrite -> Retrieve is a cycle — the agent can retry retrieval with a reformulated query. Linear chains can't express that without bespoke glue; in a state machine it's just an edge back to an earlier node.
Design for failure branches. Real graphs need more than yes/no: a tool can time out, a grade can be 'uncertain'. Add explicit branches (e.g. a retry counter routed through a Retry? node) so failure handling is part of the diagram, not an afterthought in try/except.