0
# CLI Commands
1
2
Core command-line interface providing all LangGraph development and deployment workflows. All commands support `--help` for detailed option information.
3
4
## Capabilities
5
6
### Project Creation
7
8
Create new LangGraph projects from predefined templates.
9
10
```bash { .api }
11
langgraph new [PATH] --template TEMPLATE_NAME
12
```
13
14
**Parameters:**
15
- `PATH` (optional): Directory path for new project
16
- `--template`: Template identifier (see Templates documentation)
17
18
**Usage Examples:**
19
20
```bash
21
# Create project in current directory with interactive template selection
22
langgraph new
23
24
# Create project in specific directory
25
langgraph new ./my-langgraph-app
26
27
# Create project with specific template
28
langgraph new my-project --template react-agent-python
29
```
30
31
### Development Server
32
33
Run LangGraph API server in development mode with hot reloading and debugging capabilities.
34
35
```bash { .api }
36
langgraph dev [OPTIONS]
37
```
38
39
**Key Options:**
40
- `--host TEXT`: Network interface to bind (default: 127.0.0.1)
41
- `--port INTEGER`: Port number (default: 2024)
42
- `--no-reload`: Disable automatic reloading
43
- `--config, -c FILE`: Configuration file path (default: langgraph.json)
44
- `--n-jobs-per-worker INTEGER`: Max concurrent jobs per worker
45
- `--no-browser`: Skip opening browser window
46
- `--debug-port INTEGER`: Enable remote debugging on port
47
- `--wait-for-client`: Wait for debugger connection
48
- `--studio-url TEXT`: LangGraph Studio URL
49
- `--allow-blocking`: Don't raise errors for blocking I/O
50
- `--tunnel`: Expose via public tunnel
51
- `--server-log-level TEXT`: API server log level (default: WARNING)
52
53
**Usage Examples:**
54
55
```bash
56
# Basic development server
57
langgraph dev
58
59
# Custom port and host
60
langgraph dev --host 0.0.0.0 --port 3000
61
62
# Development with debugging
63
langgraph dev --debug-port 5678 --wait-for-client
64
65
# Disable auto-reload and browser opening
66
langgraph dev --no-reload --no-browser
67
```
68
69
### Production Deployment
70
71
Launch LangGraph API server using Docker Compose for production deployment.
72
73
```bash { .api }
74
langgraph up [OPTIONS]
75
```
76
77
**Key Options:**
78
- `--port, -p INTEGER`: Port to expose (default: 8123)
79
- `--config, -c FILE`: Configuration file path (default: langgraph.json)
80
- `--docker-compose, -d FILE`: Additional docker-compose.yml file
81
- `--recreate/--no-recreate`: Container recreation control (default: no-recreate)
82
- `--pull/--no-pull`: Pull latest images (default: pull)
83
- `--watch`: Restart on file changes
84
- `--wait`: Wait for services to start
85
- `--verbose`: Show detailed server logs
86
- `--debugger-port INTEGER`: Serve debugger UI on port
87
- `--debugger-base-url TEXT`: URL for debugger to access API
88
- `--postgres-uri TEXT`: Custom PostgreSQL connection string
89
- `--api-version TEXT`: API server version to use
90
- `--image TEXT`: Pre-built Docker image to use
91
- `--base-image TEXT`: Base image for the server
92
93
**Usage Examples:**
94
95
```bash
96
# Basic production deployment
97
langgraph up
98
99
# Custom port and configuration
100
langgraph up --port 9000 --config my-config.json
101
102
# With additional services and debugging
103
langgraph up --docker-compose docker-compose.services.yml --debugger-port 8080
104
105
# Force recreate containers with verbose logging
106
langgraph up --recreate --verbose --wait
107
```
108
109
### Image Building
110
111
Build Docker images for LangGraph applications for deployment or distribution.
112
113
```bash { .api }
114
langgraph build -t IMAGE_TAG [OPTIONS] [DOCKER_BUILD_ARGS]...
115
```
116
117
**Key Options:**
118
- `--tag, -t TEXT`: Docker image tag (required)
119
- `--config, -c FILE`: Configuration file path (default: langgraph.json)
120
- `--pull/--no-pull`: Pull latest base images (default: pull)
121
- `--base-image TEXT`: Override base image
122
- `--api-version TEXT`: API server version
123
- `--install-command TEXT`: Custom install command
124
- `--build-command TEXT`: Custom build command
125
126
**Parameters:**
127
- `DOCKER_BUILD_ARGS`: Additional Docker build arguments (passed through)
128
129
**Usage Examples:**
130
131
```bash
132
# Basic image build
133
langgraph build -t my-app:latest
134
135
# Multi-platform build with custom base image
136
langgraph build -t my-app:v1.0 --base-image python:3.11-slim --platform linux/amd64,linux/arm64
137
138
# Build with custom configuration and no base image pull
139
langgraph build -t my-app:dev --config dev.json --no-pull
140
141
# Advanced build with Docker build args
142
langgraph build -t my-app:latest --build-arg HTTP_PROXY=http://proxy.example.com:8080
143
```
144
145
### File Generation
146
147
Generate Dockerfile and Docker Compose files for custom deployment workflows.
148
149
```bash { .api }
150
langgraph dockerfile SAVE_PATH [OPTIONS]
151
```
152
153
**Parameters:**
154
- `SAVE_PATH`: Path where Dockerfile will be saved (required)
155
156
**Key Options:**
157
- `--config, -c FILE`: Configuration file path (default: langgraph.json)
158
- `--add-docker-compose`: Generate docker-compose.yml and related files
159
- `--base-image TEXT`: Override base image
160
- `--api-version TEXT`: API server version
161
162
**Usage Examples:**
163
164
```bash
165
# Generate Dockerfile only
166
langgraph dockerfile ./Dockerfile
167
168
# Generate Dockerfile and Docker Compose files
169
langgraph dockerfile ./Dockerfile --add-docker-compose
170
171
# Generate with custom configuration and base image
172
langgraph dockerfile ./deploy/Dockerfile --config prod.json --base-image python:3.12-alpine
173
```
174
175
## Global Options
176
177
All commands support these global options:
178
179
- `--help`: Show help message and available options
180
- `--version`: Show CLI version information
181
182
## Configuration File
183
184
All commands default to using `langgraph.json` in the current directory. This file defines:
185
186
- **dependencies**: Python/Node.js packages required
187
- **graphs**: Mapping of graph IDs to import paths
188
- **env**: Environment variables (file path or dictionary)
189
- **python_version**: Python runtime version (3.11, 3.12, 3.13)
190
191
Example minimal configuration:
192
193
```json
194
{
195
"dependencies": ["langchain_openai", "."],
196
"graphs": {
197
"my_graph": "./src/graph.py:compiled_graph"
198
},
199
"env": "./.env"
200
}
201
```
202
203
## Error Handling
204
205
The CLI provides detailed error messages for common issues:
206
207
- **Configuration validation errors**: Invalid langgraph.json format or missing required fields
208
- **Docker errors**: Missing Docker/Docker Compose or insufficient permissions
209
- **Port conflicts**: Port already in use for development or production servers
210
- **Template errors**: Invalid or missing template specifications
211
- **Build failures**: Docker build errors with context and suggestions
212
213
Use `--verbose` flag with applicable commands for additional debugging information.