LangGraph CLI
The LangGraph CLI is the official command-line interface for LangGraph, providing tools to create, develop, and deploy LangGraph applications locally and to production environments.What is the LangGraph CLI?
The CLI streamlines your LangGraph development workflow by:- Creating new projects from templates
- Developing locally with hot reloading and debugging
- Building Docker images for deployment
- Testing your graphs in a production-like environment
- Deploying to cloud platforms or self-hosted infrastructure
Installation
Install the CLI via pip:The in-memory development server requires Python 3.11 or higher.
Quick Start
1. Create a New Project
Start a new LangGraph project from a template:2. Develop Locally
Run your agent with hot reloading:http://localhost:2024 with:
- Automatic code reloading on file changes
- Interactive API documentation at
/docs - LangGraph Studio integration
3. Test with Docker
Test your agent in a production-like environment:4. Build for Production
Create a Docker image for deployment:Core Concepts
Configuration File
The CLI uses alanggraph.json configuration file that defines:
- Dependencies: Python packages required by your agent
- Graphs: Entry points to your compiled graph objects
- Environment: Variables and configuration for runtime
- Python Version: Target Python version for deployment
langgraph.json:
Development vs Production
The CLI provides two modes for running your agent:| Feature | langgraph dev | langgraph up |
|---|---|---|
| Environment | In-memory server | Docker containers |
| Hot Reload | Yes | Optional with --watch |
| Setup Time | Fast | Slower (builds image) |
| Use Case | Development | Testing, Production |
| Requirements | Python 3.11+ | Docker |
Command Overview
The CLI provides five main commands:langgraph new
Create a new project from a template
langgraph dev
Run a development server with hot reloading
langgraph up
Launch the API server in Docker
langgraph build
Build a Docker image for deployment
langgraph dockerfile
Generate a Dockerfile for custom deployments
Typical Workflow
- Create: Use
langgraph newto scaffold a project - Develop: Use
langgraph devfor rapid iteration with hot reload - Test: Use
langgraph upto test in Docker before deploying - Build: Use
langgraph buildto create production images - Deploy: Push your image to your container registry and deploy
Project Structure
A typical LangGraph project structure:Environment Variables
The CLI respects environment variables defined in:.envfiles (referenced inlanggraph.json)- System environment variables
- Docker Compose environment configurations
Next Steps
- Learn about all CLI commands and options
- Understand langgraph.json configuration
- Explore deployment options