Skip to content

Commit 6b3b9e3

Browse files
hinthornwCopilot
andauthored
Update cli config (#1271)
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
1 parent aa6d17d commit 6b3b9e3

File tree

1 file changed

+37
-12
lines changed

1 file changed

+37
-12
lines changed

src/langsmith/cli.mdx

Lines changed: 37 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,6 @@ sidebarTitle: LangGraph CLI
1414
```bash [Python (pip)]
1515
pip install langgraph-cli
1616
```
17-
```bash Homebrew
18-
brew install langgraph-cli
19-
```
2017
```bash JavaScript
2118
# Use latest on demand
2219
npx @langchain/langgraph-cli
@@ -50,9 +47,9 @@ For JS, use `npx @langchain/langgraph-cli <command>` (or `langgraphjs` if instal
5047

5148
## Configuration file
5249

53-
The LangGraph CLI requires a JSON configuration file that follows this [schema](https://raw.githubusercontent.com/langchain-ai/langgraph/refs/heads/main/libs/cli/schemas/schema.json). It contains the following properties:
50+
To build and run a valid application, the LangGraph CLI requires a JSON configuration file that follows this [schema](https://raw.githubusercontent.com/langchain-ai/langgraph/refs/heads/main/libs/cli/schemas/schema.json). It contains the following properties:
5451

55-
<Note>The LangGraph CLI defaults to using the configuration file <strong>langgraph.json</strong> in the current directory.</Note>
52+
<Note>The LangGraph CLI defaults to using the configuration file named <strong>langgraph.json</strong> in the current directory.</Note>
5653

5754
<Tabs>
5855
<Tab title="Python">
@@ -72,8 +69,8 @@ The LangGraph CLI requires a JSON configuration file that follows this [schema](
7269
| <span style={{ whiteSpace: "nowrap" }}>`pip_installer`</span> | _(Added in v0.3)_ Optional. Python package installer selector. It can be set to `"auto"`, `"pip"`, or `"uv"`. From version 0.3 onward the default strategy is to run `uv pip`, which typically delivers faster builds while remaining a drop-in replacement. In the uncommon situation where `uv` cannot handle your dependency graph or the structure of your `pyproject.toml`, specify `"pip"` here to revert to the earlier behaviour. |
7370
| <span style={{ whiteSpace: "nowrap" }}>`keep_pkg_tools`</span> | _(Added in v0.3.4)_ Optional. Control whether to retain Python packaging tools (`pip`, `setuptools`, `wheel`) in the final image. Accepted values: <ul><li><code>true</code> : Keep all three tools (skip uninstall).</li><li><code>false</code> / omitted : Uninstall all three tools (default behaviour).</li><li><code>list[str]</code> : Names of tools <strong>to retain</strong>. Each value must be one of "pip", "setuptools", "wheel".</li></ul>. By default, all three tools are uninstalled. |
7471
| <span style={{ whiteSpace: "nowrap" }}>`dockerfile_lines`</span> | Array of additional lines to add to Dockerfile following the import from parent image. |
75-
| <span style={{ whiteSpace: "nowrap" }}>`checkpointer`</span> | Configuration for the checkpointer. Contains a `ttl` field which is an object with the following keys: <ul><li>`strategy`: How to handle expired checkpoints (e.g., `"delete"`).</li><li>`sweep_interval_minutes`: How often to check for expired checkpoints (integer).</li><li>`default_ttl`: Default time-to-live for checkpoints in **minutes** (integer); applied to newly created checkpoints/threads only (existing data is unchanged). Defines how long checkpoints are kept before the specified strategy is applied.</li></ul> |
76-
| <span style={{ whiteSpace: "nowrap" }}>`http`</span> | HTTP server configuration with the following fields: <ul><li>`app`: Path to custom Starlette/FastAPI app (e.g., `"./src/agent/webapp.py:app"`). See [custom routes guide](/langsmith/custom-routes).</li><li>`cors`: CORS configuration with fields for `allow_origins`, `allow_methods`, `allow_headers`, etc.</li><li>`configurable_headers`: Define which request headers to exclude or include as a run's configurable values.</li><li>`disable_assistants`: Disable `/assistants` routes</li><li>`disable_mcp`: Disable `/mcp` routes</li><li>`disable_meta`: Disable `/ok`, `/info`, `/metrics`, and `/docs` routes</li><li>`disable_runs`: Disable `/runs` routes</li><li>`disable_store`: Disable `/store` routes</li><li>`disable_threads`: Disable `/threads` routes</li><li>`disable_ui`: Disable `/ui` routes</li><li>`disable_webhooks`: Disable webhooks calls on run completion in all routes</li><li>`mount_prefix`: Prefix for mounted routes (e.g., "/my-deployment/api")</li></ul> |
72+
| <span style={{ whiteSpace: "nowrap" }}>`checkpointer`</span> | Configuration for the checkpointer. Supports: <ul><li>`ttl` (optional): Object with `strategy`, `sweep_interval_minutes`, `default_ttl` controlling checkpoint expiry.</li><li>`serde` (optional, 0.5+): Object with `allowed_json_modules` and `pickle_fallback` to tune deserialization behavior.</li></ul> |
73+
| <span style={{ whiteSpace: "nowrap" }}>`http`</span> | HTTP server configuration with the following fields: <ul><li>`app`: Path to custom Starlette/FastAPI app (e.g., `"./src/agent/webapp.py:app"`). See [custom routes guide](/langsmith/custom-routes).</li><li>`cors`: CORS configuration with fields such as `allow_origins`, `allow_methods`, `allow_headers`, `allow_credentials`, `allow_origin_regex`, `expose_headers`, and `max_age`.</li><li>`configurable_headers`: Define which request headers to expose as configurable values via `includes` / `excludes` patterns.</li><li>`logging_headers`: Mirror of `configurable_headers` for excluding sensitive headers from logs.</li><li>`middleware_order`: Choose how custom middleware and auth interact. `auth_first` runs authentication hooks before custom middleware, while `middleware_first` (default) runs your middleware first.</li><li>`enable_custom_route_auth`: Apply auth checks to routes added through `app`.</li><li>`disable_assistants`, `disable_mcp`, `disable_meta`, `disable_runs`, `disable_store`, `disable_threads`, `disable_ui`, `disable_webhooks`: Disable built-in routes or hooks.</li><li>`mount_prefix`: Prefix for mounted routes (e.g., "/my-deployment/api").</li></ul> |
7774
| <span style={{ whiteSpace: "nowrap" }}>`api_version`</span> | _(Added in v0.3.7)_ Which semantic version of the LangGraph API server to use (e.g., `"0.3"`). Defaults to latest. Check the server [changelog](/langsmith/langgraph-server-changelog) for details on each release. |
7875
</Tab>
7976
<Tab title="JS">
@@ -84,7 +81,8 @@ The LangGraph CLI requires a JSON configuration file that follows this [schema](
8481
| <span style={{ whiteSpace: "nowrap" }}>`store`</span> | Configuration for adding semantic search and/or time-to-live (TTL) to the BaseStore. Contains the following fields: <ul><li>`index` (optional): Configuration for semantic search indexing with fields `embed`, `dims`, and optional `fields`.</li><li>`ttl` (optional): Configuration for item expiration. An object with optional fields: `refresh_on_read` (boolean, defaults to `true`), `default_ttl` (float, lifespan in **minutes**; applied to newly created items only; existing items are unchanged; defaults to no expiration), and `sweep_interval_minutes` (integer, how often to check for expired items, defaults to no sweeping).</li></ul> |
8582
| <span style={{ whiteSpace: "nowrap" }}>`node_version`</span> | Specify `node_version: 20` to use LangGraph.js. |
8683
| <span style={{ whiteSpace: "nowrap" }}>`dockerfile_lines`</span> | Array of additional lines to add to Dockerfile following the import from parent image. |
87-
| <span style={{ whiteSpace: "nowrap" }}>`checkpointer`</span> | Configuration for the checkpointer. Contains a `ttl` field which is an object with the following keys: <ul><li>`strategy`: How to handle expired checkpoints (e.g., `"delete"`).</li><li>`sweep_interval_minutes`: How often to check for expired checkpoints (integer).</li><li>`default_ttl`: Default time-to-live for checkpoints in **minutes** (integer); applied to newly created checkpoints/threads only (existing data is unchanged). Defines how long checkpoints are kept before the specified strategy is applied.</li></ul> |
84+
| <span style={{ whiteSpace: "nowrap" }}>`checkpointer`</span> | Configuration for the checkpointer. Supports: <ul><li>`ttl` (optional): Object with `strategy`, `sweep_interval_minutes`, `default_ttl` controlling checkpoint expiry.</li><li>`serde` (optional, 0.5+): Object with `allowed_json_modules` and `pickle_fallback` to tune deserialization behavior.</li></ul> |
85+
| <span style={{ whiteSpace: "nowrap" }}>`http`</span> | HTTP server configuration mirroring the Python options: <ul><li>`cors` with `allow_origins`, `allow_methods`, `allow_headers`, `allow_credentials`, `allow_origin_regex`, `expose_headers`, `max_age`.</li><li>`configurable_headers` and `logging_headers` pattern lists.</li><li>`middleware_order` (`auth_first` or `middleware_first`).</li><li>`enable_custom_route_auth` plus the same boolean route toggles as above.</li></ul> |
8886
| <span style={{ whiteSpace: "nowrap" }}>`api_version`</span> | _(Added in v0.3.7)_ Which semantic version of the LangGraph API server to use (e.g., `"0.3"`). Defaults to latest. Check the server [changelog](/langsmith/langgraph-server-changelog) for details on each release. |
8987
</Tab>
9088
</Tabs>
@@ -249,11 +247,10 @@ The LangGraph CLI requires a JSON configuration file that follows this [schema](
249247
<a id="ttl"></a>
250248
#### Configuring checkpoint Time-to-Live
251249

252-
You can configure the time-to-live (TTL) for checkpoints using the `checkpointer` key. This determines how long checkpoint data is retained before being automatically handled according to the specified strategy (e.g., deletion). The `ttl` configuration is an object containing:
250+
You can configure the time-to-live (TTL) for checkpoints using the `checkpointer` key. This determines how long checkpoint data is retained before being automatically handled according to the specified strategy (e.g., deletion). Two optional sub-objects are supported:
253251

254-
* `strategy`: The action to take on expired checkpoints (currently `"delete"` is the only accepted option).
255-
* `sweep_interval_minutes`: How frequently (in minutes) the system checks for expired checkpoints.
256-
* `default_ttl`: The default lifespan of a checkpoint in **minutes**. Applies only to checkpoints/threads created after deployment; existing data is not modified.
252+
* `ttl`: Includes `strategy`, `sweep_interval_minutes`, and `default_ttl`, which collectively set how checkpoints expire.
253+
* `serde` _(LangGraph server 0.5+)_ : Lets you control deserialization behavior for checkpoint payloads.
257254

258255
Here's an example setting a default TTL of 30 days (43200 minutes):
259256

@@ -276,6 +273,34 @@ The LangGraph CLI requires a JSON configuration file that follows this [schema](
276273

277274
In this example, checkpoints older than 30 days will be deleted, and the check runs every 10 minutes.
278275

276+
#### Configuring checkpointer serde
277+
278+
The `checkpointer.serde` object shapes deserialization:
279+
280+
* `allowed_json_modules` defines an allow list for custom Python objects you want the server to be able to deserialize from payloads saved in "json" mode. This is a list of `[path, to, module, file, symbol]` sequences. If omitted, only LangChain-safe defaults are allowed. You can unsafely set to `true` to allow any module to be deserialized.
281+
* `pickle_fallback`: Whether to fall back to pickle deserialization when JSON decoding fails.
282+
283+
```json
284+
{
285+
"checkpointer": {
286+
"serde": {
287+
"allowed_json_modules": [
288+
["my_agent", "auth", "SessionState"]
289+
]
290+
}
291+
}
292+
}
293+
```
294+
295+
#### Customizing HTTP middleware and headers
296+
297+
The `http` block lets you fine-tune request handling:
298+
299+
* `middleware_order`: Choose `"auth_first"` to run authentication before your middleware, or `"middleware_first"` (default) to invert that order.
300+
* `enable_custom_route_auth`: Extend authentication to routes you mount through `http.app`.
301+
* `configurable_headers` / `logging_headers`: Each accepts an object with optional `includes` and `excludes` arrays; wildcards are supported and exclusions run before inclusions.
302+
* `cors`: In addition to `allow_origins`, `allow_methods`, and `allow_headers`, you can set `allow_credentials`, `allow_origin_regex`, `expose_headers`, and `max_age` for detailed browser control.
303+
279304
<a id="api-version"></a>
280305
#### Pinning API version
281306

0 commit comments

Comments
 (0)