What you need
Python 3.10+ installed.
LangGraph installed: `pip install langgraph`.
LangChain installed for the tool ecosystem: `pip install langchain`.
An API key for your model provider.
Step 1: Define your agent state
LangGraph uses a typed state object that flows through every node in the graph.
Define the state schema: messages (conversation history), current_step, research_findings, draft, and approval_status.
The state is the single source of truth — every node reads from and writes to it.
Step 2: Create nodes for each step
Each node is a function or callable that takes the state, performs work, and returns updates.
Nodes: `research_node` (calls web search), `draft_node` (writes content), `review_node` (checks quality), `publish_node` (finalizes).
Nodes can have different models, tools, and prompts.
Step 3: Add edges and routing logic
Edges define the flow between nodes. Simple edges go from one node to the next.
Conditional edges use routing functions: 'If review approves, go to publish_node. If not, go to draft_node for revision.'
This is where LangGraph's graph model shines compared to linear chains.
Step 4: Enable persistence for long-running workflows
Add a checkpointer (SQLite or Postgres) so the workflow state persists across interruptions.
This allows workflows to run for hours or days, surviving server restarts.
Persistence is essential for human-in-the-loop workflows where a human may take hours to respond.
Step 5: Configure human-in-the-loop checkpoints
Insert interrupt nodes where the workflow pauses and waits for human input.
The human reviews the current state, provides feedback, and the workflow resumes from that point.
LangGraph supports approval, rejection, and edit actions at checkpoints.
Step 6: Deploy the workflow
LangGraph workflows can be deployed as LangGraph Server, as a standalone API with FastAPI, or embedded in your application.
Add monitoring and logging to track workflow execution, state changes, and error rates.
Scale horizontally by running multiple workflow instances across worker processes.
FAQ
When should I use LangGraph over CrewAI?
Use LangGraph when you need fine-grained control over state, branching logic, and long-running persistence. Use CrewAI when role-based orchestration with named agents is a better fit.
Can LangGraph use TypeScript?
Yes. LangGraph has a TypeScript SDK for Node.js applications. The concepts translate directly between Python and TypeScript.
Build LangGraph Workflows
- Install LangGraph: pip install langgraph
- Define a typed state schema
- Create function nodes for each step
- Add edges with conditional routing
- Enable persistence with SQLite/Postgres
- Add human-in-the-loop checkpoints
Ready to see the full catalog?
Browse all 42 agent-ready business kits. Each includes pre-configured agent roles, prompts, workflows, install steps, and approval gates.
Shop all business kits