# Conditional edges

An edge that looks at the state and picks the next node, so the model's output can choose the path.

AI developers · Part 06: LangChain / LangGraph · Card 10 of 14 · Last updated 2026-10-13

## Analogy

A switch statement in your router, where the case value came from the LLM.

## In an agent

This is how a router node sends a request to the docs agent or the tickets agent.

## Practice

### Flashcards

- **Interview: what does LangGraph add to LangChain?** Explicit graphs with state, checkpoints, interrupts and routing, so complex agents are easier to control.

## Questions people ask

### What is a conditional edge in LangGraph?

A conditional edge runs a function on the current state and returns the name of the next node. That lets the model's output pick the path, for example sending a request to the docs agent or the tickets agent, or deciding whether to call tools again or finish.

### How do I build a router with conditional edges?

Make a router node that classifies the request, ideally with structured output, and writes the label into the state. Add a conditional edge after it whose function reads that label and returns the matching specialist node's name. Each specialist node then handles only its own kind of request.

## Related concepts

- [LangGraph.js](https://studyvisually.com/learn/tech/ai-developers/langchain-langgraph/langgraph)
- [Graph state](https://studyvisually.com/learn/tech/ai-developers/langchain-langgraph/graph-state)
- [Checkpointing](https://studyvisually.com/learn/tech/ai-developers/langchain-langgraph/checkpointing)
- [interrupt()](https://studyvisually.com/learn/tech/ai-developers/langchain-langgraph/interrupt)

Web page: https://studyvisually.com/learn/tech/ai-developers/langchain-langgraph/conditional-edges
Study this card in the app: https://studyvisually.com/app/learn?category=ai-developers&card=conditional-edges
