Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 20 additions & 1 deletion src/langsmith/configure-ttl.mdx
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
---
title: How to add TTLs to your application
sidebarTitle: Add TTLs to your application

---

<Tip>
**Prerequisites**
This guide assumes familiarity with [LangSmith](/langsmith/home), [Persistence](/oss/langgraph/persistence), and [Cross-thread persistence](/oss/langgraph/persistence#memory-store) concepts.
Expand All @@ -11,6 +13,8 @@ LangSmith persists both [checkpoints](/oss/langgraph/persistence#checkpoints) (t

## Configuring checkpoint TTL



Checkpoints capture the state of conversation threads. Setting a TTL ensures old checkpoints and threads are automatically deleted.

Add a `checkpointer.ttl` configuration to your `langgraph.json` file:
Expand All @@ -22,7 +26,7 @@ Add a `checkpointer.ttl` configuration to your `langgraph.json` file:
"agent": "./agent.py:graph"
},
"checkpointer": {
"ttl": {
"ttl": {c
"strategy": "delete",
"sweep_interval_minutes": 60,
"default_ttl": 43200
Expand Down Expand Up @@ -88,6 +92,21 @@ You can configure TTLs for both checkpoints and store items in the same `langgra
}
```

## Configuring Per-Thread TTL

From `langgraph-api` [v0.4.11](https://docs.langchain.com/langsmith/agent-server-changelog#v0-4-11) you are now able to apply TTL configurations per-thread via thread updates. Here is an example:

```python
thread = await client.threads.create(
ttl={
"strategy": "delete",
"ttl": 43200 # 30 days in minutes
}
)
```



## Runtime overrides

The default `store.ttl` settings from `langgraph.json` can be overridden at runtime by providing specific TTL values in SDK method calls like `get`, `put`, and `search`.
Expand Down