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
Copy file name to clipboardExpand all lines: docs/features/session-limits.md
+4-8Lines changed: 4 additions & 8 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,10 +1,10 @@
1
1
# Session limits
2
2
3
-
Session limits let an application set an AI Credits budget for a Copilot session. Use `sessionLimits` when creating or resuming a session to cap the current accounting window.
3
+
Session limits let an application set an AI Credits budget for a Copilot session. Use `sessionLimits` when creating or resuming a session to set a soft cap for the current accounting window.
4
4
5
5
## Configure a session limit
6
6
7
-
Set `maxAiCredits` to the maximum AI Credits the sessioncan consume in its current accounting window. The SDK forwards this value to the Copilot CLI when it creates or resumes the session.
7
+
Set `maxAiCredits` to the AI Credits soft cap for the session's current accounting window. Usage is checked after model calls return, so one response can exceed the configured value before the runtime blocks the next model call. The SDK forwards this value to the Copilot CLI when it creates or resumes the session.
8
8
9
9
<detailsopen>
10
10
<summary><strong>TypeScript</strong></summary>
@@ -150,13 +150,13 @@ let resumed = client
150
150
151
151
## Observe budget events
152
152
153
-
Applications can subscribe to session events to update UI when the limit changes or the session exhausts its budget.
153
+
Applications can subscribe to session events to update UI when the soft cap changes or the session reaches the exhausted-budget flow.
154
154
155
155
| Event type | When it is emitted | Important fields |
156
156
|---|---|---|
157
157
|`session.session_limits_changed`| Active session limits changed. A `null``sessionLimits` value means no limits are active. |`sessionLimits.maxAiCredits?`|
158
158
|`session.usage_checkpoint`| The runtime records durable aggregate usage for resume and accounting. |`totalNanoAiu`, `totalPremiumRequests?`|
159
-
|`session_limits_exhausted.requested`| The session exhausted its configured budget and needs a user decision before continuing. |`requestId`, `maxAiCredits`, `usedAiCredits`|
159
+
|`session_limits_exhausted.requested`| The session reached the exhausted-budget flow and needs a user decision before continuing. |`requestId`, `maxAiCredits`, `usedAiCredits`|
160
160
|`session_limits_exhausted.completed`| The exhausted-limit prompt was resolved. |`requestId`, `response.action`, `response.additionalAiCredits?`, `response.maxAiCredits?`|
161
161
162
162
Use the generated event types for the SDK language you are using. For example, TypeScript narrows by `event.type`:
@@ -172,7 +172,3 @@ session.on((event) => {
172
172
}
173
173
});
174
174
```
175
-
176
-
## Current limitations
177
-
178
-
The SDKs expose session limits when creating or resuming a session. They do not currently expose a high-level convenience API for changing or clearing limits on an already-running session. To apply a different limit through the public SDK surface, create or resume a session with a new `sessionLimits` value.
0 commit comments