cli-deployment
Create, validate, run, containerize, and troubleshoot LangGraph app deployments with the `langgraph` CLI and `langgraph.json`.
- License 许可
- MIT
- 最近更新
- 2026-10-08
- Stars
- ★ 11
- Forks
- 3
01 前言 Front Matter
- name
- cli-deployment
- license
- MIT
- metadata
- { "disco-role": "operating" }
- description
- Create, validate, run, containerize, and troubleshoot LangGraph app deployments with the `langgraph` CLI and `langgraph.json`.
- disable-model-invocation
- true
02 资源文件 3
- 参考文档references/cli-reference.md7.4 KB
- 参考文档references/configuration.md6.5 KB
- 参考文档references/troubleshooting.md7.0 KB
03 SKILL.md 正文
LangGraph CLI Deployment
Use this sub-skill when a task involves shipping a LangGraph app through the official langgraph CLI: creating starter projects, repairing langgraph.json, running the in-memory development server, running Docker Compose locally, generating Dockerfiles, building images, or choosing the right deployment command.
Quick Routing
- Use
langgraph validateorscripts/validate_langgraph_config.pywhen the task is about config correctness before running anything expensive. - Use
langgraph devfor local Python development with hot reload and in-memory server behavior. - Use
langgraph upfor Docker-backed local deployment with Compose, database/service containers, and production-like networking. - Use
langgraph dockerfilewhen the user wants generated Dockerfile/Compose artifacts to review or customize. - Use
langgraph buildwhen the user wants a tagged Docker image. - Use
langgraph newwhen starting from an official template. - Use
langgraph deployonly for hosted deployment workflows after credentials/project requirements are clear.
References and Scripts
- Read
references/cli-reference.mdfor command selection, options, defaults, expected outputs, and validation order. - Read
references/configuration.mdforlanggraph.jsonschemas, Python vs JS branches, graph spec formats, Docker image knobs, and secure config patterns. - Read
references/troubleshooting.mdfor failures around installation, imports, invalid graph pointers, optional dependencies, Docker, sync/async behavior, and security warnings. - Run
scripts/validate_langgraph_config.pyfor offline shape/path/import checks that do not require Docker, credentials, or network.
Minimal Config Pattern
For a Python app, start with:
{
"$schema": "https://langgra.ph/schema.json",
"python_version": "3.11",
"dependencies": ["."],
"graphs": {
"agent": "./agent.py:graph"
},
"env": ".env"
}
Important defaults and constraints:
dependenciesandgraphsare required for dependency-based Python configs.python_versionaccepts3.11,3.12, or3.13in the public schema; patch versions such as3.11.8are invalid.- If omitted for Python graphs, the CLI defaults
python_versionto3.11. image_distrodefaults todebian; valid values aredebian,bookworm, andwolfi;bullseyeis deprecated.pip_installeracceptsauto,pip, oruv.- Graph specs use
./path/to/file.py:attributefor Python and JS/TS extensions for Node graphs. - The graph object should be an already compiled LangGraph/Pregel object or an accepted graph factory/context manager per CLI schema; see
../graph-runtime/SKILL.mdfor graph compilation and runtime semantics.
Validate Before Running
Preferred validation sequence:
-
Run the bundled offline checker:
python skills/langgraph/sub-skills/cli-deployment/scripts/validate_langgraph_config.py langgraph.json --check-imports -
Run the official CLI validator:
langgraph validate -c langgraph.json -
If the task involves Docker output, generate a Dockerfile before building:
langgraph dockerfile Dockerfile -c langgraph.json
Expected langgraph validate success output includes Configuration file ... is valid and the number of graphs found. Unknown top-level keys can emit warnings such as likely misspellings.
Local Development
Use dev for fast Python iteration:
pip install -U "langgraph-cli[inmem]"
langgraph dev -c langgraph.json --host 127.0.0.1 --port 2024
Operational notes:
langgraph devdefaults to host127.0.0.1and port2024; only use0.0.0.0on trusted networks.--no-reloaddisables hot reload, and--no-browserskips automatic browser launch.--debug-port PORTenables remote debugging and requiresdebugpy;--wait-for-clientpauses startup until a debugger attaches.--allow-blockingdisables blocking-operation errors; use it only as a tactical debug aid and fix blocking synchronous I/O in production paths.devdoes not support JS graphs in this CLI version; use the JS CLI for JS/TS graphs.
Docker-Backed Local Runs
Use up when the user wants production-like local infrastructure:
langgraph up -c langgraph.json --port 8123 --wait
Key behavior:
upexposes the API on port8123by default, unlikedevport2024.--waitwaits for services to start; without it, Compose runs with abort-on-container-exit semantics.--watchrestarts on file changes.--verboseshows detailed logs.--recreaterecreates containers and renews anonymous volumes.--pull/--no-pullcontrols whether latest base images are pulled.--postgres-uripoints at an existing Postgres database; omit it to let the CLI compose local services.--engine-runtime-mode distributeduses separate executor and orchestrator containers; default iscombined_queue_worker.--debugger-port PORTpulls and serves the debugger UI;--debugger-base-url URLcontrols which API URL that debugger uses.- For local dev with Docker,
LANGSMITH_API_KEYmay be required for LangSmith Deployment access; production use requiresLANGGRAPH_CLOUD_LICENSE_KEY.
Build and Dockerfile Workflows
Generate reviewable artifacts:
langgraph dockerfile Dockerfile -c langgraph.json --add-docker-compose
Build a tagged image:
langgraph build -c langgraph.json -t my-langgraph-app:latest
Build notes:
dockerfilevalidates config, writes a Dockerfile, and can add Compose,.dockerignore, and.envscaffolding.buildrequires Docker, a tag via-t/--tag, and optional--base-image/api_versionpinning.- Compatible
api_versionranges include forms like~=0.11.0.dev5and>~=0.11.0.dev5. - Custom
--install-commandand--build-commandreject unsafe shell characters and patterns, including quotes, backticks, pipes, redirection, semicolons, variables, newlines, and single&;&&chaining is allowed. - Prefer config-managed dependencies over custom shell commands whenever possible.
Dependency and Source Choices
For dependency-based Python deployments:
- Put PyPI packages and local relative directories in
dependencies. - Use
"."when the config lives at the app package root. - Local dependency entries must point at real directories that can be installed or copied into the Docker context.
- Use
pip_config_filefor pip index configuration, but avoid committing credentials.
For uv-managed Python deployments:
{
"python_version": "3.12",
"source": {"kind": "uv", "root": ".", "package": "agent"},
"graphs": {"agent": "./src/agent/graph.py:graph"}
}
Rules:
source.kindcurrently supports onlyuv.source.kind: "uv"is Python-only and requirespython_version.- Remove
dependencies; packages come frompyproject.tomlanduv.lock. - Use
source.packagewhen a uv workspace root has multiple possible members.
For JS/TS deployments:
- Graph file extensions such as
.ts,.mts,.cts,.js,.mjs, and.cjsselect the Node branch. - Node version defaults to
20for Node graphs and must be at least major version20. package.jsonengines.nodemust be a major version only, not20.x.y.- JS in-memory
langgraph devis not supported by this Python CLI version; use the JS CLI path.
Graph Export Repair Checklist
When graphs points to a bad object:
- Confirm each spec has exactly one
:separating module path and attribute. - Confirm the module path exists relative to the
langgraph.jsondirectory. - Confirm local package directories listed in
dependenciesare importable or installable. - Import the target with
python skills/langgraph/sub-skills/cli-deployment/scripts/validate_langgraph_config.py langgraph.json --check-imports. - If the object is an uncompiled
StateGraph, compile it in source code and export the compiled object; see../graph-runtime/SKILL.md. - If the graph relies on prebuilt agents/tools, persistence, or SDK clients, cross-check
../prebuilt-agents/SKILL.md,../persistence/SKILL.md, and../sdk-clients/SKILL.md.
Security and Secrets
- Prefer
env: ".env"for local development and keep secret files out of source control. - Do not put real API keys directly in
langgraph.jsonunless the user explicitly requests an ephemeral local-only example. - Keep
dev --host 127.0.0.1unless there is a trusted-network reason to expose the server. - Review generated Docker artifacts before publishing images, especially
dockerfile_lines,pip_config_file,base_image,api_version, and local dependencies. - Do not run Docker build/up commands automatically if they may pull images, start services, consume credentials, or mutate volumes without user confirmation.
Completion Checklist
Before handing off a deployment change:
langgraph.jsonhas validdependencies/source,graphs, supported runtime versions, and no unknown typo keys.- Graph targets import successfully or the remaining import failure is explained with exact missing package/module names.
- Command choice is justified:
dev,up,dockerfile,build, ordeploy. - Ports are explicit when communicating expected URLs:
devdefaults to2024;updefaults to8123. - Docker requirements, credentials, optional extras, and persistence backends are called out.
- Generated files do not embed secrets, local absolute paths, or private environment paths.
04 同仓库更多 Skills
obsidian-clipper-template-creator
Guide for creating templates for the Obsidian Web Clipper. Use when you want to create a new clipping template, understand available variables, or format clipped content.
obsidian-clipper-template-creator
Guide for creating templates for the Obsidian Web Clipper. Use when you want to create a new clipping template, understand available variables, or format clipped content.
python-api
Programmatic Object-Detection-Metrics API guidance for BoundingBox, BoundingBoxes, Evaluator, enums, coordinate conversion, AP/mAP semantics, and source-style import diagnostics.
file-evaluation
Folder-based PASCAL VOC AP/mAP evaluation from ground-truth and detection text files.
object-detection-metrics
Guides legacy Object-Detection-Metrics PASCAL VOC AP/mAP evaluation from detection text folders and direct Python API classes.
nx-workspace-patterns
Configure and optimize Nx monorepo workspaces. Use when setting up Nx, configuring project boundaries, optimizing build caching, or implementing affected commands.