@anthropic-ai/sdk 0.103.0 → 0.104.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (123) hide show
  1. package/CHANGELOG.md +16 -0
  2. package/package.json +23 -1
  3. package/resources/beta/beta.d.mts +10 -2
  4. package/resources/beta/beta.d.mts.map +1 -1
  5. package/resources/beta/beta.d.ts +10 -2
  6. package/resources/beta/beta.d.ts.map +1 -1
  7. package/resources/beta/beta.js +8 -0
  8. package/resources/beta/beta.js.map +1 -1
  9. package/resources/beta/beta.mjs +8 -0
  10. package/resources/beta/beta.mjs.map +1 -1
  11. package/resources/beta/deployment-runs.d.mts +306 -0
  12. package/resources/beta/deployment-runs.d.mts.map +1 -0
  13. package/resources/beta/deployment-runs.d.ts +306 -0
  14. package/resources/beta/deployment-runs.d.ts.map +1 -0
  15. package/resources/beta/deployment-runs.js +55 -0
  16. package/resources/beta/deployment-runs.js.map +1 -0
  17. package/resources/beta/deployment-runs.mjs +51 -0
  18. package/resources/beta/deployment-runs.mjs.map +1 -0
  19. package/resources/beta/deployments.d.mts +671 -0
  20. package/resources/beta/deployments.d.mts.map +1 -0
  21. package/resources/beta/deployments.d.ts +671 -0
  22. package/resources/beta/deployments.d.ts.map +1 -0
  23. package/resources/beta/deployments.js +184 -0
  24. package/resources/beta/deployments.js.map +1 -0
  25. package/resources/beta/deployments.mjs +180 -0
  26. package/resources/beta/deployments.mjs.map +1 -0
  27. package/resources/beta/index.d.mts +3 -1
  28. package/resources/beta/index.d.mts.map +1 -1
  29. package/resources/beta/index.d.ts +3 -1
  30. package/resources/beta/index.d.ts.map +1 -1
  31. package/resources/beta/index.js +5 -1
  32. package/resources/beta/index.js.map +1 -1
  33. package/resources/beta/index.mjs +2 -0
  34. package/resources/beta/index.mjs.map +1 -1
  35. package/resources/beta/messages/messages.d.mts +1 -1
  36. package/resources/beta/messages/messages.d.mts.map +1 -1
  37. package/resources/beta/messages/messages.d.ts +1 -1
  38. package/resources/beta/messages/messages.d.ts.map +1 -1
  39. package/resources/beta/sessions/events.d.mts +44 -6
  40. package/resources/beta/sessions/events.d.mts.map +1 -1
  41. package/resources/beta/sessions/events.d.ts +44 -6
  42. package/resources/beta/sessions/events.d.ts.map +1 -1
  43. package/resources/beta/sessions/events.js.map +1 -1
  44. package/resources/beta/sessions/events.mjs.map +1 -1
  45. package/resources/beta/sessions/index.d.mts +2 -2
  46. package/resources/beta/sessions/index.d.mts.map +1 -1
  47. package/resources/beta/sessions/index.d.ts +2 -2
  48. package/resources/beta/sessions/index.d.ts.map +1 -1
  49. package/resources/beta/sessions/index.js.map +1 -1
  50. package/resources/beta/sessions/index.mjs.map +1 -1
  51. package/resources/beta/sessions/sessions.d.mts +41 -3
  52. package/resources/beta/sessions/sessions.d.mts.map +1 -1
  53. package/resources/beta/sessions/sessions.d.ts +41 -3
  54. package/resources/beta/sessions/sessions.d.ts.map +1 -1
  55. package/resources/beta/sessions/sessions.js.map +1 -1
  56. package/resources/beta/sessions/sessions.mjs.map +1 -1
  57. package/resources/beta/sessions/threads/threads.d.mts +1 -1
  58. package/resources/beta/sessions/threads/threads.d.mts.map +1 -1
  59. package/resources/beta/sessions/threads/threads.d.ts +1 -1
  60. package/resources/beta/sessions/threads/threads.d.ts.map +1 -1
  61. package/resources/beta/sessions/threads/threads.js.map +1 -1
  62. package/resources/beta/sessions/threads/threads.mjs.map +1 -1
  63. package/resources/beta/vaults/credentials.d.mts +97 -4
  64. package/resources/beta/vaults/credentials.d.mts.map +1 -1
  65. package/resources/beta/vaults/credentials.d.ts +97 -4
  66. package/resources/beta/vaults/credentials.d.ts.map +1 -1
  67. package/resources/beta/vaults/index.d.mts +1 -1
  68. package/resources/beta/vaults/index.d.mts.map +1 -1
  69. package/resources/beta/vaults/index.d.ts +1 -1
  70. package/resources/beta/vaults/index.d.ts.map +1 -1
  71. package/resources/beta/vaults/index.js.map +1 -1
  72. package/resources/beta/vaults/index.mjs.map +1 -1
  73. package/resources/beta/vaults/vaults.d.mts +2 -2
  74. package/resources/beta/vaults/vaults.d.mts.map +1 -1
  75. package/resources/beta/vaults/vaults.d.ts +2 -2
  76. package/resources/beta/vaults/vaults.d.ts.map +1 -1
  77. package/resources/beta/vaults/vaults.js.map +1 -1
  78. package/resources/beta/vaults/vaults.mjs.map +1 -1
  79. package/resources/beta/webhooks.d.mts +12 -0
  80. package/resources/beta/webhooks.d.mts.map +1 -1
  81. package/resources/beta/webhooks.d.ts +12 -0
  82. package/resources/beta/webhooks.d.ts.map +1 -1
  83. package/resources/messages/messages.d.mts +1 -1
  84. package/resources/messages/messages.d.mts.map +1 -1
  85. package/resources/messages/messages.d.ts +1 -1
  86. package/resources/messages/messages.d.ts.map +1 -1
  87. package/src/resources/beta/beta.ts +156 -0
  88. package/src/resources/beta/deployment-runs.ts +441 -0
  89. package/src/resources/beta/deployments.ts +965 -0
  90. package/src/resources/beta/index.ts +74 -0
  91. package/src/resources/beta/messages/messages.ts +1 -1
  92. package/src/resources/beta/sessions/events.ts +59 -4
  93. package/src/resources/beta/sessions/index.ts +4 -0
  94. package/src/resources/beta/sessions/sessions.ts +52 -0
  95. package/src/resources/beta/sessions/threads/threads.ts +2 -1
  96. package/src/resources/beta/vaults/credentials.ts +134 -3
  97. package/src/resources/beta/vaults/index.ts +8 -0
  98. package/src/resources/beta/vaults/vaults.ts +16 -0
  99. package/src/resources/beta/webhooks.ts +15 -0
  100. package/src/resources/messages/messages.ts +1 -1
  101. package/src/tools/agent-toolset/node.browser.ts +90 -0
  102. package/src/tools/memory/node.browser.ts +64 -0
  103. package/src/version.ts +1 -1
  104. package/tools/agent-toolset/node.browser.d.mts +42 -0
  105. package/tools/agent-toolset/node.browser.d.mts.map +1 -0
  106. package/tools/agent-toolset/node.browser.d.ts +42 -0
  107. package/tools/agent-toolset/node.browser.d.ts.map +1 -0
  108. package/tools/agent-toolset/node.browser.js +81 -0
  109. package/tools/agent-toolset/node.browser.js.map +1 -0
  110. package/tools/agent-toolset/node.browser.mjs +66 -0
  111. package/tools/agent-toolset/node.browser.mjs.map +1 -0
  112. package/tools/memory/node.browser.d.mts +27 -0
  113. package/tools/memory/node.browser.d.mts.map +1 -0
  114. package/tools/memory/node.browser.d.ts +27 -0
  115. package/tools/memory/node.browser.d.ts.map +1 -0
  116. package/tools/memory/node.browser.js +49 -0
  117. package/tools/memory/node.browser.js.map +1 -0
  118. package/tools/memory/node.browser.mjs +44 -0
  119. package/tools/memory/node.browser.mjs.map +1 -0
  120. package/version.d.mts +1 -1
  121. package/version.d.ts +1 -1
  122. package/version.js +1 -1
  123. package/version.mjs +1 -1
