Nodes, edges, conditional edges, and routing
Words made simple
A few useful meanings before you read the explanation.
- Agent
- An application that uses a model to choose its next action within defined limits. It can use tools and continue through several steps.
- Deterministic
- Following steps or rules defined by code. The model does not decide which step should run next in a deterministic workflow.
- State
- The data describing where a workflow is now, what it already knows, and what still needs to happen.
Overview
- A node is a function performing one graph step.
- An edge describes the next step, while a conditional edge selects from allowed destinations based on state.
- Routing can use model output, deterministic checks, or both.
Why this matters
Explicit transitions make failure paths and allowed actions reviewable.
An everyday example
A hospital sends a case to a specific department depending on validated symptoms and rules.
A technical example
intent === "claim_status" selects claim lookup; unsupported intent selects clarification.
How it works
- Run node
- Validate/update state
- Router selects named destination
- Execute next node
- Terminate at a defined endpoint.
Architecture and flow
Node → bounded route → allowed next node.
The insurance assistant example
A model can select “create draft”; only a deterministic approval check can select “submit approved draft.”
When to use it
Branching tasks and explicit retry/escalation paths.
When to avoid it
Do not let model text become a dynamically imported node name or arbitrary endpoint URL.
Interview answer
“Nodes perform work and edges control execution. I validate model-derived routing and use business rules to control consequential transitions.”
Benefits, trade-offs, and production considerations
- Each node should have a clear input, output, deadline, and failure contract.
- Keep business services independently testable and avoid a giant node containing the whole agent.
Can you explain it without the notes?
Nodes, edges, conditional edges, and routing
Use your own words. Explain an example and one limitation before checking the explanation.
Check your explanation
A node is a function performing one graph step. An edge describes the next step, while a conditional edge selects from allowed destinations based on state. Routing can use model output, deterministic checks, or both.
Turn this concept into a clear answer.
Practice this conceptKeep connecting the ideas.
Next lesson: Practical TypeScript graph with an approval pauseAdapted from 13_AI.MD · “Nodes, edges, conditional edges, and routing”. Examples are study fragments; framework behavior can depend on your version.