Skip to main content

Quickstart

This guide will get you up and running with LangGraph in under 5 minutes. You’ll create a simple stateful workflow that demonstrates the core concepts of graphs, nodes, edges, and state.

Prerequisites

Before you begin, make sure you have:
  • Python 3.10 or higher installed
  • Basic familiarity with Python and type hints
If you haven’t installed LangGraph yet, check out the Installation Guide.

Your First LangGraph Application

Let’s build a simple workflow that processes text through multiple nodes.

Complete Example

Here’s the full code in one place:

Expected Output

When you run this code, you’ll see:
The workflow:
  1. Starts with an empty string ""
  2. node_a appends "a""a"
  3. node_b appends "b""ab"

Understanding the Flow

Building a Conditional Workflow

Let’s extend the example with conditional routing:
This creates a loop that increments count until it reaches 3.

Next Steps

Now that you’ve built your first LangGraph application, explore more advanced features:

Core Concepts

Learn about state management, reducers, and graph patterns

Checkpointing

Add persistence and enable time-travel debugging

Human-in-the-Loop

Pause execution for human approval or input

Examples

Explore real-world LangGraph applications
Want to build AI agents quickly? Check out create_react_agent for a high-level API built on LangGraph.

Troubleshooting

Import Errors

If you see ModuleNotFoundError, ensure LangGraph is installed:

Type Errors

Make sure you’re using typing_extensions.TypedDict (not typing.TypedDict) for Python 3.10 compatibility:

State Not Updating

Remember that node functions should return dictionaries with the keys to update:

Get Help

Need assistance? Here are some resources: