@roarkanalytics/sdk 4.0.0 → 4.2.0

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 (52) hide show
  1. package/CHANGELOG.md +24 -0
  2. package/client.d.mts +5 -2
  3. package/client.d.mts.map +1 -1
  4. package/client.d.ts +5 -2
  5. package/client.d.ts.map +1 -1
  6. package/client.js +3 -0
  7. package/client.js.map +1 -1
  8. package/client.mjs +3 -0
  9. package/client.mjs.map +1 -1
  10. package/package.json +1 -1
  11. package/resources/agent-config.d.mts +394 -0
  12. package/resources/agent-config.d.mts.map +1 -0
  13. package/resources/agent-config.d.ts +394 -0
  14. package/resources/agent-config.d.ts.map +1 -0
  15. package/resources/agent-config.js +98 -0
  16. package/resources/agent-config.js.map +1 -0
  17. package/resources/agent-config.mjs +94 -0
  18. package/resources/agent-config.mjs.map +1 -0
  19. package/resources/agent.d.mts +61 -1
  20. package/resources/agent.d.mts.map +1 -1
  21. package/resources/agent.d.ts +61 -1
  22. package/resources/agent.d.ts.map +1 -1
  23. package/resources/agent.js +16 -0
  24. package/resources/agent.js.map +1 -1
  25. package/resources/agent.mjs +16 -0
  26. package/resources/agent.mjs.map +1 -1
  27. package/resources/autoimprove-job.d.mts +13 -12
  28. package/resources/autoimprove-job.d.mts.map +1 -1
  29. package/resources/autoimprove-job.d.ts +13 -12
  30. package/resources/autoimprove-job.d.ts.map +1 -1
  31. package/resources/autoimprove-job.js +3 -2
  32. package/resources/autoimprove-job.js.map +1 -1
  33. package/resources/autoimprove-job.mjs +3 -2
  34. package/resources/autoimprove-job.mjs.map +1 -1
  35. package/resources/index.d.mts +2 -1
  36. package/resources/index.d.mts.map +1 -1
  37. package/resources/index.d.ts +2 -1
  38. package/resources/index.d.ts.map +1 -1
  39. package/resources/index.js +3 -1
  40. package/resources/index.js.map +1 -1
  41. package/resources/index.mjs +1 -0
  42. package/resources/index.mjs.map +1 -1
  43. package/src/client.ts +31 -0
  44. package/src/resources/agent-config.ts +487 -0
  45. package/src/resources/agent.ts +75 -0
  46. package/src/resources/autoimprove-job.ts +13 -12
  47. package/src/resources/index.ts +14 -0
  48. package/src/version.ts +1 -1
  49. package/version.d.mts +1 -1
  50. package/version.d.ts +1 -1
  51. package/version.js +1 -1
  52. package/version.mjs +1 -1
