Skip to main content

CLI Commands

Complete reference for all LangGraph CLI commands and their options.

langgraph new

Create a new LangGraph project from a template.

Arguments

  • PATH (optional): Directory path where the project will be created. Defaults to current directory.

Options

  • --template TEXT: Template name to use for project scaffolding

Examples


langgraph dev

Run LangGraph API server in development mode with hot reloading and debugging support.
Requires langgraph-cli[inmem] to be installed and Python 3.11+.

Options

Server Configuration

  • --host TEXT
    Network interface to bind the server to
    Default: 127.0.0.1
    Security Note: Only use 0.0.0.0 in trusted networks
  • --port INTEGER
    Port number to bind the server to
    Default: 2024
  • --config PATH
    Path to configuration file declaring dependencies, graphs, and environment variables
    Default: langgraph.json

Development Features

  • --no-reload
    Disable automatic reloading when code changes are detected
    Default: Reload enabled
  • --no-browser
    Skip automatically opening the browser when the server starts
  • --studio-url TEXT
    URL of the LangGraph Studio instance to connect to
    Default: https://smith.langchain.com

Performance

  • --n-jobs-per-worker INTEGER
    Maximum number of concurrent jobs each worker process can handle
    Default: 10
  • --allow-blocking
    Don’t raise errors for synchronous I/O blocking operations in your code
    Default: Blocking operations raise errors

Debugging

  • --debug-port INTEGER
    Enable remote debugging by listening on specified port
    Requires: debugpy to be installed
  • --wait-for-client
    Wait for a debugger client to connect before starting the server
    Default: False

Networking

  • --tunnel
    Expose the local server via a public tunnel (Cloudflare) for remote frontend access
    Default: False
    Use Case: Avoid localhost connection issues with browsers or networks

Logging

  • --server-log-level TEXT
    Set the log level for the API server
    Default: WARNING
    Options: DEBUG, INFO, WARNING, ERROR, CRITICAL

Examples

Terminal Output

When the server starts, you’ll see:

langgraph up

Launch LangGraph API server in Docker with full production environment.

Options

Basic Configuration

  • -c, --config FILE
    Path to configuration file
    Default: langgraph.json
  • -p, --port INTEGER
    Port to expose
    Default: 8123

Docker Options

  • --pull / --no-pull
    Pull latest images or use locally-built images
    Default: --pull
  • --recreate / --no-recreate
    Recreate containers even if configuration and image haven’t changed
    Default: --no-recreate
  • -d, --docker-compose FILE
    Path to docker-compose.yml file with additional services to launch

Image Options

  • --image TEXT
    Docker image to use for the langgraph-api service
    Use Case: Test against an image already built using langgraph build
    Skips building and uses this image directly
  • --base-image TEXT
    Base image to use for the LangGraph API server
    Default: langchain/langgraph-api or langchain/langgraphjs-api
  • --api-version TEXT
    API server version to use for the base image
    Default: Latest version

Development Features

  • --watch
    Restart on file changes
    Note: Rebuilds and restarts containers when code changes
  • --wait
    Wait for services to start before returning
    Implies: --detach
  • --verbose
    Show detailed output from the server logs

Debugger Options

  • --debugger-port INTEGER
    Pull the debugger image locally and serve the UI on specified port
  • --debugger-base-url TEXT
    URL used by the debugger to access LangGraph API
    Default: http://127.0.0.1:[PORT]

Database Options

  • --postgres-uri TEXT
    Postgres URI to use for the database
    Default: Launches a local database

Examples

Terminal Output


langgraph build

Build a Docker image for your LangGraph application.

Options

Required

  • -t, --tag TEXT
    Tag for the docker image
    Required

Configuration

  • -c, --config FILE
    Path to configuration file
    Default: langgraph.json

Image Options

  • --base-image TEXT
    Base image to use for the LangGraph API server
    Default: langchain/langgraph-api or langchain/langgraphjs-api
  • --api-version TEXT
    API server version to use for the base image
    Default: Latest version
  • --pull / --no-pull
    Pull latest images or use locally-built images
    Default: --pull

Build Commands (JavaScript/TypeScript)

  • --install-command TEXT
    Custom install command to run from the build context root
    Auto-detects: Based on package manager files (package-lock.json, yarn.lock, etc.)
  • --build-command TEXT
    Custom build command to run from the langgraph.json directory
    Default: Uses default build process

Docker Build Arguments

You can pass additional arguments to docker build after all CLI options:
  • --platform: Target platforms (e.g., linux/amd64,linux/arm64)
  • --build-arg: Build-time variables
  • --cache-from: Images to consider as cache sources
  • --push: Push the image after building
  • And any other valid docker build arguments

Examples


langgraph dockerfile

Generate a Dockerfile for custom deployments.

Arguments

  • SAVE_PATH: Path where the Dockerfile will be saved (required)

Options

  • -c, --config FILE
    Path to configuration file
    Default: langgraph.json
  • --base-image TEXT
    Base image to use for the LangGraph API server
    Default: langchain/langgraph-api or langchain/langgraphjs-api
  • --api-version TEXT
    API server version to use for the base image
    Default: Latest version
  • --add-docker-compose
    Add additional files for running with docker-compose
    Creates: docker-compose.yml, .env, .dockerignore

Examples

Generated Files

With --add-docker-compose, the command creates:

Terminal Output


Global Options

These options work with all commands:

Version

Display the CLI version.

Help

Display help information for the CLI or a specific command.

Common Patterns

Local Development Workflow

Multi-Platform Builds

Using Custom Base Images

Docker Compose Development


Exit Codes

The CLI uses standard exit codes:
  • 0: Success
  • 1: General error (invalid arguments, command failed, etc.)
  • 2: Command line usage error

Environment Requirements

For langgraph dev

  • Python 3.11 or higher
  • langgraph-cli[inmem] installed

For langgraph up and langgraph build

  • Docker installed and running
  • Docker Compose (plugin or standalone)

For All Commands

  • Valid langgraph.json configuration file
  • Required API keys in environment or .env file