- Notifications
You must be signed in to change notification settings - Fork1k
Commit183a6eb
authored
chore: add managed_agent_limit licensing feature (#18876)
Note that enforcement and checking usage will come in a future PR.This feature is implemented differently than existing features in a fewways.It's highly recommended that reviewers read:- This document which outlines the methods we could've used for licenseenforcement:https://www.notion.so/coderhq/AI-Agent-License-Enforcement-21ed579be59280c088b9c1dc5e364ee8- Phase 0 of the actual RFC document:https://www.notion.so/coderhq/Usage-based-Billing-AI-b-210d579be592800eb257de7eecd2d26d### Multiple features in the license, a single feature in codersdkFirstly, the feature is represented as a single feature in the codersdkworld, but is represented with multiple features in the license.E.g. in the license you may have: { "features": { "managed_agent_limit_soft": 100, "managed_agent_limit_hard": 200 } }But the entitlements endpoint will return a single feature: { "features": { "managed_agent_limit": { "limit": 200, "soft_limit": 100 } } }This is required because of our rigid parsing that uses a`map[string]int64` for features in the license. To avoid requiring allcustomers to upgrade to use new licenses, the decision was made to justuse two features and merge them into one. Older Coder deployments willparse this feature (from new licenses) as two separate features, butit's not a problem because they don't get used anywhere obviously.The reason we want to differentiate between a "soft" and "hard" limit isso we can show admins how much of the usage is "included" vs. how muchthey can use before they get hard cut-off.### Usage period features will be compared and trump based on licenseissuance timeThe second major difference to other features is that "usage period"features such as `managed_agent_limit` will now be primarily compared bythe `iat` (issued at) claim of the license they come from. This differsfrom previous features. The reason this was done was so we could reducelimits with newer licenses, which the current comparison code does notallow for.This effectively means if you have two active licenses:- `iat`: 2025-07-14, `managed_agent_limit_soft`: 100,`managed_agent_limit_hard`: 200- `iat`: 2025-07-15, `managed_agent_limit_soft`: 50,`managed_agent_limit_hard`: 100Then the resulting `managed_agent_limit` entitlement will come from thesecond license, even though the values are smaller than another validlicense. The existing comparison code would prefer the first licenseeven though it was issued earlier.### Usage period features will count usage between the start and enddates of the licenseExisting limit features, like the user limit, just measure the currentusage value of the feature. The active user count is a gauge that goesup and down, whereas agent usage can only be incremented, so it doesn'tmake sense to use a continually incrementing counter forever and everfor managed agents.For managed agent limit, we count the usage between `nbf` (not before)and `exp` (expires at) of the license that the entitlement comes from.In the example above, we'd use the issued at date and expiry of thesecond license as this date range.This essentially means, when you get a new license, the usage resets tozero.The actual usage counting code will be implemented in a follow-up PR.### Managed agent limit has a default entitlement valueTemporarily (until further notice), we will be providing licenses with`feature_set` set to `premium` a default limit.- Soft limit: `800 * user_limit`- Hard limit: `1000 * user_limit`"Enterprise" licenses do not get any default limit and are not entitledto use the feature.Unlicensed customers (e.g. OSS) will be permitted to use the feature asmuch as they want without limits. This will be implemented when thecounting code is implemented in a follow-up PR.Closescoder/internal#7601 parenta1b87a6 commit183a6eb
File tree
10 files changed
+1155
-73
lines changed- coderd/apidoc
- codersdk
- docs/reference/api
- enterprise/coderd
- coderdenttest
- license
- site/src/api
10 files changed
+1155
-73
lines changedSome generated files are not rendered by default. Learn more aboutcustomizing how changed files appear on GitHub.
Some generated files are not rendered by default. Learn more aboutcustomizing how changed files appear on GitHub.
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
85 | 85 |
| |
86 | 86 |
| |
87 | 87 |
| |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
88 | 92 |
| |
89 | 93 |
| |
90 |
| - | |
91 |
| - | |
92 |
| - | |
93 |
| - | |
94 |
| - | |
95 |
| - | |
96 |
| - | |
97 |
| - | |
98 |
| - | |
99 |
| - | |
100 |
| - | |
101 |
| - | |
102 |
| - | |
103 |
| - | |
104 |
| - | |
105 |
| - | |
106 |
| - | |
107 |
| - | |
108 |
| - | |
109 |
| - | |
110 |
| - | |
111 |
| - | |
112 |
| - | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
113 | 129 |
| |
114 | 130 |
| |
115 | 131 |
| |
| |||
153 | 169 |
| |
154 | 170 |
| |
155 | 171 |
| |
| 172 | + | |
| 173 | + | |
| 174 | + | |
| 175 | + | |
| 176 | + | |
| 177 | + | |
| 178 | + | |
| 179 | + | |
| 180 | + | |
| 181 | + | |
| 182 | + | |
| 183 | + | |
| 184 | + | |
| 185 | + | |
| 186 | + | |
| 187 | + | |
156 | 188 |
| |
157 | 189 |
| |
158 | 190 |
| |
| |||
177 | 209 |
| |
178 | 210 |
| |
179 | 211 |
| |
180 |
| - | |
| 212 | + | |
181 | 213 |
| |
182 | 214 |
| |
183 | 215 |
| |
184 | 216 |
| |
185 | 217 |
| |
186 | 218 |
| |
| 219 | + | |
| 220 | + | |
| 221 | + | |
| 222 | + | |
187 | 223 |
| |
188 | 224 |
| |
189 | 225 |
| |
| |||
196 | 232 |
| |
197 | 233 |
| |
198 | 234 |
| |
| 235 | + | |
| 236 | + | |
| 237 | + | |
| 238 | + | |
| 239 | + | |
| 240 | + | |
| 241 | + | |
| 242 | + | |
| 243 | + | |
| 244 | + | |
| 245 | + | |
| 246 | + | |
| 247 | + | |
| 248 | + | |
| 249 | + | |
| 250 | + | |
| 251 | + | |
| 252 | + | |
| 253 | + | |
| 254 | + | |
| 255 | + | |
| 256 | + | |
| 257 | + | |
199 | 258 |
| |
200 | 259 |
| |
201 | 260 |
| |
| |||
204 | 263 |
| |
205 | 264 |
| |
206 | 265 |
| |
207 |
| - | |
208 |
| - | |
209 |
| - | |
210 |
| - | |
211 |
| - | |
| 266 | + | |
| 267 | + | |
| 268 | + | |
| 269 | + | |
| 270 | + | |
| 271 | + | |
| 272 | + | |
212 | 273 |
| |
213 |
| - | |
| 274 | + | |
| 275 | + | |
| 276 | + | |
| 277 | + | |
| 278 | + | |
| 279 | + | |
| 280 | + | |
| 281 | + | |
| 282 | + | |
| 283 | + | |
| 284 | + | |
| 285 | + | |
| 286 | + | |
| 287 | + | |
| 288 | + | |
| 289 | + | |
214 | 290 |
| |
215 | 291 |
| |
216 | 292 |
| |
| |||
225 | 301 |
| |
226 | 302 |
| |
227 | 303 |
| |
228 |
| - | |
| 304 | + | |
| 305 | + | |
| 306 | + | |
229 | 307 |
| |
230 | 308 |
| |
231 | 309 |
| |
| |||
295 | 373 |
| |
296 | 374 |
| |
297 | 375 |
| |
| 376 | + | |
| 377 | + | |
| 378 | + | |
| 379 | + | |
| 380 | + | |
| 381 | + | |
| 382 | + | |
298 | 383 |
| |
299 | 384 |
| |
300 | 385 |
| |
| |||
306 | 391 |
| |
307 | 392 |
| |
308 | 393 |
| |
| 394 | + | |
| 395 | + | |
| 396 | + | |
| 397 | + | |
| 398 | + | |
| 399 | + | |
| 400 | + | |
| 401 | + | |
| 402 | + | |
| 403 | + | |
309 | 404 |
| |
310 | 405 |
| |
311 | 406 |
| |
|
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
554 | 554 |
| |
555 | 555 |
| |
556 | 556 |
| |
557 |
| - | |
558 |
| - | |
559 |
| - | |
560 |
| - | |
| 557 | + | |
| 558 | + | |
| 559 | + | |
| 560 | + | |
| 561 | + | |
| 562 | + | |
| 563 | + | |
| 564 | + | |
| 565 | + | |
| 566 | + | |
561 | 567 |
| |
562 | 568 |
| |
563 | 569 |
| |
|
Some generated files are not rendered by default. Learn more aboutcustomizing how changed files appear on GitHub.
0 commit comments
Comments
(0)