feat(cli): add keep_latest prune strategy to ThreadTTLConfig (#6784)

## Summary
- Add `"keep_latest"` to `ThreadTTLConfig.strategy` to match
langgraph-api support for pruning old checkpoints while retaining the
thread and its latest state
- Add `sweep_limit` to `ThreadTTLConfig` where the API actually reads it
(was previously a no-op on `CheckpointerConfig`)
- Regenerate `schema.json` / `schema.v0.json`

## Test plan
- [x] `make format && make lint` passes
- [x] `make test` passes (85/85)

---------

Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
William FH
2026-02-11 19:00:48 -08:00
committed by GitHub
co-authored by Claude Opus 4.6
parent f9870bc9ae
commit f5e56e200d
8 changed files with 47 additions and 40 deletions
+2 -2
View File
@@ -63,7 +63,7 @@ def test(config: pathlib.Path, port: int, tag: str, verbose: bool):
try:
sys.stderr.write("\n== docker compose ps ==\n")
runner.run(
subp_exec(*compose_cmd, *args, "ps", input=stdin, verbose=False)
subp_exec(*compose_cmd, *args, "ps", input=stdin, verbose=True)
)
except Exception:
pass
@@ -76,7 +76,7 @@ def test(config: pathlib.Path, port: int, tag: str, verbose: bool):
"logs",
"langgraph-api",
input=stdin,
verbose=False,
verbose=True,
)
)
except Exception:
+2 -2
View File
@@ -96,8 +96,8 @@ jobs:
timeout 60 python ../../../../.github/scripts/run_langgraph_cli_test.py -t langgraph-test-h
echo "Finished starting up langgraph-test-h"
LANGGRAPH_VERSION=$(docker run --rm --entrypoint "" langgraph-test-h python -c "import sys; from importlib.metadata import version; v = version('langgraph'); print(v);")
if [ "$LANGGRAPH_VERSION" != "1.0.2" ]; then
echo "LANGGRAPH_VERSION != 1.0.2; $LANGGRAPH_VERSION"
if [ "$LANGGRAPH_VERSION" != "1.0.8" ]; then
echo "LANGGRAPH_VERSION != 1.0.8; $LANGGRAPH_VERSION"
exit 1
fi
LANGCHAIN_OPENAI_VERSION=$(docker run --rm --entrypoint "" langgraph-test-h python -c "import sys; from importlib.metadata import version; v = version('langchain-openai'); print(v);")
@@ -5,5 +5,5 @@ description = "Test for prerelease stuff"
readme = "README.md"
requires-python = ">=3.10"
dependencies = [
"langgraph==1.0.2"
"langgraph==1.0.8"
]
@@ -7,7 +7,7 @@ requires-python = ">=3.10"
dependencies = [
"langchain-openai==1.0.0a2",
"langchain-anthropic==1.0.0a5",
"langgraph==1.0.2"
"langgraph==1.0.8"
]
[tool.uv]
+5
View File
@@ -196,6 +196,11 @@ def validate_config(config: Config) -> Config:
f"Python version {pyversion} is not supported. "
f"Minimum required version is {MIN_PYTHON_VERSION}."
)
if "bullseye" in pyversion:
raise click.UsageError(
"Bullseye images were deprecated in version 0.4.13. "
"Please use 'bookworm' or 'debian' instead."
)
if not config["dependencies"]:
raise click.UsageError(
+8 -8
View File
@@ -107,17 +107,19 @@ class StoreConfig(TypedDict, total=False):
class ThreadTTLConfig(TypedDict, total=False):
"""Configure a default TTL for checkpointed data within threads."""
strategy: Literal["delete"]
"""Strategy to use for deleting checkpointed data.
Choices:
- "delete": Delete all checkpoints for a thread after TTL expires.
strategy: Literal["delete", "keep_latest"]
"""Action taken when a thread exceeds its TTL.
- "delete": Remove the thread and all its data entirely.
- "keep_latest": Prune old checkpoints but keep the thread and its latest state.
"""
default_ttl: float | None
"""Default TTL (time-to-live) in minutes for checkpointed data."""
sweep_interval_minutes: int | None
"""Interval in minutes between sweep iterations.
If omitted, a default interval will be used (typically ~ 5 minutes)."""
sweep_limit: int | None
"""Maximum number of threads to process per sweep iteration. Defaults to 1000."""
class SerdeConfig(TypedDict, total=False):
@@ -173,14 +175,12 @@ class CheckpointerConfig(TypedDict, total=False):
"""
serde: SerdeConfig | None
"""Optional. Defines the serde configuration.
If provided, the checkpointer will apply serde settings according to the configuration.
If omitted, no serde behavior is configured.
This configuration requires server version 0.5 or later to take effect.
"""
sweep_limit: int | None
"""Maximum number of threads to process per sweep iteration. Defaults to 1000."""
class SecurityConfig(TypedDict, total=False):
+14 -13
View File
@@ -553,17 +553,6 @@
],
"description": "Optional. Defines the serde configuration.\n\nIf provided, the checkpointer will apply serde settings according to the configuration.\nIf omitted, no serde behavior is configured.\n\nThis configuration requires server version 0.5 or later to take effect.\n"
},
"sweep_limit": {
"anyOf": [
{
"type": "integer"
},
{
"type": "null"
}
],
"description": "Maximum number of threads to process per sweep iteration. Defaults to 1000."
},
"ttl": {
"anyOf": [
{
@@ -628,9 +617,10 @@
},
"strategy": {
"enum": [
"delete"
"delete",
"keep_latest"
],
"description": "Strategy to use for deleting checkpointed data.\n"
"description": "Action taken when a thread exceeds its TTL.\n\n"
},
"sweep_interval_minutes": {
"anyOf": [
@@ -642,6 +632,17 @@
}
],
"description": "Interval in minutes between sweep iterations.\nIf omitted, a default interval will be used (typically ~ 5 minutes)."
},
"sweep_limit": {
"anyOf": [
{
"type": "integer"
},
{
"type": "null"
}
],
"description": "Maximum number of threads to process per sweep iteration. Defaults to 1000."
}
},
"required": []
+14 -13
View File
@@ -553,17 +553,6 @@
],
"description": "Optional. Defines the serde configuration.\n\nIf provided, the checkpointer will apply serde settings according to the configuration.\nIf omitted, no serde behavior is configured.\n\nThis configuration requires server version 0.5 or later to take effect.\n"
},
"sweep_limit": {
"anyOf": [
{
"type": "integer"
},
{
"type": "null"
}
],
"description": "Maximum number of threads to process per sweep iteration. Defaults to 1000."
},
"ttl": {
"anyOf": [
{
@@ -628,9 +617,10 @@
},
"strategy": {
"enum": [
"delete"
"delete",
"keep_latest"
],
"description": "Strategy to use for deleting checkpointed data.\n"
"description": "Action taken when a thread exceeds its TTL.\n\n"
},
"sweep_interval_minutes": {
"anyOf": [
@@ -642,6 +632,17 @@
}
],
"description": "Interval in minutes between sweep iterations.\nIf omitted, a default interval will be used (typically ~ 5 minutes)."
},
"sweep_limit": {
"anyOf": [
{
"type": "integer"
},
{
"type": "null"
}
],
"description": "Maximum number of threads to process per sweep iteration. Defaults to 1000."
}
},
"required": []