These docs are for the v1.0 alpha release of LangGraph. For the latest stable docs, please see the old sites: LangGraph Python | LangGraph JavaScript
- A workflow is a predefined sequence of steps or processes that execute in a structured, often linear fashion.
- An agent is a system that uses an LLM to dynamically perceive its environment, make decisions, and take actions to achieve goals.

- An LLM can route between two potential paths.
- An LLM can decide which of many tools to call.
- An LLM can decide whether the generated answer is sufficient or more work is needed.

Augmented LLM
LLMs have augmentations that support building workflows and agents. These include structured outputs and tool calling, as shown in this image from the Anthropic blog onBuilding Effective Agents
:

Router
A router allows an LLM to select a single step from a specified set of options. This is an agent architecture that exhibits a relatively limited level of control because the LLM usually focuses on making a single decision and produces a specific output from a limited set of pre-defined options. Routing works well for complex tasks where there are distinct categories that are better handled separately, and where classification can be handled accurately, either by an LLM or a more traditional classification model/algorithm.
- Graph API
- Functional API
Structured output
Structured outputs with LLMs work by providing a specific format or schema that the LLM should follow in its response. This is similar to tool calling, but more general. While tool calling typically involves selecting and using predefined functions, structured outputs can be used for any type of formatted response. Common methods to achieve structured outputs include:- Prompt engineering: Instructing the LLM to respond in a specific format via the system prompt.
- Output parsers: Using post-processing to extract structured data from LLM responses.
- Tool calling: Leveraging built-in tool calling capabilities of some LLMs to generate structured outputs.
Tool-calling agent
While a router allows an LLM to make a single decision, more complex agent architectures expand the LLM’s control in two key ways:- Multi-step decision making: The LLM can make a series of decisions, one after another, instead of just one.
- Tool access: The LLM can choose from and use a variety of tools to accomplish tasks.
- Tool calling: Allowing the LLM to select and use various tools as needed.
- Memory: Enabling the agent to retain and use information from previous steps.
- Planning: Empowering the LLM to create and follow multi-step plans to achieve goals.
Tool calling
Tools are useful whenever you want an agent to interact with external systems. External systems (e.g., APIs) often require a particular input schema or payload, rather than natural language. When we bind an API, for example, as a tool, we give the model awareness of the required input schema. The model will choose to call a tool based upon the natural language input from the user and it will return an output that adheres to the tool’s required schema. Many LLM providers support tool calling and tool calling interface in LangChain is simple: you can simply pass any Pythonfunction
into ChatModel.bind_tools(function)
.

Memory
Memory is crucial for agents, enabling them to retain and utilize information across multiple steps of problem-solving. It operates on different scales:- Short-term memory: Allows the agent to access information acquired during earlier steps in a sequence.
- Long-term memory: Enables the agent to recall information from previous interactions, such as past messages in a conversation.
State
: User-defined schema specifying the exact structure of memory to retain.Checkpointer
: Mechanism to store state at every step across different interactions within a session.Store
: Mechanism to store user-specific or application-level data across sessions.
Planning
In a tool-calling agent, an LLM is called repeatedly in a while-loop. At each step the agent decides which tools to call, and what the inputs to those tools should be. Those tools are then executed, and the outputs are fed back into the LLM as observations. The while-loop terminates when the agent decides it has enough information to solve the user request and it is not worth calling any more tools.Prompt chaining
In prompt chaining, each LLM call processes the output of the previous one. As noted in the Anthropic blog onBuilding Effective Agents
:
Prompt chaining decomposes a task into a sequence of steps, where each LLM call processes the output of the previous one. You can add programmatic checks (see “gate” in the diagram below) on any intermediate steps to ensure that the process is still on track.
When to use this workflow: This workflow is ideal for situations where the task can be easily and cleanly decomposed into fixed subtasks. The main goal is to trade off latency for higher accuracy, by making each LLM call an easier task.

- Graph API
- Functional API
Orchestrator-worker
With orchestrator-worker, an orchestrator breaks down a task, delegates each sub-task to workers, and synthesizes their results.
- Graph API
- Functional API
Send
API to support this. It lets you dynamically create worker nodes and send each one a specific input. Each worker has its own state, and all worker outputs are written to a shared state key that is accessible to the orchestrator graph. This gives the orchestrator access to all worker output and allows it to synthesize them into a final output. As you can see below, we iterate over a list of sections and Send
each to a worker node. See further documentation here and here.Evaluator-optimizer
In the evaluator-optimizer workflow, one LLM call generates a response while another provides evaluation and feedback in a loop:When to use this workflow: This workflow is particularly effective when we have clear evaluation criteria, and when iterative refinement provides measurable value. The two signs of good fit are, first, that LLM responses can be demonstrably improved when a human articulates their feedback; and second, that the LLM can provide such feedback. This is analogous to the iterative writing process a human writer might go through when producing a polished document.

- Graph API
- Functional API
Human-in-the-loop
Human involvement can significantly enhance agent reliability, especially for sensitive tasks. This can involve:- Approving specific actions
- Providing feedback to update the agent’s state
- Offering guidance in complex decision-making processes
Parallelization
With parallelization, LLMs work simultaneously and have their outputs aggregated programmatically. Parallel processing is vital for efficient multi-agent systems and complex tasks. LangGraph supports parallelization through its Send API, enabling:- Concurrent processing of multiple states
- Implementation of map-reduce-like operations
- Efficient handling of independent subtasks

- Graph API
- Functional API
Subgraphs
Subgraphs are essential for managing complex agent architectures, particularly in multi-agent systems. They allow:- Isolated state management for individual agents
- Hierarchical organization of agent teams
- Controlled communication between agents and the main system
Reflection
Reflection mechanisms can significantly improve agent reliability by:- Evaluating task completion and correctness
- Providing feedback for iterative improvement
- Enabling self-correction and learning