writing-skills
writing-skills
Use when creating new skills, editing existing skills, or verifying skills work before deployment
cli-deploymentCreate, validate, run, containerize, and troubleshoot LangGraph app deployments with the `langgraph` CLI and `langgraph.json`.
Independent GitHub snapshot · Automated classification · Original documentation governs
langgraph CLI and langgraph.json."
disable-model-invocation: true
metadata:
disco-role: operating
license: MITUse 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.
langgraph validate or scripts/validate_langgraph_config.py when the task is about config correctness before running anything expensive.langgraph dev for local Python development with hot reload and in-memory server behavior.langgraph up for Docker-backed local deployment with Compose, database/service containers, and production-like networking.langgraph dockerfile when the user wants generated Dockerfile/Compose artifacts to review or customize.langgraph build when the user wants a tagged Docker image.langgraph new when starting from an official template.langgraph deploy only for hosted deployment workflows after credentials/project requirements are clear.references/cli-reference.md for command selection, options, defaults, expected outputs, and validation order.references/configuration.md for langgraph.json schemas, Python vs JS branches, graph spec formats, Docker image knobs, and secure config patterns.references/troubleshooting.md for failures around installation, imports, invalid graph pointers, optional dependencies, Docker, sync/async behavior, and security warnings.scripts/validate_langgraph_config.py for offline shape/path/import checks that do not require Docker, credentials, or network.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:
dependencies and graphs are required for dependency-based Python configs.python_version accepts 3.11, 3.12, or 3.13 in the public schema; patch versions such as 3.11.8 are invalid.python_version to 3.11.image_distro defaults to debian; valid values are debian, bookworm, and wolfi; bullseye is deprecated.pip_installer accepts auto, pip, or uv../path/to/file.py:attribute for Python and JS/TS extensions for Node graphs.../graph-runtime/SKILL.md for graph compilation and runtime semantics.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.
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 dev defaults to host 127.0.0.1 and port 2024; only use 0.0.0.0 on trusted networks.--no-reload disables hot reload, and --no-browser skips automatic browser launch.--debug-port PORT enables remote debugging and requires debugpy; --wait-for-client pauses startup until a debugger attaches.--allow-blocking disables blocking-operation errors; use it only as a tactical debug aid and fix blocking synchronous I/O in production paths.dev does not support JS graphs in this CLI version; use the JS CLI for JS/TS graphs.Use up when the user wants production-like local infrastructure:
langgraph up -c langgraph.json --port 8123 --wait
Key behavior:
up exposes the API on port 8123 by default, unlike dev port 2024.--wait waits for services to start; without it, Compose runs with abort-on-container-exit semantics.--watch restarts on file changes.--verbose shows detailed logs.--recreate recreates containers and renews anonymous volumes.--pull/--no-pull controls whether latest base images are pulled.--postgres-uri points at an existing Postgres database; omit it to let the CLI compose local services.--engine-runtime-mode distributed uses separate executor and orchestrator containers; default is combined_queue_worker.--debugger-port PORT pulls and serves the debugger UI; --debugger-base-url URL controls which API URL that debugger uses.LANGSMITH_API_KEY may be required for LangSmith Deployment access; production use requires LANGGRAPH_CLOUD_LICENSE_KEY.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:
dockerfile validates config, writes a Dockerfile, and can add Compose, .dockerignore, and .env scaffolding.build requires Docker, a tag via -t/--tag, and optional --base-image/api_version pinning.api_version ranges include forms like ~=0.11.0.dev5 and >~=0.11.0.dev5.--install-command and --build-command reject unsafe shell characters and patterns, including quotes, backticks, pipes, redirection, semicolons, variables, newlines, and single &; && chaining is allowed.For dependency-based Python deployments:
dependencies."." when the config lives at the app package root.pip_config_file for 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.kind currently supports only uv.source.kind: "uv" is Python-only and requires python_version.dependencies; packages come from pyproject.toml and uv.lock.source.package when a uv workspace root has multiple possible members.For JS/TS deployments:
.ts, .mts, .cts, .js, .mjs, and .cjs select the Node branch.20 for Node graphs and must be at least major version 20.package.json engines.node must be a major version only, not 20.x.y.langgraph dev is not supported by this Python CLI version; use the JS CLI path.When graphs points to a bad object:
: separating module path and attribute.langgraph.json directory.dependencies are importable or installable.python skills/langgraph/sub-skills/cli-deployment/scripts/validate_langgraph_config.py langgraph.json --check-imports.StateGraph, compile it in source code and export the compiled object; see ../graph-runtime/SKILL.md.../prebuilt-agents/SKILL.md, ../persistence/SKILL.md, and ../sdk-clients/SKILL.md.env: ".env" for local development and keep secret files out of source control.langgraph.json unless the user explicitly requests an ephemeral local-only example.dev --host 127.0.0.1 unless there is a trusted-network reason to expose the server.dockerfile_lines, pip_config_file, base_image, api_version, and local dependencies.Before handing off a deployment change:
langgraph.json has valid dependencies/source, graphs, supported runtime versions, and no unknown typo keys.dev, up, dockerfile, build, or deploy.dev defaults to 2024; up defaults to 8123.