You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
// lockTtlSeconds: 20, // Lock TTL (default 20s, max 3600s)
48
+
// lockHeartbeatIntervalSeconds: 15, // Heartbeat interval (default 15s, max 3000s)
49
+
// lockKeyPrefix: "my-app", // Custom Redis key prefix for the lock
45
50
});
46
51
```
47
52
48
53
If you're using Copilot Cloud, thread storage is handled automatically. For self-hosted Enterprise, configure your database connection per the Enterprise setup guide.
54
+
55
+
**Thread lock options:** When an agent run starts, the runtime acquires a lock on the thread to prevent concurrent runs. You can tune this behavior:
56
+
57
+
| Option | Default | Max | Description |
58
+
|--------|---------|-----|-------------|
59
+
|`lockTtlSeconds`|`20`|`3600` (1 hour) | How long the lock is held before it expires automatically. |
60
+
|`lockHeartbeatIntervalSeconds`|`15`|`3000` (50 min) | How often the runtime renews the lock during a run. |
61
+
|`lockKeyPrefix`| — | — | Custom Redis key prefix for the thread lock. Useful when multiple apps share a Redis instance. |
Copy file name to clipboardExpand all lines: docs/content/docs/learn/threads.mdx
+11-1Lines changed: 11 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -23,7 +23,7 @@ From a developer's perspective, threads involve three things:
23
23
24
24
| What you use | What it does |
25
25
|-------------|-------------|
26
-
|`useThreads` hook | Lists, renames, archives, and deletes threads. Stays in sync across tabs and devices via WebSocket. |
26
+
|`useThreads` hook | Lists, renames, archives, and deletes threads. Pagination via `hasMoreThreads` / `fetchMoreThreads`. Stays in sync across tabs and devices via WebSocket. |
27
27
|`CopilotChat` with `threadId`| Connects to a specific thread, loads its history, and streams new events in realtime. |
28
28
|`CopilotRuntime`| Server-side layer that executes agents, stores thread data on the Intelligence Platform, and relays events to connected clients. |
29
29
@@ -114,6 +114,16 @@ If the WebSocket connection drops (network change, server restart, laptop sleep)
114
114
115
115
If a thread already has an active run and another client tries to start a new run on the same thread, the request is rejected with a **409 Conflict**. This prevents two agent runs from interleaving events on the same thread. The existing run must complete or be stopped before a new one can begin.
116
116
117
+
The runtime acquires a Redis-backed lock on the thread for the duration of each run. You can tune this behavior on the runtime:
118
+
119
+
| Option | Default | Max | Description |
120
+
|--------|---------|-----|-------------|
121
+
|`lockTtlSeconds`|`20`|`3600` (1 hour) | How long the lock is held before it expires automatically. |
122
+
|`lockHeartbeatIntervalSeconds`|`15`|`3000` (50 min) | How often the runtime renews the lock during a run. The heartbeat always runs — you only need to adjust the interval. |
123
+
|`lockKeyPrefix`| — | — | Custom Redis key prefix for the thread lock. Useful when multiple apps share a Redis instance. |
124
+
125
+
If a run completes normally, the lock is released immediately. The TTL is a safety net for cases where the runtime crashes without releasing the lock.
126
+
117
127
## Design decisions
118
128
119
129
### Why event replay instead of message snapshots?
0 commit comments