LESSON 56 / 215·2 min readIntermediate

Nodes, edges, conditional edges, and routing

Must knowConcept lesson
01 Understand02 Recall03 Prepare

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

  1. Run node
  2. Validate/update state
  3. Router selects named destination
  4. Execute next node
  5. 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.
PAUSE & RECALL

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.

CONNECT IT TO YOUR INTERVIEW

Turn this concept into a clear answer.

Practice this concept
YOUR NEXT STEP

Keep connecting the ideas.

Next lesson: Practical TypeScript graph with an approval pause

Adapted from 13_AI.MD · “Nodes, edges, conditional edges, and routing”. Examples are study fragments; framework behavior can depend on your version.