LangGraph/Core Model
Intermediate11 min

Edges & Routing

Normal edges, conditional edges, path maps, cycles, and add_sequence() for linear flows.

Quick Reference

  • Normal edges: graph.add_edge('a', 'b') — always go from a to b
  • Conditional edges: graph.add_conditional_edges('a', route_fn, path_map) — route based on state
  • Path maps: {'continue': 'b', 'end': END} — explicit mapping from route_fn return values to nodes
  • Cycles: edges that point back to earlier nodes — the core of agent loops
  • Loop exit conditions: always define when the cycle should break (tool_calls empty, max iterations, etc.)
  • add_sequence(): shortcut for linear node chains — add_sequence([a, b, c]) wires a->b->c

Normal Edges

Fixed routing — always go from A to B

Normal edges are unconditional. Use them when the next step is always the same regardless of state.