Lesson deck
LangGraph: state, nodes, edges and control flow flashcards
Reviewing needs JavaScript. You can read every card in the list below.
Loading your cards...
Back to the lesson14 cards in this deck
Read all 14 cards as a list
- Front
- What are the three primitives of a LangGraph graph?
- Back
- State (shared data, with merge rules), nodes (functions that return partial updates) and edges (fixed, conditional or dynamic routing). Compile the graph before use.
- Front
- What should a node return?
- Back
- A partial update with only the keys it changed. Returning the whole state risks overwriting other nodes' work.
- Front
- How do you bound a retry loop in a graph?
- Back
- Keep a counter in state and have the routing function end the run when it reaches the cap. Also set the recursion limit.
- Front
- What is a reducer?
- Back
- The merge rule for one state key. Default: replace. An append reducer combines lists; the message reducer appends and updates by message id.
- Front
- Why do parallel writes to one key need a reducer?
- Back
- Two nodes in a round both write it; the runtime needs a rule to combine them. Without one the update is invalid or one write is lost.
- Front
- How do you clear a list that has an append reducer?
- Back
- Returning an empty list merges nothing in. Use the overwrite wrapper to bypass the reducer, from one node per round.
- Front
- What is a super-step?
- Back
- One round: all active nodes run in parallel on the same state, updates merge at the boundary through the reducers, and the next nodes activate.
- Front
- Why set the recursion limit yourself?
- Back
- The default can change between versions and is large (1000 from 1.0.6 per the docs). An unbounded cycle is an unbounded bill. Set it at the top level of the run config.
- Front
- Why must a node's side effects be safe to repeat?
- Back
- A retry or resume can re-run a step. The runtime saves state, not your outside effects, so use idempotency keys.
- Front
- Conditional edge, Command or Send?
- Back
- Conditional edge: a function picks the next node. Command: a node returns an update and the next node together. Send: fan out workers with their own input when the count is known only at run time.
- Front
- What happens if a node returns Command(goto=...) and also has a static edge?
- Back
- Both run. The static edge still fires alongside the goto, so remove it if you meant only the goto.
- Front
- Map-reduce in LangGraph?
- Back
- A routing function returns one Send per item; a worker node handles each; an append reducer on the results key gathers them; a join runs after.
- Front
- Graph API or functional API?
- Back
- Graph API when you want the shape visible: shared state, several decisions, parallel merges. Functional API to add durability to procedural code with simple branching. Same core capabilities.
- Front
- When is a graph the wrong tool?
- Back
- A linear pipeline with no loops, state or pauses: plain functions or a pipe chain. A standard tool agent: create_agent.