@@ -0,0 +1,965 @@
1
+ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
+
3
+ import { APIResource } from '../../core/resource';
4
+ import * as BetaAPI from './beta';
5
+ import * as DeploymentRunsAPI from './deployment-runs';
6
+ import * as AgentsAPI from './agents/agents';
7
+ import * as EventsAPI from './sessions/events';
8
+ import * as SessionsAPI from './sessions/sessions';
9
+ import { APIPromise } from '../../core/api-promise';
10
+ import { PageCursor, type PageCursorParams, PagePromise } from '../../core/pagination';
11
+ import { buildHeaders } from '../../internal/headers';
12
+ import { RequestOptions } from '../../internal/request-options';
13
+ import { path } from '../../internal/utils/path';
14
+
15
+ export class Deployments extends APIResource {
16
+ /**
17
+ * Create Deployment
18
+ *
19
+ * @example
20
+ * ```ts
21
+ * const betaManagedAgentsDeployment =
22
+ * await client.beta.deployments.create({
23
+ * agent: 'string',
24
+ * environment_id: 'x',
25
+ * initial_events: [
26
+ * {
27
+ * content: [
28
+ * {
29
+ * text: 'Where is my order #1234?',
30
+ * type: 'text',
31
+ * },
32
+ * ],
33
+ * type: 'user.message',
34
+ * },
35
+ * ],
36
+ * name: 'x',
37
+ * });
38
+ * ```
39
+ */
40
+ create(params: DeploymentCreateParams, options?: RequestOptions): APIPromise<BetaManagedAgentsDeployment> {
41
+ const { betas, ...body } = params;
42
+ return this._client.post('/v1/deployments?beta=true', {
43
+ body,
44
+ ...options,
45
+ headers: buildHeaders([
46
+ { 'anthropic-beta': [...(betas ?? []), 'managed-agents-2026-04-01'].toString() },
47
+ options?.headers,
48
+ ]),
49
+ });
50
+ }
51
+
52
+ /**
53
+ * Get Deployment
54
+ *
55
+ * @example
56
+ * ```ts
57
+ * const betaManagedAgentsDeployment =
58
+ * await client.beta.deployments.retrieve('deployment_id');
59
+ * ```
60
+ */
61
+ retrieve(
62
+ deploymentID: string,
63
+ params: DeploymentRetrieveParams | null | undefined = {},
64
+ options?: RequestOptions,
65
+ ): APIPromise<BetaManagedAgentsDeployment> {
66
+ const { betas } = params ?? {};
67
+ return this._client.get(path`/v1/deployments/${deploymentID}?beta=true`, {
68
+ ...options,
69
+ headers: buildHeaders([
70
+ { 'anthropic-beta': [...(betas ?? []), 'managed-agents-2026-04-01'].toString() },
71
+ options?.headers,
72
+ ]),
73
+ });
74
+ }
75
+
76
+ /**
77
+ * Update Deployment
78
+ *
79
+ * @example
80
+ * ```ts
81
+ * const betaManagedAgentsDeployment =
82
+ * await client.beta.deployments.update('deployment_id');
83
+ * ```
84
+ */
85
+ update(
86
+ deploymentID: string,
87
+ params: DeploymentUpdateParams,
88
+ options?: RequestOptions,
89
+ ): APIPromise<BetaManagedAgentsDeployment> {
90
+ const { betas, ...body } = params;
91
+ return this._client.post(path`/v1/deployments/${deploymentID}?beta=true`, {
92
+ body,
93
+ ...options,
94
+ headers: buildHeaders([
95
+ { 'anthropic-beta': [...(betas ?? []), 'managed-agents-2026-04-01'].toString() },
96
+ options?.headers,
97
+ ]),
98
+ });
99
+ }
100
+
101
+ /**
102
+ * List Deployments
103
+ *
104
+ * @example
105
+ * ```ts
106
+ * // Automatically fetches more pages as needed.
107
+ * for await (const betaManagedAgentsDeployment of client.beta.deployments.list()) {
108
+ * // ...
109
+ * }
110
+ * ```
111
+ */
112
+ list(
113
+ params: DeploymentListParams | null | undefined = {},
114
+ options?: RequestOptions,
115
+ ): PagePromise<BetaManagedAgentsDeploymentsPageCursor, BetaManagedAgentsDeployment> {
116
+ const { betas, ...query } = params ?? {};
117
+ return this._client.getAPIList('/v1/deployments?beta=true', PageCursor<BetaManagedAgentsDeployment>, {
118
+ query,
119
+ ...options,
120
+ headers: buildHeaders([
121
+ { 'anthropic-beta': [...(betas ?? []), 'managed-agents-2026-04-01'].toString() },
122
+ options?.headers,
123
+ ]),
124
+ });
125
+ }
126
+
127
+ /**
128
+ * Archive Deployment
129
+ *
130
+ * @example
131
+ * ```ts
132
+ * const betaManagedAgentsDeployment =
133
+ * await client.beta.deployments.archive('deployment_id');
134
+ * ```
135
+ */
136
+ archive(
137
+ deploymentID: string,
138
+ params: DeploymentArchiveParams | null | undefined = {},
139
+ options?: RequestOptions,
140
+ ): APIPromise<BetaManagedAgentsDeployment> {
141
+ const { betas } = params ?? {};
142
+ return this._client.post(path`/v1/deployments/${deploymentID}/archive?beta=true`, {
143
+ ...options,
144
+ headers: buildHeaders([
145
+ { 'anthropic-beta': [...(betas ?? []), 'managed-agents-2026-04-01'].toString() },
146
+ options?.headers,
147
+ ]),
148
+ });
149
+ }
150
+
151
+ /**
152
+ * Pause Deployment
153
+ *
154
+ * @example
155
+ * ```ts
156
+ * const betaManagedAgentsDeployment =
157
+ * await client.beta.deployments.pause('deployment_id');
158
+ * ```
159
+ */
160
+ pause(
161
+ deploymentID: string,
162
+ params: DeploymentPauseParams | null | undefined = {},
163
+ options?: RequestOptions,
164
+ ): APIPromise<BetaManagedAgentsDeployment> {
165
+ const { betas } = params ?? {};
166
+ return this._client.post(path`/v1/deployments/${deploymentID}/pause?beta=true`, {
167
+ ...options,
168
+ headers: buildHeaders([
169
+ { 'anthropic-beta': [...(betas ?? []), 'managed-agents-2026-04-01'].toString() },
170
+ options?.headers,
171
+ ]),
172
+ });
173
+ }
174
+
175
+ /**
176
+ * Run Deployment Now
177
+ *
178
+ * @example
179
+ * ```ts
180
+ * const betaManagedAgentsDeploymentRun =
181
+ * await client.beta.deployments.run('deployment_id');
182
+ * ```
183
+ */
184
+ run(
185
+ deploymentID: string,
186
+ params: DeploymentRunParams | null | undefined = {},
187
+ options?: RequestOptions,
188
+ ): APIPromise<DeploymentRunsAPI.BetaManagedAgentsDeploymentRun> {
189
+ const { betas } = params ?? {};
190
+ return this._client.post(path`/v1/deployments/${deploymentID}/run?beta=true`, {
191
+ ...options,
192
+ headers: buildHeaders([
193
+ { 'anthropic-beta': [...(betas ?? []), 'managed-agents-2026-04-01'].toString() },
194
+ options?.headers,
195
+ ]),
196
+ });
197
+ }
198
+
199
+ /**
200
+ * Unpause Deployment
201
+ *
202
+ * @example
203
+ * ```ts
204
+ * const betaManagedAgentsDeployment =
205
+ * await client.beta.deployments.unpause('deployment_id');
206
+ * ```
207
+ */
208
+ unpause(
209
+ deploymentID: string,
210
+ params: DeploymentUnpauseParams | null | undefined = {},
211
+ options?: RequestOptions,
212
+ ): APIPromise<BetaManagedAgentsDeployment> {
213
+ const { betas } = params ?? {};
214
+ return this._client.post(path`/v1/deployments/${deploymentID}/unpause?beta=true`, {
215
+ ...options,
216
+ headers: buildHeaders([
217
+ { 'anthropic-beta': [...(betas ?? []), 'managed-agents-2026-04-01'].toString() },
218
+ options?.headers,
219
+ ]),
220
+ });
221
+ }
222
+ }
223
+
224
+ export type BetaManagedAgentsDeploymentsPageCursor = PageCursor<BetaManagedAgentsDeployment>;
225
+
226
+ /**
227
+ * The deployment's agent was archived.
228
+ */
229
+ export interface BetaManagedAgentsAgentArchivedDeploymentPausedReasonError {
230
+ type: 'agent_archived_error';
231
+ }
232
+
233
+ /**
234
+ * 5-field POSIX cron schedule with computed runtime timestamps.
235
+ */
236
+ export interface BetaManagedAgentsCronSchedule {
237
+ /**
238
+ * 5-field POSIX cron expression: minute hour day-of-month month day-of-week (e.g.,
239
+ * "0 9 \* \* 1-5" for weekdays at 9am). Day-of-week is 0-7 where 0 and 7 both mean
240
+ * Sunday. Extended cron syntax - seconds or year fields, and the special
241
+ * characters L, W, #, and ? - is not supported, nor are predefined shortcuts
242
+ * (@daily).
243
+ */
244
+ expression: string;
245
+
246
+ /**
247
+ * IANA timezone identifier (e.g., "America/Los_Angeles", "UTC").
248
+ */
249
+ timezone: string;
250
+
251
+ type: 'cron';
252
+
253
+ /**
254
+ * A timestamp in RFC 3339 format
255
+ */
256
+ last_run_at?: string | null;
257
+
258
+ /**
259
+ * Up to 5 timestamps of upcoming cron occurrences. Non-empty for active and paused
260
+ * deployments (reflects what the schedule would do if unpaused); empty once the
261
+ * deployment is archived (`archived_at` set). Each fire is offset by a small
262
+ * per-schedule jitter, so a run will actually start at or shortly after its listed
263
+ * time.
264
+ */
265
+ upcoming_runs_at?: Array<string>;
266
+ }
267
+
268
+ /**
269
+ * 5-field POSIX cron schedule. Literal wall-clock matching in the configured
270
+ * timezone.
271
+ */
272
+ export interface BetaManagedAgentsCronScheduleParams {
273
+ /**
274
+ * 5-field POSIX cron expression: minute hour day-of-month month day-of-week (e.g.,
275
+ * "0 9 \* \* 1-5" for weekdays at 9am). Day-of-week is 0-7 where 0 and 7 both mean
276
+ * Sunday. Extended cron syntax - seconds or year fields, and the special
277
+ * characters L, W, #, and ? - is not supported, nor are predefined shortcuts
278
+ * (@daily).
279
+ */
280
+ expression: string;
281
+
282
+ /**
283
+ * Required. IANA timezone identifier (e.g., "America/Los_Angeles", "UTC").
284
+ * Validated against the IANA timezone database.
285
+ */
286
+ timezone: string;
287
+
288
+ type: 'cron';
289
+ }
290
+
291
+ /**
292
+ * A deployment is a configured instance of an agent — it binds the agent to
293
+ * everything needed to run it autonomously: an environment, credentials, initial
294
+ * events, and an optional schedule.
295
+ */
296
+ export interface BetaManagedAgentsDeployment {
297
+ /**
298
+ * Unique identifier for this deployment.
299
+ */
300
+ id: string;
301
+
302
+ /**
303
+ * A resolved agent reference with a concrete version.
304
+ */
305
+ agent: AgentsAPI.BetaManagedAgentsAgentReference;
306
+
307
+ /**
308
+ * A timestamp in RFC 3339 format
309
+ */
310
+ archived_at: string | null;
311
+
312
+ /**
313
+ * A timestamp in RFC 3339 format
314
+ */
315
+ created_at: string;
316
+
317
+ /**
318
+ * Description of what the deployment does.
319
+ */
320
+ description: string | null;
321
+
322
+ /**
323
+ * ID of the `environment` where sessions run.
324
+ */
325
+ environment_id: string;
326
+
327
+ /**
328
+ * Events sent to each session immediately after creation.
329
+ */
330
+ initial_events: Array<BetaManagedAgentsDeploymentInitialEvent>;
331
+
332
+ /**
333
+ * Arbitrary key-value metadata. Maximum 16 pairs.
334
+ */
335
+ metadata: { [key: string]: string };
336
+
337
+ /**
338
+ * Human-readable name.
339
+ */
340
+ name: string;
341
+
342
+ /**
343
+ * Why a deployment is paused. Non-null exactly when `status` is `paused`.
344
+ */
345
+ paused_reason: BetaManagedAgentsDeploymentPausedReason | null;
346
+
347
+ /**
348
+ * Resources attached to sessions created from this deployment. Echoes the input
349
+ * minus write-only credentials.
350
+ */
351
+ resources: Array<BetaManagedAgentsSessionResourceConfig>;
352
+
353
+ /**
354
+ * 5-field POSIX cron schedule with computed runtime timestamps.
355
+ */
356
+ schedule: BetaManagedAgentsSchedule | null;
357
+
358
+ /**
359
+ * Lifecycle status of a deployment.
360
+ */
361
+ status: BetaManagedAgentsDeploymentStatus;
362
+
363
+ type: 'deployment';
364
+
365
+ /**
366
+ * A timestamp in RFC 3339 format
367
+ */
368
+ updated_at: string;
369
+
370
+ /**
371
+ * Vault IDs supplying stored credentials for sessions created from this
372
+ * deployment.
373
+ */
374
+ vault_ids: Array<string>;
375
+ }
376
+
377
+ /**
378
+ * An event sent to a session immediately after it is created. Supports
379
+ * `user.message`, `user.define_outcome`, and `system.message`.
380
+ */
381
+ export type BetaManagedAgentsDeploymentInitialEvent =
382
+ | BetaManagedAgentsDeploymentUserMessageEvent
383
+ | BetaManagedAgentsDeploymentUserDefineOutcomeEvent
384
+ | BetaManagedAgentsDeploymentSystemMessageEvent;
385
+
386
+ /**
387
+ * An event sent to a session immediately after it is created. Supports
388
+ * `user.message`, `user.define_outcome`, and `system.message`.
389
+ */
390
+ export type BetaManagedAgentsDeploymentInitialEventParams =
391
+ | EventsAPI.BetaManagedAgentsUserMessageEventParams
392
+ | EventsAPI.BetaManagedAgentsUserDefineOutcomeEventParams
393
+ | EventsAPI.BetaManagedAgentsSystemMessageEventParams;
394
+
395
+ /**
396
+ * Why a deployment is paused. Non-null exactly when `status` is `paused`.
397
+ */
398
+ export type BetaManagedAgentsDeploymentPausedReason =
399
+ | BetaManagedAgentsManualDeploymentPausedReason
400
+ | BetaManagedAgentsErrorDeploymentPausedReason;
401
+
402
+ /**
403
+ * The error that triggered an auto-pause. Matches the failed run's `error.type`.
404
+ */
405
+ export type BetaManagedAgentsDeploymentPausedReasonError =
406
+ | BetaManagedAgentsEnvironmentArchivedDeploymentPausedReasonError
407
+ | BetaManagedAgentsAgentArchivedDeploymentPausedReasonError
408
+ | BetaManagedAgentsEnvironmentNotFoundDeploymentPausedReasonError
409
+ | BetaManagedAgentsVaultNotFoundDeploymentPausedReasonError
410
+ | BetaManagedAgentsFileNotFoundDeploymentPausedReasonError
411
+ | BetaManagedAgentsSessionResourceNotFoundDeploymentPausedReasonError
412
+ | BetaManagedAgentsWorkspaceArchivedDeploymentPausedReasonError
413
+ | BetaManagedAgentsOrganizationDisabledDeploymentPausedReasonError
414
+ | BetaManagedAgentsMemoryStoreArchivedDeploymentPausedReasonError
415
+ | BetaManagedAgentsSkillNotFoundDeploymentPausedReasonError
416
+ | BetaManagedAgentsVaultArchivedDeploymentPausedReasonError
417
+ | BetaManagedAgentsUnknownDeploymentPausedReasonError
418
+ | BetaManagedAgentsSelfHostedResourcesUnsupportedDeploymentPausedReasonError
419
+ | BetaManagedAgentsMCPEgressBlockedDeploymentPausedReasonError;
420
+
421
+ /**
422
+ * Lifecycle status of a deployment.
423
+ */
424
+ export type BetaManagedAgentsDeploymentStatus = 'active' | 'paused';
425
+
426
+ /**
427
+ * Privileged context for the accompanying turn and all subsequent turns, appended
428
+ * to the session's system context as a `role: "system"` turn rather than replacing
429
+ * the top-level system prompt.
430
+ */
431
+ export interface BetaManagedAgentsDeploymentSystemMessageEvent {
432
+ /**
433
+ * System content blocks to append. Text-only.
434
+ */
435
+ content: Array<SessionsAPI.BetaManagedAgentsSystemContentBlock>;
436
+
437
+ type: 'system.message';
438
+ }
439
+
440
+ /**
441
+ * An outcome the agent should work toward. The agent begins work on receipt.
442
+ */
443
+ export interface BetaManagedAgentsDeploymentUserDefineOutcomeEvent {
444
+ /**
445
+ * What the agent should produce. This is the task specification.
446
+ */
447
+ description: string;
448
+
449
+ /**
450
+ * Rubric for grading the quality of an outcome.
451
+ */
452
+ rubric: EventsAPI.BetaManagedAgentsFileRubric | EventsAPI.BetaManagedAgentsTextRubric;
453
+
454
+ type: 'user.define_outcome';
455
+
456
+ /**
457
+ * Eval→revision cycles before giving up. Default 3, max 20.
458
+ */
459
+ max_iterations?: number | null;
460
+ }
461
+
462
+ /**
463
+ * A user message sent to the session.
464
+ */
465
+ export interface BetaManagedAgentsDeploymentUserMessageEvent {
466
+ /**
467
+ * Array of content blocks for the user message.
468
+ */
469
+ content: Array<
470
+ | EventsAPI.BetaManagedAgentsTextBlock
471
+ | EventsAPI.BetaManagedAgentsImageBlock
472
+ | EventsAPI.BetaManagedAgentsDocumentBlock
473
+ >;
474
+
475
+ type: 'user.message';
476
+ }
477
+
478
+ /**
479
+ * The deployment's environment was archived.
480
+ */
481
+ export interface BetaManagedAgentsEnvironmentArchivedDeploymentPausedReasonError {
482
+ type: 'environment_archived_error';
483
+ }
484
+
485
+ /**
486
+ * The deployment's environment no longer exists.
487
+ */
488
+ export interface BetaManagedAgentsEnvironmentNotFoundDeploymentPausedReasonError {
489
+ type: 'environment_not_found_error';
490
+ }
491
+
492
+ /**
493
+ * A scheduled fire recorded a failed run whose error auto-pauses the deployment.
494
+ */
495
+ export interface BetaManagedAgentsErrorDeploymentPausedReason {
496
+ /**
497
+ * The error that triggered an auto-pause. Matches the failed run's `error.type`.
498
+ */
499
+ error: BetaManagedAgentsDeploymentPausedReasonError;
500
+
501
+ type: 'error';
502
+ }
503
+
504
+ /**
505
+ * A file resource referenced by the deployment no longer exists.
506
+ */
507
+ export interface BetaManagedAgentsFileNotFoundDeploymentPausedReasonError {
508
+ type: 'file_not_found_error';
509
+ }
510
+
511
+ /**
512
+ * A file mounted into each session's container.
513
+ */
514
+ export interface BetaManagedAgentsFileResourceConfig {
515
+ /**
516
+ * ID of a previously uploaded file.
517
+ */
518
+ file_id: string;
519
+
520
+ type: 'file';
521
+
522
+ /**
523
+ * Mount path in the container. Defaults to `/mnt/session/uploads/<file_id>`.
524
+ */
525
+ mount_path?: string | null;
526
+ }
527
+
528
+ /**
529
+ * A GitHub repository mounted into each session's container. The authorization
530
+ * token is write-only and never returned.
531
+ */
532
+ export interface BetaManagedAgentsGitHubRepositoryResourceConfig {
533
+ type: 'github_repository';
534
+
535
+ /**
536
+ * Github URL of the repository
537
+ */
538
+ url: string;
539
+
540
+ /**
541
+ * Branch or commit to check out. Defaults to the repository's default branch.
542
+ */
543
+ checkout?: SessionsAPI.BetaManagedAgentsBranchCheckout | SessionsAPI.BetaManagedAgentsCommitCheckout | null;
544
+
545
+ /**
546
+ * Mount path in the container. Defaults to `/workspace/<repo-name>`.
547
+ */
548
+ mount_path?: string | null;
549
+ }
550
+
551
+ /**
552
+ * The caller invoked the pause endpoint on the deployment.
553
+ */
554
+ export interface BetaManagedAgentsManualDeploymentPausedReason {
555
+ type: 'manual';
556
+ }
557
+
558
+ /**
559
+ * An MCP server host used by the deployment's agent is blocked by the
560
+ * environment's network policy.
561
+ */
562
+ export interface BetaManagedAgentsMCPEgressBlockedDeploymentPausedReasonError {
563
+ type: 'mcp_egress_blocked_error';
564
+ }
565
+
566
+ /**
567
+ * A memory store referenced by the deployment is archived.
568
+ */
569
+ export interface BetaManagedAgentsMemoryStoreArchivedDeploymentPausedReasonError {
570
+ type: 'memory_store_archived_error';
571
+ }
572
+
573
+ /**
574
+ * A memory store attached to each session created from this deployment.
575
+ */
576
+ export interface BetaManagedAgentsMemoryStoreResourceConfig {
577
+ /**
578
+ * The memory store ID (memstore\_...). Must belong to the caller's organization
579
+ * and workspace.
580
+ */
581
+ memory_store_id: string;
582
+
583
+ type: 'memory_store';
584
+
585
+ /**
586
+ * Access mode for an attached memory store.
587
+ */
588
+ access?: 'read_write' | 'read_only' | null;
589
+
590
+ /**
591
+ * Per-attachment guidance for the agent on how to use this store. Rendered into
592
+ * the memory section of the system prompt. Max 4096 chars.
593
+ */
594
+ instructions?: string | null;
595
+ }
596
+
597
+ /**
598
+ * The deployment's organization is disabled.
599
+ */
600
+ export interface BetaManagedAgentsOrganizationDisabledDeploymentPausedReasonError {
601
+ type: 'organization_disabled_error';
602
+ }
603
+
604
+ /**
605
+ * 5-field POSIX cron schedule with computed runtime timestamps.
606
+ */
607
+ export interface BetaManagedAgentsSchedule {
608
+ /**
609
+ * 5-field POSIX cron expression: minute hour day-of-month month day-of-week (e.g.,
610
+ * "0 9 \* \* 1-5" for weekdays at 9am). Day-of-week is 0-7 where 0 and 7 both mean
611
+ * Sunday. Extended cron syntax - seconds or year fields, and the special
612
+ * characters L, W, #, and ? - is not supported, nor are predefined shortcuts
613
+ * (@daily).
614
+ */
615
+ expression: string;
616
+
617
+ /**
618
+ * IANA timezone identifier (e.g., "America/Los_Angeles", "UTC").
619
+ */
620
+ timezone: string;
621
+
622
+ type: 'cron';
623
+
624
+ /**
625
+ * A timestamp in RFC 3339 format
626
+ */
627
+ last_run_at?: string | null;
628
+
629
+ /**
630
+ * Up to 5 timestamps of upcoming cron occurrences. Non-empty for active and paused
631
+ * deployments (reflects what the schedule would do if unpaused); empty once the
632
+ * deployment is archived (`archived_at` set). Each fire is offset by a small
633
+ * per-schedule jitter, so a run will actually start at or shortly after its listed
634
+ * time.
635
+ */
636
+ upcoming_runs_at?: Array<string>;
637
+ }
638
+
639
+ /**
640
+ * 5-field POSIX cron schedule. Literal wall-clock matching in the configured
641
+ * timezone.
642
+ */
643
+ export interface BetaManagedAgentsScheduleParams {
644
+ /**
645
+ * 5-field POSIX cron expression: minute hour day-of-month month day-of-week (e.g.,
646
+ * "0 9 \* \* 1-5" for weekdays at 9am). Day-of-week is 0-7 where 0 and 7 both mean
647
+ * Sunday. Extended cron syntax - seconds or year fields, and the special
648
+ * characters L, W, #, and ? - is not supported, nor are predefined shortcuts
649
+ * (@daily).
650
+ */
651
+ expression: string;
652
+
653
+ /**
654
+ * Required. IANA timezone identifier (e.g., "America/Los_Angeles", "UTC").
655
+ * Validated against the IANA timezone database.
656
+ */
657
+ timezone: string;
658
+
659
+ type: 'cron';
660
+ }
661
+
662
+ /**
663
+ * The deployment configures resources, but its environment is self-hosted and
664
+ * cannot mount them.
665
+ */
666
+ export interface BetaManagedAgentsSelfHostedResourcesUnsupportedDeploymentPausedReasonError {
667
+ type: 'self_hosted_resources_unsupported_error';
668
+ }
669
+
670
+ /**
671
+ * A configured session resource. Echoes the input minus write-only credentials.
672
+ */
673
+ export type BetaManagedAgentsSessionResourceConfig =
674
+ | BetaManagedAgentsGitHubRepositoryResourceConfig
675
+ | BetaManagedAgentsFileResourceConfig
676
+ | BetaManagedAgentsMemoryStoreResourceConfig;
677
+
678
+ /**
679
+ * A referenced resource no longer exists and its kind was not reported.
680
+ */
681
+ export interface BetaManagedAgentsSessionResourceNotFoundDeploymentPausedReasonError {
682
+ type: 'session_resource_not_found_error';
683
+ }
684
+
685
+ /**
686
+ * A skill referenced by the deployment's agent no longer exists.
687
+ */
688
+ export interface BetaManagedAgentsSkillNotFoundDeploymentPausedReasonError {
689
+ type: 'skill_not_found_error';
690
+ }
691
+
692
+ /**
693
+ * An unrecognized error auto-paused the deployment. A fallback variant; matches a
694
+ * run whose `error.type` is `unknown_error`.
695
+ */
696
+ export interface BetaManagedAgentsUnknownDeploymentPausedReasonError {
697
+ type: 'unknown_error';
698
+ }
699
+
700
+ /**
701
+ * A vault referenced by the deployment is archived.
702
+ */
703
+ export interface BetaManagedAgentsVaultArchivedDeploymentPausedReasonError {
704
+ type: 'vault_archived_error';
705
+ }
706
+
707
+ /**
708
+ * A vault referenced by the deployment no longer exists.
709
+ */
710
+ export interface BetaManagedAgentsVaultNotFoundDeploymentPausedReasonError {
711
+ type: 'vault_not_found_error';
712
+ }
713
+
714
+ /**
715
+ * The deployment's workspace was archived.
716
+ */
717
+ export interface BetaManagedAgentsWorkspaceArchivedDeploymentPausedReasonError {
718
+ type: 'workspace_archived_error';
719
+ }
720
+
721
+ export interface DeploymentCreateParams {
722
+ /**
723
+ * Body param: Agent to deploy. Accepts the `agent` ID string, which pins the
724
+ * latest version, or an `agent` object with both id and version specified. The
725
+ * agent must exist and not be archived.
726
+ */
727
+ agent: string | SessionsAPI.BetaManagedAgentsAgentParams;
728
+
729
+ /**
730
+ * Body param: ID of the `environment` defining the container configuration for
731
+ * sessions created from this deployment.
732
+ */
733
+ environment_id: string;
734
+
735
+ /**
736
+ * Body param: Events to send to each session immediately after creation. At least
737
+ * 1, maximum 50.
738
+ */
739
+ initial_events: Array<BetaManagedAgentsDeploymentInitialEventParams>;
740
+
741
+ /**
742
+ * Body param: Human-readable name for the deployment.
743
+ */
744
+ name: string;
745
+
746
+ /**
747
+ * Body param: Description of what the deployment does.
748
+ */
749
+ description?: string | null;
750
+
751
+ /**
752
+ * Body param: Arbitrary key-value metadata. Maximum 16 pairs, keys up to 64 chars,
753
+ * values up to 512 chars.
754
+ */
755
+ metadata?: { [key: string]: string };
756
+
757
+ /**
758
+ * Body param: Resources (e.g. repositories, files) to mount into each session's
759
+ * container. Maximum 500.
760
+ */
761
+ resources?: Array<
762
+ | SessionsAPI.BetaManagedAgentsGitHubRepositoryResourceParams
763
+ | SessionsAPI.BetaManagedAgentsFileResourceParams
764
+ | SessionsAPI.BetaManagedAgentsMemoryStoreResourceParam
765
+ >;
766
+
767
+ /**
768
+ * Body param: 5-field POSIX cron schedule. Literal wall-clock matching in the
769
+ * configured timezone.
770
+ */
771
+ schedule?: BetaManagedAgentsScheduleParams | null;
772
+
773
+ /**
774
+ * Body param: Vault IDs for stored credentials the agent can use during sessions
775
+ * created from this deployment. Maximum 50.
776
+ */
777
+ vault_ids?: Array<string>;
778
+
779
+ /**
780
+ * Header param: Optional header to specify the beta version(s) you want to use.
781
+ */
782
+ betas?: Array<BetaAPI.AnthropicBeta>;
783
+ }
784
+
785
+ export interface DeploymentRetrieveParams {
786
+ /**
787
+ * Optional header to specify the beta version(s) you want to use.
788
+ */
789
+ betas?: Array<BetaAPI.AnthropicBeta>;
790
+ }
791
+
792
+ export interface DeploymentUpdateParams {
793
+ /**
794
+ * Body param: Agent to deploy. Accepts the `agent` ID string, which re-pins to the
795
+ * latest version, or an `agent` object with both id and version specified. Omit to
796
+ * preserve. Cannot be cleared.
797
+ */
798
+ agent?: string | SessionsAPI.BetaManagedAgentsAgentParams;
799
+
800
+ /**
801
+ * Body param: Description. Omit to preserve; send empty string or null to clear.
802
+ */
803
+ description?: string | null;
804
+
805
+ /**
806
+ * Body param: ID of the `environment` where sessions run. Omit to preserve. Cannot
807
+ * be cleared.
808
+ */
809
+ environment_id?: string;
810
+
811
+ /**
812
+ * Body param: Initial events. Full replacement. Omit to preserve. Cannot be
813
+ * cleared. At least 1, maximum 50.
814
+ */
815
+ initial_events?: Array<BetaManagedAgentsDeploymentInitialEventParams>;
816
+
817
+ /**
818
+ * Body param: Metadata patch. Set a key to a string to upsert it, or to null to
819
+ * delete it. Omit the field to preserve. The stored bag is limited to 16 keys (up
820
+ * to 64 chars each) with values up to 512 chars.
821
+ */
822
+ metadata?: { [key: string]: string | null } | null;
823
+
824
+ /**
825
+ * Body param: Human-readable name. Must be non-empty. Omit to preserve. Cannot be
826
+ * cleared.
827
+ */
828
+ name?: string;
829
+
830
+ /**
831
+ * Body param: Session resources. Full replacement. Omit to preserve; send empty
832
+ * array or null to clear. Maximum 500.
833
+ */
834
+ resources?: Array<
835
+ | SessionsAPI.BetaManagedAgentsGitHubRepositoryResourceParams
836
+ | SessionsAPI.BetaManagedAgentsFileResourceParams
837
+ | SessionsAPI.BetaManagedAgentsMemoryStoreResourceParam
838
+ > | null;
839
+
840
+ /**
841
+ * Body param: 5-field POSIX cron schedule. Literal wall-clock matching in the
842
+ * configured timezone.
843
+ */
844
+ schedule?: BetaManagedAgentsScheduleParams | null;
845
+
846
+ /**
847
+ * Body param: Vault IDs. Full replacement. Omit to preserve; send empty array or
848
+ * null to clear. Maximum 50.
849
+ */
850
+ vault_ids?: Array<string> | null;
851
+
852
+ /**
853
+ * Header param: Optional header to specify the beta version(s) you want to use.
854
+ */
855
+ betas?: Array<BetaAPI.AnthropicBeta>;
856
+ }
857
+
858
+ export interface DeploymentListParams extends PageCursorParams {
859
+ /**
860
+ * Query param: Filter by agent ID.
861
+ */
862
+ agent_id?: string;
863
+
864
+ /**
865
+ * Query param: Return deployments created at or after this time (inclusive).
866
+ */
867
+ 'created_at[gte]'?: string;
868
+
869
+ /**
870
+ * Query param: Return deployments created at or before this time (inclusive).
871
+ */
872
+ 'created_at[lte]'?: string;
873
+
874
+ /**
875
+ * Query param: When true, includes archived deployments. Default: false (exclude
876
+ * archived).
877
+ */
878
+ include_archived?: boolean;
879
+
880
+ /**
881
+ * Query param: Filter by status: active or paused. Omit for both. To include
882
+ * archived deployments, use include_archived instead; the two cannot be combined.
883
+ */
884
+ status?: BetaManagedAgentsDeploymentStatus;
885
+
886
+ /**
887
+ * Header param: Optional header to specify the beta version(s) you want to use.
888
+ */
889
+ betas?: Array<BetaAPI.AnthropicBeta>;
890
+ }
891
+
892
+ export interface DeploymentArchiveParams {
893
+ /**
894
+ * Optional header to specify the beta version(s) you want to use.
895
+ */
896
+ betas?: Array<BetaAPI.AnthropicBeta>;
897
+ }
898
+
899
+ export interface DeploymentPauseParams {
900
+ /**
901
+ * Optional header to specify the beta version(s) you want to use.
902
+ */
903
+ betas?: Array<BetaAPI.AnthropicBeta>;
904
+ }
905
+
906
+ export interface DeploymentRunParams {
907
+ /**
908
+ * Optional header to specify the beta version(s) you want to use.
909
+ */
910
+ betas?: Array<BetaAPI.AnthropicBeta>;
911
+ }
912
+
913
+ export interface DeploymentUnpauseParams {
914
+ /**
915
+ * Optional header to specify the beta version(s) you want to use.
916
+ */
917
+ betas?: Array<BetaAPI.AnthropicBeta>;
918
+ }
919
+
920
+ export declare namespace Deployments {
921
+ export {
922
+ type BetaManagedAgentsAgentArchivedDeploymentPausedReasonError as BetaManagedAgentsAgentArchivedDeploymentPausedReasonError,
923
+ type BetaManagedAgentsCronSchedule as BetaManagedAgentsCronSchedule,
924
+ type BetaManagedAgentsCronScheduleParams as BetaManagedAgentsCronScheduleParams,
925
+ type BetaManagedAgentsDeployment as BetaManagedAgentsDeployment,
926
+ type BetaManagedAgentsDeploymentInitialEvent as BetaManagedAgentsDeploymentInitialEvent,
927
+ type BetaManagedAgentsDeploymentInitialEventParams as BetaManagedAgentsDeploymentInitialEventParams,
928
+ type BetaManagedAgentsDeploymentPausedReason as BetaManagedAgentsDeploymentPausedReason,
929
+ type BetaManagedAgentsDeploymentPausedReasonError as BetaManagedAgentsDeploymentPausedReasonError,
930
+ type BetaManagedAgentsDeploymentStatus as BetaManagedAgentsDeploymentStatus,
931
+ type BetaManagedAgentsDeploymentSystemMessageEvent as BetaManagedAgentsDeploymentSystemMessageEvent,
932
+ type BetaManagedAgentsDeploymentUserDefineOutcomeEvent as BetaManagedAgentsDeploymentUserDefineOutcomeEvent,
933
+ type BetaManagedAgentsDeploymentUserMessageEvent as BetaManagedAgentsDeploymentUserMessageEvent,
934
+ type BetaManagedAgentsEnvironmentArchivedDeploymentPausedReasonError as BetaManagedAgentsEnvironmentArchivedDeploymentPausedReasonError,
935
+ type BetaManagedAgentsEnvironmentNotFoundDeploymentPausedReasonError as BetaManagedAgentsEnvironmentNotFoundDeploymentPausedReasonError,
936
+ type BetaManagedAgentsErrorDeploymentPausedReason as BetaManagedAgentsErrorDeploymentPausedReason,
937
+ type BetaManagedAgentsFileNotFoundDeploymentPausedReasonError as BetaManagedAgentsFileNotFoundDeploymentPausedReasonError,
938
+ type BetaManagedAgentsFileResourceConfig as BetaManagedAgentsFileResourceConfig,
939
+ type BetaManagedAgentsGitHubRepositoryResourceConfig as BetaManagedAgentsGitHubRepositoryResourceConfig,
940
+ type BetaManagedAgentsManualDeploymentPausedReason as BetaManagedAgentsManualDeploymentPausedReason,
941
+ type BetaManagedAgentsMCPEgressBlockedDeploymentPausedReasonError as BetaManagedAgentsMCPEgressBlockedDeploymentPausedReasonError,
942
+ type BetaManagedAgentsMemoryStoreArchivedDeploymentPausedReasonError as BetaManagedAgentsMemoryStoreArchivedDeploymentPausedReasonError,
943
+ type BetaManagedAgentsMemoryStoreResourceConfig as BetaManagedAgentsMemoryStoreResourceConfig,
944
+ type BetaManagedAgentsOrganizationDisabledDeploymentPausedReasonError as BetaManagedAgentsOrganizationDisabledDeploymentPausedReasonError,
945
+ type BetaManagedAgentsSchedule as BetaManagedAgentsSchedule,
946
+ type BetaManagedAgentsScheduleParams as BetaManagedAgentsScheduleParams,
947
+ type BetaManagedAgentsSelfHostedResourcesUnsupportedDeploymentPausedReasonError as BetaManagedAgentsSelfHostedResourcesUnsupportedDeploymentPausedReasonError,
948
+ type BetaManagedAgentsSessionResourceConfig as BetaManagedAgentsSessionResourceConfig,
949
+ type BetaManagedAgentsSessionResourceNotFoundDeploymentPausedReasonError as BetaManagedAgentsSessionResourceNotFoundDeploymentPausedReasonError,
950
+ type BetaManagedAgentsSkillNotFoundDeploymentPausedReasonError as BetaManagedAgentsSkillNotFoundDeploymentPausedReasonError,
951
+ type BetaManagedAgentsUnknownDeploymentPausedReasonError as BetaManagedAgentsUnknownDeploymentPausedReasonError,
952
+ type BetaManagedAgentsVaultArchivedDeploymentPausedReasonError as BetaManagedAgentsVaultArchivedDeploymentPausedReasonError,
953
+ type BetaManagedAgentsVaultNotFoundDeploymentPausedReasonError as BetaManagedAgentsVaultNotFoundDeploymentPausedReasonError,
954
+ type BetaManagedAgentsWorkspaceArchivedDeploymentPausedReasonError as BetaManagedAgentsWorkspaceArchivedDeploymentPausedReasonError,
955
+ type BetaManagedAgentsDeploymentsPageCursor as BetaManagedAgentsDeploymentsPageCursor,
956
+ type DeploymentCreateParams as DeploymentCreateParams,
957
+ type DeploymentRetrieveParams as DeploymentRetrieveParams,
958
+ type DeploymentUpdateParams as DeploymentUpdateParams,
959
+ type DeploymentListParams as DeploymentListParams,
960
+ type DeploymentArchiveParams as DeploymentArchiveParams,
961
+ type DeploymentPauseParams as DeploymentPauseParams,
962
+ type DeploymentRunParams as DeploymentRunParams,
963
+ type DeploymentUnpauseParams as DeploymentUnpauseParams,
964
+ };
965
+ }