@@ -1 +1 @@
1
- {"version":3,"file":"index.mjs","sourceRoot":"","sources":["../src/resources/index.ts"],"names":[],"mappings":"AAAA,sFAAsF;AAEtF,OAAO,EACL,KAAK,GAQN,oBAAgB;AACjB,OAAO,EACL,aAAa,GAQd,6BAAyB;AAC1B,OAAO,EACL,WAAW,GAMZ,2BAAuB;AACxB,OAAO,EACL,cAAc,GAaf,8BAA0B;AAC3B,OAAO,EACL,SAAS,GAYV,wBAAoB;AACrB,OAAO,EACL,IAAI,GAaL,mBAAe;AAChB,OAAO,EACL,MAAM,GAOP,qBAAiB;AAClB,OAAO,EACL,YAAY,GAgBb,4BAAwB;AACzB,OAAO,EACL,oBAAoB,GASrB,sCAAkC;AACnC,OAAO,EACL,qBAAqB,GAQtB,sCAAkC;AACnC,OAAO,EAAE,MAAM,EAA0B,qBAAiB;AAC1D,OAAO,EACL,MAAM,GAOP,qBAAiB;AAClB,OAAO,EACL,mBAAmB,GAMpB,oCAAgC;AACjC,OAAO,EACL,YAAY,GASb,4BAAwB;AACzB,OAAO,EACL,aAAa,GAUd,6BAAyB;AAC1B,OAAO,EAAE,UAAU,EAAwD,yBAAqB;AAChG,OAAO,EACL,qBAAqB,GAStB,qCAAiC;AAClC,OAAO,EACL,aAAa,GAId,6BAAyB;AAC1B,OAAO,EACL,iBAAiB,GAQlB,iCAA6B;AAC9B,OAAO,EACL,iBAAiB,GASlB,kCAA8B;AAC/B,OAAO,EACL,oBAAoB,GAOrB,sCAAkC;AACnC,OAAO,EAAE,kBAAkB,EAAuC,kCAA8B;AAChG,OAAO,EACL,OAAO,GAOR,sBAAkB"}
1
+ {"version":3,"file":"index.mjs","sourceRoot":"","sources":["../src/resources/index.ts"],"names":[],"mappings":"AAAA,sFAAsF;AAEtF,OAAO,EACL,KAAK,GAUN,oBAAgB;AACjB,OAAO,EACL,WAAW,GAUZ,2BAAuB;AACxB,OAAO,EACL,aAAa,GAQd,6BAAyB;AAC1B,OAAO,EACL,WAAW,GAMZ,2BAAuB;AACxB,OAAO,EACL,cAAc,GAaf,8BAA0B;AAC3B,OAAO,EACL,SAAS,GAYV,wBAAoB;AACrB,OAAO,EACL,IAAI,GAaL,mBAAe;AAChB,OAAO,EACL,MAAM,GAOP,qBAAiB;AAClB,OAAO,EACL,YAAY,GAgBb,4BAAwB;AACzB,OAAO,EACL,oBAAoB,GASrB,sCAAkC;AACnC,OAAO,EACL,qBAAqB,GAQtB,sCAAkC;AACnC,OAAO,EAAE,MAAM,EAA0B,qBAAiB;AAC1D,OAAO,EACL,MAAM,GAOP,qBAAiB;AAClB,OAAO,EACL,mBAAmB,GAMpB,oCAAgC;AACjC,OAAO,EACL,YAAY,GASb,4BAAwB;AACzB,OAAO,EACL,aAAa,GAUd,6BAAyB;AAC1B,OAAO,EAAE,UAAU,EAAwD,yBAAqB;AAChG,OAAO,EACL,qBAAqB,GAStB,qCAAiC;AAClC,OAAO,EACL,aAAa,GAId,6BAAyB;AAC1B,OAAO,EACL,iBAAiB,GAQlB,iCAA6B;AAC9B,OAAO,EACL,iBAAiB,GASlB,kCAA8B;AAC/B,OAAO,EACL,oBAAoB,GAOrB,sCAAkC;AACnC,OAAO,EAAE,kBAAkB,EAAuC,kCAA8B;AAChG,OAAO,EACL,OAAO,GAOR,sBAAkB"}
package/src/client.ts CHANGED
@@ -19,6 +19,8 @@ import * as API from './resources/index';
19
19
  import { APIPromise } from './core/api-promise';
