A research assistant should not write its report just because a search has finished. If the results are weak, it may need another search. A conditional edge makes that choice at runtime: instead of always following a fixed edge, the workflow uses current state to select its next node. section 5.5.3 section 5.4.3
In LangGraph, nodes are functions that process state and return updates. Edges connect those nodes. A conditional edge adds a routing function that reads the state and chooses a destination. The decision belongs at the point where the required information is available—for example, after searches have produced results. section 5.4 section 5.4.3
Search again or summarize?
A small routing function can check the number of results: `should_refine_queries(state)` returns `"refine_queries"` when `len(state["search_results"]) < 2`; otherwise it returns `"summarize_results"`. Attach it after the search node with `graph.add_conditional_edge("perform_searches", should_refine_queries)`. The search still runs as a node; the conditional edge decides what happens next. section 5.4.3
For a fuller research workflow, a relevance evaluator can trigger another pass through query generation when fewer than half the summarized results are relevant. The route moves on to report writing when results are sufficient or three iterations have been reached. The iteration limit matters: without an end condition, a refinement loop has no stated stopping point. section 5.5.3
Conditional edges also control tool-using agents. After an LLM node responds, LangGraph’s `tools_condition` checks its latest message. Tool calls send execution to the tools node; no tool calls send it to `END`. When debugging, inspect the message and chosen route together: a request for a tool should lead to tool execution, while a completed answer should end the graph. section 11.4 section 11.6.1
Figure 11.2 Conditional graph logic routes each user query through the LLM node and then dynamically directs flow to the tools node or ends the process, depending on whether tool calls are required.
The diagram shows the two destinations of the agent’s conditional edge: tool execution or the end of the graph. section 11.4

