Fixed entry point
A graph has one deterministic first processing step.
AI Agents · Const
START is LangGraph.js's virtual beginning node. Use it to connect graph input to the node or nodes that should execute first.
START is a special virtual node representing the beginning of graph execution. Connect it with addEdge to choose the first node, or with addConditionalEdges when the entry point depends on routing logic.
import { START } from "@langchain/langgraph";
graph.addEdge(START, "nodeName");import { START, StateGraph, StateSchema } from "@langchain/langgraph";
const State = new StateSchema({
message: z.string().default(() => ""),
});
const graph = new StateGraph(State)
.addNode("nodeA", () => ({ message: "started" }))
.addEdge(START, "nodeA")
.compile();The edge from START makes nodeA the graph's entry point.
A graph has one deterministic first processing step.
Initial routing depends on the incoming state.
A graph needs an explicit boundary between input and application nodes.
START represents the beginning of graph execution and routes user input into the graph. Referencing it lets you determine which node or nodes run first.
Follow-up: How can entry selection depend on runtime state? Use addConditionalEdges from START so a routing function selects the initial destination.
Use addEdge(START, "nodeA") to connect the virtual START node to a named node. This establishes nodeA as the first node executed.
Follow-up: What should be used when there are multiple possible initial nodes? Use addConditionalEdges from START rather than a fixed edge.
A fixed entry point uses addEdge from START, while conditional entry uses addConditionalEdges from START. Both approaches specify where graph execution enters.
Follow-up: Why is START useful even though it is virtual? It provides an explicit graph boundary for routing initial user input.
StateGraphaddEdgeaddConditionalEdgesEND