20
20
  import {
21
21
  Agent,
22
+ AgentBuildParams,
23
+ AgentBuildResponse,
22
24
  AgentCreateParams,
23
25
  AgentCreateResponse,
24
26
  AgentGetByIDResponse,
@@ -27,6 +29,18 @@ import {
27
29
  AgentUpdateParams,
28
30
  AgentUpdateResponse,
29
31
  } from './resources/agent';
32
+ import {
33
+ AgentConfig,
34
+ AgentConfigDeleteStagingResponse,
35
+ AgentConfigGetByIDResponse,
36
+ AgentConfigListResponse,
37
+ AgentConfigPromoteResponse,
38
+ AgentConfigResolveParams,
39
+ AgentConfigResolveResponse,
40
+ AgentConfigUpdateParams,
41
+ AgentConfigUpdateResponse,
42
+ ManagedAgentConfigRevision,
43
+ } from './resources/agent-config';
30
44
  import {
31
45
  AgentEndpoint,
32
46
  AgentEndpointCreateParams,
@@ -966,6 +980,7 @@ export class Roark {
966
980
  simulationPersona: API.SimulationPersona = new API.SimulationPersona(this);
967
981
  simulationEnvironment: API.SimulationEnvironment = new API.SimulationEnvironment(this);
968
982
  simulationTemplate: API.SimulationTemplate = new API.SimulationTemplate(this);
983
+ agentConfig: API.AgentConfig = new API.AgentConfig(this);
969
984
  autoimproveJob: API.AutoimproveJob = new API.AutoimproveJob(this);
970
985
  customerFlow: API.CustomerFlow = new API.CustomerFlow(this);
971
986
  customerFlowEdgeCase: API.CustomerFlowEdgeCase = new API.CustomerFlowEdgeCase(this);
@@ -991,6 +1006,7 @@ Roark.SimulationRunPlanJob = SimulationRunPlanJob;
991
1006
  Roark.SimulationPersona = SimulationPersona;
992
1007
  Roark.SimulationEnvironment = SimulationEnvironment;
993
1008
  Roark.SimulationTemplate = SimulationTemplate;
1009
+ Roark.AgentConfig = AgentConfig;
994
1010
  Roark.AutoimproveJob = AutoimproveJob;
995
1011
  Roark.CustomerFlow = CustomerFlow;
996
1012
  Roark.CustomerFlowEdgeCase = CustomerFlowEdgeCase;
@@ -1130,6 +1146,19 @@ export declare namespace Roark {
1130
1146
  type SimulationTemplateListResponse as SimulationTemplateListResponse,
1131
1147
  };
1132
1148
 
1149
+ export {
1150
+ AgentConfig as AgentConfig,
1151
+ type ManagedAgentConfigRevision as ManagedAgentConfigRevision,
1152
+ type AgentConfigUpdateResponse as AgentConfigUpdateResponse,
1153
+ type AgentConfigListResponse as AgentConfigListResponse,
1154
+ type AgentConfigDeleteStagingResponse as AgentConfigDeleteStagingResponse,
1155
+ type AgentConfigGetByIDResponse as AgentConfigGetByIDResponse,
1156
+ type AgentConfigPromoteResponse as AgentConfigPromoteResponse,
1157
+ type AgentConfigResolveResponse as AgentConfigResolveResponse,
1158
+ type AgentConfigUpdateParams as AgentConfigUpdateParams,
1159
+ type AgentConfigResolveParams as AgentConfigResolveParams,
1160
+ };
1161
+
1133
1162
  export {
1134
1163
  AutoimproveJob as AutoimproveJob,
1135
1164
  type AutoimproveLogEntry as AutoimproveLogEntry,
@@ -1182,10 +1211,12 @@ export declare namespace Roark {
1182
1211
  type AgentCreateResponse as AgentCreateResponse,
1183
1212
  type AgentUpdateResponse as AgentUpdateResponse,
1184
1213
  type AgentListResponse as AgentListResponse,
1214
+ type AgentBuildResponse as AgentBuildResponse,
1185
1215
  type AgentGetByIDResponse as AgentGetByIDResponse,
1186
1216
  type AgentCreateParams as AgentCreateParams,
1187
1217
  type AgentUpdateParams as AgentUpdateParams,
1188
1218
  type AgentListParams as AgentListParams,
1219
+ type AgentBuildParams as AgentBuildParams,
1189
1220
  };
1190
1221
 
1191
1222
  export {
@@ -0,0 +1,487 @@
1
+ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
+
3
+ import { APIResource } from '../core/resource';
4
+ import * as AgentConfigAPI from './agent-config';
5
+ import { APIPromise } from '../core/api-promise';
6
+ import { RequestOptions } from '../internal/request-options';
7
+ import { path } from '../internal/utils/path';
8
+
9
+ export class AgentConfig extends APIResource {
10
+ /**
11
+ * Write a new revision onto a channel. Writing production creates the key when it
12
+ * does not exist; writing staging stages a candidate that only Roark-recognized
13
+ * simulation sessions will read. Every write is a new revision; nothing is
14
+ * overwritten.
15
+ *
16
+ * @example
17
+ * ```ts
18
+ * const agentConfig = await client.agentConfig.update('x', {
19
+ * channel: 'production',
20
+ * document: { foo: 'string' },
21
+ * });
22
+ * ```
23
+ */
24
+ update(
25
+ key: string,
26
+ body: AgentConfigUpdateParams,
27
+ options?: RequestOptions,
28
+ ): APIPromise<AgentConfigUpdateResponse> {
29
+ return this._client.put(path`/v1/agent-config/${key}`, { body, ...options });
30
+ }
31
+
32
+ /**
33
+ * List the managed agent configs in this project, most recent first.
34
+ *
35
+ * @example
36
+ * ```ts
37
+ * const agentConfigs = await client.agentConfig.list();
38
+ * ```
39
+ */
40
+ list(options?: RequestOptions): APIPromise<AgentConfigListResponse> {
41
+ return this._client.get('/v1/agent-config', options);
42
+ }
43
+
44
+ /**
45
+ * Clear the staging channel. Production is untouched; recognized simulation
46
+ * sessions go back to reading production.
47
+ *
48
+ * @example
49
+ * ```ts
50
+ * const response =
51
+ * await client.agentConfig.deleteStaging('x');
52
+ * ```
53
+ */
54
+ deleteStaging(key: string, options?: RequestOptions): APIPromise<AgentConfigDeleteStagingResponse> {
55
+ return this._client.delete(path`/v1/agent-config/${key}/staging`, options);
56
+ }
57
+
58
+ /**
59
+ * Fetch one managed config with its channel pointers and recent revisions, newest
60
+ * first.
61
+ *
62
+ * @example
63
+ * ```ts
64
+ * const response = await client.agentConfig.getByID('x');
65
+ * ```
66
+ */
67
+ getByID(key: string, options?: RequestOptions): APIPromise<AgentConfigGetByIDResponse> {
68
+ return this._client.get(path`/v1/agent-config/${key}`, options);
69
+ }
70
+
71
+ /**
72
+ * Point the production channel at the staging revision. Real traffic reads it from
73
+ * the next session onward; roll back by writing the prior revision id to
74
+ * production (the chain preserves every state).
75
+ *
76
+ * @example
77
+ * ```ts
78
+ * const response = await client.agentConfig.promote('x');
79
+ * ```
80
+ */
81
+ promote(key: string, options?: RequestOptions): APIPromise<AgentConfigPromoteResponse> {
82
+ return this._client.post(path`/v1/agent-config/${key}/promote`, options);
83
+ }
84
+
85
+ /**
86
+ * The call your agent makes at session start. Returns the config JSON for this
87
+ * session, with per-session simulation recognition built in: when the session was
88
+ * originated by a Roark simulation (matched by caller number against the calls
89
+ * Roark has in flight), the STAGING revision is served for that session only, so
90
+ * Autoimprove candidates are tested on your real deployment. Real traffic always
91
+ * resolves to production; any recognition miss degrades to production too.
92
+ *
93
+ * On the first fetch of an unknown key, pass `defaults` (your baked-in config):
94
+ * the key is registered and the defaults become revision 1. That makes integration
95
+ * a single call.
96
+ *
97
+ * Cache the response per session; do not fetch per turn.
98
+ *
99
+ * @example
100
+ * ```ts
101
+ * const response = await client.agentConfig.resolve('x');
102
+ * ```
103
+ */
104
+ resolve(
105
+ key: string,
106
+ body: AgentConfigResolveParams | null | undefined = {},
107
+ options?: RequestOptions,
108
+ ): APIPromise<AgentConfigResolveResponse> {
109
+ return this._client.post(path`/v1/agent-config/${key}/resolve`, { body, ...options });
110
+ }
111
+ }
112
+
113
+ export interface ManagedAgentConfigRevision {
114
+ id: string;
115
+
116
+ /**
117
+ * ISO 8601.
118
+ */
119
+ createdAt: string;
120
+
121
+ /**
122
+ * Who wrote it: your own pushes, or the Autoimprove loop staging a candidate.
123
+ */
124
+ createdByType: 'CUSTOMER' | 'AUTOIMPROVE';
125
+
126
+ /**
127
+ * The config JSON, verbatim.
128
+ */
129
+ document: { [key: string]: unknown };
130
+
131
+ parentRevisionId: string | null;
132
+
133
+ /**
134
+ * One-line story of the change.
135
+ */
136
+ summary: string | null;
137
+ }
138
+
139
+ export interface AgentConfigUpdateResponse {
140
+ /**
141
+ * A managed config for a code-first agent (LiveKit, Pipecat, or any stack using
142
+ * the SDK): your agent fetches its tunable surface from Roark at session start.
143
+ * Two channels: production for real traffic, staging for candidates under test.
144
+ */
145
+ data: AgentConfigUpdateResponse.Data;
146
+ }
147
+
148
+ export namespace AgentConfigUpdateResponse {
149
+ /**
150
+ * A managed config for a code-first agent (LiveKit, Pipecat, or any stack using
151
+ * the SDK): your agent fetches its tunable surface from Roark at session start.
152
+ * Two channels: production for real traffic, staging for candidates under test.
153
+ */
154
+ export interface Data {
155
+ id: string;
156
+
157
+ /**
158
+ * The linked Roark agent, when one exists.
159
+ */
160
+ agentId: string | null;
161
+
162
+ /**
163
+ * ISO 8601.
164
+ */
165
+ createdAt: string;
166
+
167
+ /**
168
+ * The stable handle your code fetches by.
169
+ */
170
+ key: string;
171
+
172
+ /**
173
+ * The revision real traffic reads.
174
+ */
175
+ productionRevisionId: string | null;
176
+
177
+ /**
178
+ * The candidate revision Roark test calls read. Null when nothing is staged.
179
+ */
180
+ stagingRevisionId: string | null;
181
+
182
+ /**
183
+ * ISO 8601.
184
+ */
185
+ updatedAt: string;
186
+ }
187
+ }
188
+
189
+ export interface AgentConfigListResponse {
190
+ data: Array<AgentConfigListResponse.Data>;
191
+ }
192
+
193
+ export namespace AgentConfigListResponse {
194
+ /**
195
+ * A managed config for a code-first agent (LiveKit, Pipecat, or any stack using
196
+ * the SDK): your agent fetches its tunable surface from Roark at session start.
197
+ * Two channels: production for real traffic, staging for candidates under test.
198
+ */
199
+ export interface Data {
200
+ id: string;
201
+
202
+ /**
203
+ * The linked Roark agent, when one exists.
204
+ */
205
+ agentId: string | null;
206
+
207
+ /**
208
+ * ISO 8601.
209
+ */
210
+ createdAt: string;
211
+
212
+ /**
213
+ * The stable handle your code fetches by.
214
+ */
215
+ key: string;
216
+
217
+ /**
218
+ * The revision real traffic reads.
219
+ */
220
+ productionRevisionId: string | null;
221
+
222
+ /**
223
+ * The candidate revision Roark test calls read. Null when nothing is staged.
224
+ */
225
+ stagingRevisionId: string | null;
226
+
227
+ /**
228
+ * ISO 8601.
229
+ */
230
+ updatedAt: string;
231
+ }
232
+ }
233
+
234
+ export interface AgentConfigDeleteStagingResponse {
235
+ /**
236
+ * A managed config for a code-first agent (LiveKit, Pipecat, or any stack using
237
+ * the SDK): your agent fetches its tunable surface from Roark at session start.
238
+ * Two channels: production for real traffic, staging for candidates under test.
239
+ */
240
+ data: AgentConfigDeleteStagingResponse.Data;
241
+ }
242
+
243
+ export namespace AgentConfigDeleteStagingResponse {
244
+ /**
245
+ * A managed config for a code-first agent (LiveKit, Pipecat, or any stack using
246
+ * the SDK): your agent fetches its tunable surface from Roark at session start.
247
+ * Two channels: production for real traffic, staging for candidates under test.
248
+ */
249
+ export interface Data {
250
+ id: string;
251
+
252
+ /**
253
+ * The linked Roark agent, when one exists.
254
+ */
255
+ agentId: string | null;
256
+
257
+ /**
258
+ * ISO 8601.
259
+ */
260
+ createdAt: string;
261
+
262
+ /**
263
+ * The stable handle your code fetches by.
264
+ */
265
+ key: string;
266
+
267
+ /**
268
+ * The revision real traffic reads.
269
+ */
270
+ productionRevisionId: string | null;
271
+
272
+ /**
273
+ * The candidate revision Roark test calls read. Null when nothing is staged.
274
+ */
275
+ stagingRevisionId: string | null;
276
+
277
+ /**
278
+ * ISO 8601.
279
+ */
280
+ updatedAt: string;
281
+ }
282
+ }
283
+
284
+ export interface AgentConfigGetByIDResponse {
285
+ data: AgentConfigGetByIDResponse.Data;
286
+ }
287
+
288
+ export namespace AgentConfigGetByIDResponse {
289
+ /**
290
+ * A managed config for a code-first agent (LiveKit, Pipecat, or any stack using
291
+ * the SDK): your agent fetches its tunable surface from Roark at session start.
292
+ * Two channels: production for real traffic, staging for candidates under test.
293
+ */
294
+ export interface Data {
295
+ id: string;
296
+
297
+ /**
298
+ * The linked Roark agent, when one exists.
299
+ */
300
+ agentId: string | null;
301
+
302
+ /**
303
+ * ISO 8601.
304
+ */
305
+ createdAt: string;
306
+
307
+ /**
308
+ * The stable handle your code fetches by.
309
+ */
310
+ key: string;
311
+
312
+ /**
313
+ * The revision real traffic reads.
314
+ */
315
+ productionRevisionId: string | null;
316
+
317
+ /**
318
+ * Recent revisions, newest first.
319
+ */
320
+ revisions: Array<AgentConfigAPI.ManagedAgentConfigRevision>;
321
+
322
+ /**
323
+ * The candidate revision Roark test calls read. Null when nothing is staged.
324
+ */
325
+ stagingRevisionId: string | null;
326
+
327
+ /**
328
+ * ISO 8601.
329
+ */
330
+ updatedAt: string;
331
+ }
332
+ }
333
+
334
+ export interface AgentConfigPromoteResponse {
335
+ /**
336
+ * A managed config for a code-first agent (LiveKit, Pipecat, or any stack using
337
+ * the SDK): your agent fetches its tunable surface from Roark at session start.
338
+ * Two channels: production for real traffic, staging for candidates under test.
339
+ */
340
+ data: AgentConfigPromoteResponse.Data;
341
+ }
342
+
343
+ export namespace AgentConfigPromoteResponse {
344
+ /**
345
+ * A managed config for a code-first agent (LiveKit, Pipecat, or any stack using
346
+ * the SDK): your agent fetches its tunable surface from Roark at session start.
347
+ * Two channels: production for real traffic, staging for candidates under test.
348
+ */
349
+ export interface Data {
350
+ id: string;
351
+
352
+ /**
353
+ * The linked Roark agent, when one exists.
354
+ */
355
+ agentId: string | null;
356
+
357
+ /**
358
+ * ISO 8601.
359
+ */
360
+ createdAt: string;
361
+
362
+ /**
363
+ * The stable handle your code fetches by.
364
+ */
365
+ key: string;
366
+
367
+ /**
368
+ * The revision real traffic reads.
369
+ */
370
+ productionRevisionId: string | null;
371
+
372
+ /**
373
+ * The candidate revision Roark test calls read. Null when nothing is staged.
374
+ */
375
+ stagingRevisionId: string | null;
376
+
377
+ /**
378
+ * ISO 8601.
379
+ */
380
+ updatedAt: string;
381
+ }
382
+ }
383
+
384
+ export interface AgentConfigResolveResponse {
385
+ data: AgentConfigResolveResponse.Data;
386
+ }
387
+
388
+ export namespace AgentConfigResolveResponse {
389
+ export interface Data {
390
+ /**
391
+ * Which channel this session resolved to.
392
+ */
393
+ channel: 'production' | 'staging';
394
+
395
+ /**
396
+ * The config JSON to apply.
397
+ */
398
+ document: { [key: string]: unknown };
399
+
400
+ key: string;
401
+
402
+ revisionId: string;
403
+
404
+ /**
405
+ * Set when this session is a Roark simulation call. Stamp it (and the revisionId)
406
+ * into your session metadata so analysis attributes the call correctly.
407
+ */
408
+ simulationJobId: string | null;
409
+ }
410
+ }
411
+
412
+ export interface AgentConfigUpdateParams {
413
+ /**
414
+ * Which channel to write.
415
+ */
416
+ channel: 'production' | 'staging';
417
+
418
+ /**
419
+ * The full config JSON for the new revision.
420
+ */
421
+ document: { [key: string]: unknown };
422
+
423
+ /**
424
+ * Link this config to a Roark agent (the one your calls report). Required before
425
+ * Autoimprove can run on it: the link is how a fix finds the config channel.
426
+ */
427
+ agentId?: string;
428
+
429
+ /**
430
+ * One-line story of the change.
431
+ */
432
+ summary?: string;
433
+ }
434
+
435
+ export interface AgentConfigResolveParams {
436
+ /**
437
+ * Your baked-in config. On the first fetch of an unknown key this registers the
438
+ * config and becomes revision 1, so integration is a single call. Ignored once the
439
+ * key exists.
440
+ */
441
+ defaults?: { [key: string]: unknown };
442
+
443
+ /**
444
+ * Session context. When the call was originated by a Roark simulation, Roark
445
+ * recognizes it here and serves the staging revision for this session only; real
446
+ * traffic always gets production.
447
+ */
448
+ session?: AgentConfigResolveParams.Session;
449
+ }
450
+
451
+ export namespace AgentConfigResolveParams {
452
+ /**
453
+ * Session context. When the call was originated by a Roark simulation, Roark
454
+ * recognizes it here and serves the staging revision for this session only; real
455
+ * traffic always gets production.
456
+ */
457
+ export interface Session {
458
+ /**
459
+ * The number your agent was reached on (E.164).
460
+ */
461
+ calledNumber?: string;
462
+
463
+ /**
464
+ * The number calling your agent (E.164). Required for simulation recognition.
465
+ */
466
+ callerNumber?: string;
467
+
468
+ /**
469
+ * Your session or room identifier, for correlation.
470
+ */
471
+ sessionId?: string;
472
+ }
473
+ }
474
+
475
+ export declare namespace AgentConfig {
476
+ export {
477
+ type ManagedAgentConfigRevision as ManagedAgentConfigRevision,
478
+ type AgentConfigUpdateResponse as AgentConfigUpdateResponse,
479
+ type AgentConfigListResponse as AgentConfigListResponse,
480
+ type AgentConfigDeleteStagingResponse as AgentConfigDeleteStagingResponse,
481
+ type AgentConfigGetByIDResponse as AgentConfigGetByIDResponse,
482
+ type AgentConfigPromoteResponse as AgentConfigPromoteResponse,
483
+ type AgentConfigResolveResponse as AgentConfigResolveResponse,
484
+ type AgentConfigUpdateParams as AgentConfigUpdateParams,
485
+ type AgentConfigResolveParams as AgentConfigResolveParams,
486
+ };
487
+ }
@@ -49,6 +49,23 @@ export class Agent extends APIResource {
49
49
  return this._client.get('/v1/agent', { query, ...options });
50
50
  }
51
51
 
52
+ /**
53
+ * Creates a new Roark-hosted agent from a one-line job description. Roark authors
54
+ * the system prompt and hosts the config, so the agent is live and self-improvable
55
+ * from creation.
56
+ *
57
+ * @example
58
+ * ```ts
59
+ * const response = await client.agent.build({
60
+ * jobDescription: 'x',
61
+ * name: 'x',
62
+ * });
63
+ * ```
64
+ */
65
+ build(body: AgentBuildParams, options?: RequestOptions): APIPromise<AgentBuildResponse> {
66
+ return this._client.post('/v1/agent/build', { body, ...options });
67
+ }
68
+
52
69
  /**
53
70
  * Returns a specific agent by its ID.
54
71
  *
@@ -195,6 +212,44 @@ export namespace AgentListResponse {
195
212
  }
196
213
  }
197
214
 
215
+ export interface AgentBuildResponse {
216
+ data: AgentBuildResponse.Data;
217
+ }
218
+
219
+ export namespace AgentBuildResponse {
220
+ export interface Data {
221
+ /**
222
+ * Unique identifier of the agent
223
+ */
224
+ id: string;
225
+
226
+ /**
227
+ * Creation timestamp in ISO 8601 format
228
+ */
229
+ createdAt: string;
230
+
231
+ /**
232
+ * Custom identifier for the agent
233
+ */
234
+ customId: string | null;
235
+
236
+ /**
237
+ * Description of the agent
238
+ */
239
+ description: string | null;
240
+
241
+ /**
242
+ * Name of the agent
243
+ */
244
+ name: string;
245
+
246
+ /**
247
+ * Last update timestamp in ISO 8601 format
248
+ */
249
+ updatedAt: string;
250
+ }
251
+ }
252
+
198
253
  export interface AgentGetByIDResponse {
199
254
  data: AgentGetByIDResponse.Data;
200
255
  }
@@ -270,14 +325,34 @@ export interface AgentListParams {
270
325
  searchText?: string;
271
326
  }
272
327
 
328
+ export interface AgentBuildParams {
329
+ /**
330
+ * One-line description of what the agent should do. Roark authors the system
331
+ * prompt from this.
332
+ */
333
+ jobDescription: string;
334
+
335
+ /**
336
+ * Name of the agent
337
+ */
338
+ name: string;
339
+
340
+ /**
341
+ * Optional voice label for the hosted agent
342
+ */
343
+ voice?: string | null;
344
+ }
345
+
273
346
  export declare namespace Agent {
274
347
  export {
275
348
  type AgentCreateResponse as AgentCreateResponse,
276
349
  type AgentUpdateResponse as AgentUpdateResponse,
277
350
  type AgentListResponse as AgentListResponse,
351
+ type AgentBuildResponse as AgentBuildResponse,
278
352
  type AgentGetByIDResponse as AgentGetByIDResponse,
279
353
  type AgentCreateParams as AgentCreateParams,
280
354
  type AgentUpdateParams as AgentUpdateParams,
281
355
  type AgentListParams as AgentListParams,
356
+ type AgentBuildParams as AgentBuildParams,
282
357
  };
283
358
  }