@nimble-way/nimble-js 0.20.0 → 1.0.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 (252) hide show
  1. package/CHANGELOG.md +9 -0
  2. package/README.md +10 -10
  3. package/client.d.mts +10 -39
  4. package/client.d.mts.map +1 -1
  5. package/client.d.ts +10 -39
  6. package/client.d.ts.map +1 -1
  7. package/client.js +8 -43
  8. package/client.js.map +1 -1
  9. package/client.mjs +8 -43
  10. package/client.mjs.map +1 -1
  11. package/package.json +1 -1
  12. package/resources/{task-agent/task-agent.d.mts → agents/agents.d.mts} +51 -213
  13. package/resources/agents/agents.d.mts.map +1 -0
  14. package/resources/{task-agent/task-agent.d.ts → agents/agents.d.ts} +51 -213
  15. package/resources/agents/agents.d.ts.map +1 -0
  16. package/resources/agents/agents.js +67 -0
  17. package/resources/agents/agents.js.map +1 -0
  18. package/resources/agents/agents.mjs +62 -0
  19. package/resources/agents/agents.mjs.map +1 -0
  20. package/resources/agents/index.d.mts +4 -0
  21. package/resources/agents/index.d.mts.map +1 -0
  22. package/resources/agents/index.d.ts +4 -0
  23. package/resources/agents/index.d.ts.map +1 -0
  24. package/resources/{task-agent → agents}/index.js +3 -3
  25. package/resources/agents/index.js.map +1 -0
  26. package/resources/{task-agent → agents}/index.mjs +1 -1
  27. package/resources/agents/index.mjs.map +1 -0
  28. package/resources/{task-agent → agents}/runs.d.mts +192 -43
  29. package/resources/agents/runs.d.mts.map +1 -0
  30. package/resources/{task-agent → agents}/runs.d.ts +192 -43
  31. package/resources/agents/runs.d.ts.map +1 -0
  32. package/resources/agents/runs.js +63 -0
  33. package/resources/agents/runs.js.map +1 -0
  34. package/resources/agents/runs.mjs +59 -0
  35. package/resources/agents/runs.mjs.map +1 -0
  36. package/resources/{task-agent → agents}/templates.d.mts +3 -6
  37. package/resources/agents/templates.d.mts.map +1 -0
  38. package/resources/{task-agent → agents}/templates.d.ts +3 -6
  39. package/resources/agents/templates.d.ts.map +1 -0
  40. package/resources/{task-agent → agents}/templates.js +5 -8
  41. package/resources/agents/templates.js.map +1 -0
  42. package/resources/agents/templates.mjs +19 -0
  43. package/resources/agents/templates.mjs.map +1 -0
  44. package/resources/agents.d.mts +2 -0
  45. package/resources/agents.d.mts.map +1 -0
  46. package/resources/agents.d.ts +2 -0
  47. package/resources/agents.d.ts.map +1 -0
  48. package/resources/{task-agent.js → agents.js} +2 -2
  49. package/resources/agents.js.map +1 -0
  50. package/resources/{task-agent.mjs → agents.mjs} +2 -2
  51. package/resources/agents.mjs.map +1 -0
  52. package/resources/batches.js +3 -3
  53. package/resources/batches.mjs +3 -3
  54. package/resources/crawl.js +4 -4
  55. package/resources/crawl.mjs +4 -4
  56. package/resources/domain-knowledge.js +1 -1
  57. package/resources/domain-knowledge.mjs +1 -1
  58. package/resources/extract/extract.d.mts +1243 -0
  59. package/resources/extract/extract.d.mts.map +1 -0
  60. package/resources/extract/extract.d.ts +1243 -0
  61. package/resources/extract/extract.d.ts.map +1 -0
  62. package/resources/extract/extract.js +52 -0
  63. package/resources/extract/extract.js.map +1 -0
  64. package/resources/extract/extract.mjs +47 -0
  65. package/resources/extract/extract.mjs.map +1 -0
  66. package/resources/extract/index.d.mts +3 -0
  67. package/resources/extract/index.d.mts.map +1 -0
  68. package/resources/extract/index.d.ts +3 -0
  69. package/resources/extract/index.d.ts.map +1 -0
  70. package/resources/extract/index.js +9 -0
  71. package/resources/extract/index.js.map +1 -0
  72. package/resources/extract/index.mjs +4 -0
  73. package/resources/extract/index.mjs.map +1 -0
  74. package/resources/extract/templates/generations.d.mts +364 -0
  75. package/resources/extract/templates/generations.d.mts.map +1 -0
  76. package/resources/extract/templates/generations.d.ts +364 -0
  77. package/resources/extract/templates/generations.d.ts.map +1 -0
  78. package/resources/extract/templates/generations.js +39 -0
  79. package/resources/extract/templates/generations.js.map +1 -0
  80. package/resources/extract/templates/generations.mjs +35 -0
  81. package/resources/extract/templates/generations.mjs.map +1 -0
  82. package/resources/extract/templates/index.d.mts +4 -0
  83. package/resources/extract/templates/index.d.mts.map +1 -0
  84. package/resources/extract/templates/index.d.ts +4 -0
  85. package/resources/extract/templates/index.d.ts.map +1 -0
  86. package/resources/extract/templates/index.js +11 -0
  87. package/resources/extract/templates/index.js.map +1 -0
  88. package/resources/extract/templates/index.mjs +5 -0
  89. package/resources/extract/templates/index.mjs.map +1 -0
  90. package/resources/extract/templates/templates.d.mts +870 -0
  91. package/resources/extract/templates/templates.d.mts.map +1 -0
  92. package/resources/extract/templates/templates.d.ts +870 -0
  93. package/resources/extract/templates/templates.d.ts.map +1 -0
  94. package/resources/extract/templates/templates.js +120 -0
  95. package/resources/extract/templates/templates.js.map +1 -0
  96. package/resources/extract/templates/templates.mjs +115 -0
  97. package/resources/extract/templates/templates.mjs.map +1 -0
  98. package/resources/extract/templates/versions.d.mts +226 -0
  99. package/resources/extract/templates/versions.d.mts.map +1 -0
  100. package/resources/extract/templates/versions.d.ts +226 -0
  101. package/resources/extract/templates/versions.d.ts.map +1 -0
  102. package/resources/extract/templates/versions.js +42 -0
  103. package/resources/extract/templates/versions.js.map +1 -0
  104. package/resources/extract/templates/versions.mjs +38 -0
  105. package/resources/extract/templates/versions.mjs.map +1 -0
  106. package/resources/extract/templates.d.mts +2 -0
  107. package/resources/extract/templates.d.mts.map +1 -0
  108. package/resources/extract/templates.d.ts +2 -0
  109. package/resources/extract/templates.d.ts.map +1 -0
  110. package/resources/extract/templates.js +6 -0
  111. package/resources/extract/templates.js.map +1 -0
  112. package/resources/extract/templates.mjs +3 -0
  113. package/resources/extract/templates.mjs.map +1 -0
  114. package/resources/extract.d.mts +2 -0
  115. package/resources/extract.d.mts.map +1 -0
  116. package/resources/extract.d.ts +2 -0
  117. package/resources/extract.d.ts.map +1 -0
  118. package/resources/extract.js +6 -0
  119. package/resources/extract.js.map +1 -0
  120. package/resources/extract.mjs +3 -0
  121. package/resources/extract.mjs.map +1 -0
  122. package/resources/fast-serp.js +1 -1
  123. package/resources/fast-serp.mjs +1 -1
  124. package/resources/index.d.mts +4 -4
  125. package/resources/index.d.mts.map +1 -1
  126. package/resources/index.d.ts +4 -4
  127. package/resources/index.d.ts.map +1 -1
  128. package/resources/index.js +5 -5
  129. package/resources/index.js.map +1 -1
  130. package/resources/index.mjs +2 -2
  131. package/resources/index.mjs.map +1 -1
  132. package/resources/jobs/index.d.mts +2 -2
  133. package/resources/jobs/index.d.mts.map +1 -1
  134. package/resources/jobs/index.d.ts +2 -2
  135. package/resources/jobs/index.d.ts.map +1 -1
  136. package/resources/jobs/index.js.map +1 -1
  137. package/resources/jobs/index.mjs.map +1 -1
  138. package/resources/jobs/jobs.d.mts +35 -103
  139. package/resources/jobs/jobs.d.mts.map +1 -1
  140. package/resources/jobs/jobs.d.ts +35 -103
  141. package/resources/jobs/jobs.d.ts.map +1 -1
  142. package/resources/jobs/jobs.js +10 -28
  143. package/resources/jobs/jobs.js.map +1 -1
  144. package/resources/jobs/jobs.mjs +11 -29
  145. package/resources/jobs/jobs.mjs.map +1 -1
  146. package/resources/jobs/runs/artifacts.d.mts +4 -12
  147. package/resources/jobs/runs/artifacts.d.mts.map +1 -1
  148. package/resources/jobs/runs/artifacts.d.ts +4 -12
  149. package/resources/jobs/runs/artifacts.d.ts.map +1 -1
  150. package/resources/jobs/runs/artifacts.js +8 -16
  151. package/resources/jobs/runs/artifacts.js.map +1 -1
  152. package/resources/jobs/runs/artifacts.mjs +8 -16
  153. package/resources/jobs/runs/artifacts.mjs.map +1 -1
  154. package/resources/jobs/runs/index.d.mts +1 -1
  155. package/resources/jobs/runs/index.d.mts.map +1 -1
  156. package/resources/jobs/runs/index.d.ts +1 -1
  157. package/resources/jobs/runs/index.d.ts.map +1 -1
  158. package/resources/jobs/runs/index.js.map +1 -1
  159. package/resources/jobs/runs/index.mjs.map +1 -1
  160. package/resources/jobs/runs/runs.d.mts +60 -28
  161. package/resources/jobs/runs/runs.d.mts.map +1 -1
  162. package/resources/jobs/runs/runs.d.ts +60 -28
  163. package/resources/jobs/runs/runs.d.ts.map +1 -1
  164. package/resources/jobs/runs/runs.js +12 -12
  165. package/resources/jobs/runs/runs.js.map +1 -1
  166. package/resources/jobs/runs/runs.mjs +12 -12
  167. package/resources/jobs/runs/runs.mjs.map +1 -1
  168. package/resources/media.js +2 -2
  169. package/resources/media.mjs +2 -2
  170. package/resources/serp.js +3 -3
  171. package/resources/serp.mjs +3 -3
  172. package/resources/tasks.js +3 -3
  173. package/resources/tasks.mjs +3 -3
  174. package/resources/top-level.d.mts +1 -1202
  175. package/resources/top-level.d.mts.map +1 -1
  176. package/resources/top-level.d.ts +1 -1202
  177. package/resources/top-level.d.ts.map +1 -1
  178. package/src/client.ts +41 -123
  179. package/src/resources/{task-agent/task-agent.ts → agents/agents.ts} +71 -258
  180. package/src/resources/{task-agent → agents}/index.ts +14 -14
  181. package/src/resources/{task-agent → agents}/runs.ts +228 -54
  182. package/src/resources/{task-agent → agents}/templates.ts +5 -8
  183. package/src/resources/{task-agent.ts → agents.ts} +1 -1
  184. package/src/resources/batches.ts +3 -3
  185. package/src/resources/crawl.ts +4 -4
  186. package/src/resources/domain-knowledge.ts +1 -1
  187. package/src/resources/extract/extract.ts +5182 -0
  188. package/src/resources/extract/index.ts +25 -0
  189. package/src/resources/extract/templates/generations.ts +435 -0
  190. package/src/resources/extract/templates/index.ts +29 -0
  191. package/src/resources/extract/templates/templates.ts +1176 -0
  192. package/src/resources/extract/templates/versions.ts +284 -0
  193. package/src/resources/extract/templates.ts +3 -0
  194. package/src/resources/extract.ts +3 -0
  195. package/src/resources/fast-serp.ts +1 -1
  196. package/src/resources/index.ts +16 -36
  197. package/src/resources/jobs/index.ts +1 -1
  198. package/src/resources/jobs/jobs.ts +50 -125
  199. package/src/resources/jobs/runs/artifacts.ts +8 -16
  200. package/src/resources/jobs/runs/index.ts +1 -0
  201. package/src/resources/jobs/runs/runs.ts +75 -31
  202. package/src/resources/media.ts +2 -2
  203. package/src/resources/serp.ts +3 -3
  204. package/src/resources/tasks.ts +3 -3
  205. package/src/resources/top-level.ts +72 -5171
  206. package/src/version.ts +1 -1
  207. package/version.d.mts +1 -1
  208. package/version.d.mts.map +1 -1
  209. package/version.d.ts +1 -1
  210. package/version.d.ts.map +1 -1
  211. package/version.js +1 -1
  212. package/version.js.map +1 -1
  213. package/version.mjs +1 -1
  214. package/version.mjs.map +1 -1
  215. package/resources/agent.d.mts +0 -641
  216. package/resources/agent.d.mts.map +0 -1
  217. package/resources/agent.d.ts +0 -641
  218. package/resources/agent.d.ts.map +0 -1
  219. package/resources/agent.js +0 -84
  220. package/resources/agent.js.map +0 -1
  221. package/resources/agent.mjs +0 -80
  222. package/resources/agent.mjs.map +0 -1
  223. package/resources/task-agent/index.d.mts +0 -4
  224. package/resources/task-agent/index.d.mts.map +0 -1
  225. package/resources/task-agent/index.d.ts +0 -4
  226. package/resources/task-agent/index.d.ts.map +0 -1
  227. package/resources/task-agent/index.js.map +0 -1
  228. package/resources/task-agent/index.mjs.map +0 -1
  229. package/resources/task-agent/runs.d.mts.map +0 -1
  230. package/resources/task-agent/runs.d.ts.map +0 -1
  231. package/resources/task-agent/runs.js +0 -63
  232. package/resources/task-agent/runs.js.map +0 -1
  233. package/resources/task-agent/runs.mjs +0 -59
  234. package/resources/task-agent/runs.mjs.map +0 -1
  235. package/resources/task-agent/task-agent.d.mts.map +0 -1
  236. package/resources/task-agent/task-agent.d.ts.map +0 -1
  237. package/resources/task-agent/task-agent.js +0 -80
  238. package/resources/task-agent/task-agent.js.map +0 -1
  239. package/resources/task-agent/task-agent.mjs +0 -75
  240. package/resources/task-agent/task-agent.mjs.map +0 -1
  241. package/resources/task-agent/templates.d.mts.map +0 -1
  242. package/resources/task-agent/templates.d.ts.map +0 -1
  243. package/resources/task-agent/templates.js.map +0 -1
  244. package/resources/task-agent/templates.mjs +0 -22
  245. package/resources/task-agent/templates.mjs.map +0 -1
  246. package/resources/task-agent.d.mts +0 -2
  247. package/resources/task-agent.d.mts.map +0 -1
  248. package/resources/task-agent.d.ts +0 -2
  249. package/resources/task-agent.d.ts.map +0 -1
  250. package/resources/task-agent.js.map +0 -1
  251. package/resources/task-agent.mjs.map +0 -1
  252. package/src/resources/agent.ts +0 -935
@@ -8,70 +8,141 @@ import { path } from '../../internal/utils/path';
8
8
 
9
9
  export class Runs extends APIResource {
10
10
  /**
11
- * List runs for this instance.
11
+ * Start an agent run. The run executes asynchronously: the response returns
12
+ * immediately with status `queued`, then poll `GET .../runs/{run_id}` until
13
+ * `completed` and fetch the output from `GET .../runs/{run_id}/result` — or set
14
+ * `enable_events: true` and follow `GET .../runs/{run_id}/events` for live
15
+ * progress.
12
16
  *
13
- * `status` accepts a lowercase `TaskRunStatusValue` (e.g. "completed") or a
14
- * comma-separated list of them (e.g. "queued,running").
15
- *
16
- * @deprecated
17
+ * To enrich existing records instead of researching from scratch, pass them in
18
+ * `input_data`; this requires an `output_schema` (on the request or the agent).
19
+ */
20
+ create(agentID: string, body: RunCreateParams, options?: RequestOptions): APIPromise<RunCreateResponse> {
21
+ return this._client.post(path`/v2/agents/${agentID}/runs`, { body, ...options });
22
+ }
23
+
24
+ /**
25
+ * List the runs of an agent, newest first, paginated with `offset`/`limit`.
17
26
  */
18
27
  list(
19
28
  agentID: string,
20
29
  query: RunListParams | null | undefined = {},
21
30
  options?: RequestOptions,
22
31
  ): APIPromise<RunListResponse> {
23
- return this._client.get(path`/v1/task-agents/${agentID}/runs`, { query, ...options });
32
+ return this._client.get(path`/v2/agents/${agentID}/runs`, { query, ...options });
24
33
  }
25
34
 
26
35
  /**
27
- * Fetch a run by id, scoped to the instance.
28
- *
29
- * A run resolves only when (run_id, agent_id) match — otherwise 404. This means a
30
- * stale URL with a swapped agent_id won't leak runs across instances even if the
31
- * run_id is real.
32
- *
33
- * @deprecated
36
+ * Retrieve a run's current state. Poll this endpoint after creating a run: the run
37
+ * is finished once `status` is `completed`, `failed`, or `cancelled`.
34
38
  */
35
39
  get(runID: string, params: RunGetParams, options?: RequestOptions): APIPromise<RunGetResponse> {
36
40
  const { agent_id } = params;
37
- return this._client.get(path`/v1/task-agents/${agent_id}/runs/${runID}`, options);
41
+ return this._client.get(path`/v2/agents/${agent_id}/runs/${runID}`, options);
38
42
  }
39
43
 
40
44
  /**
41
- * Fetch the result for a terminal run on this instance.
42
- *
43
- * Mirrors the previous flat `GET /tasks/runs/:run_id/result` semantics:
44
- *
45
- * - 404 when the run doesn't belong to the agent.
46
- * - 408 when the run is still active.
47
- * - 422 (with TaskRunFailedResult body) when the run failed or was cancelled.
48
- * - 200 (with TaskRunResult body) on success.
45
+ * Fetch the output of a completed run. The `output` is `type: "text"` (a prose
46
+ * answer) or `type: "json"` (structured data matching the output schema), plus
47
+ * `trust` metadata with per-claim citations for the answer.
49
48
  *
50
- * @deprecated
49
+ * While the run is still `queued` or `running` this endpoint returns `409`; if the
50
+ * run `failed` or was `cancelled` it returns `422` with the run and error details.
51
51
  */
52
- getResult(
53
- runID: string,
54
- params: RunGetResultParams,
55
- options?: RequestOptions,
56
- ): APIPromise<RunGetResultResponse> {
52
+ result(runID: string, params: RunResultParams, options?: RequestOptions): APIPromise<RunResultResponse> {
57
53
  const { agent_id } = params;
58
- return this._client.get(path`/v1/task-agents/${agent_id}/runs/${runID}/result`, options);
54
+ return this._client.get(path`/v2/agents/${agent_id}/runs/${runID}/result`, options);
59
55
  }
60
56
 
61
57
  /**
62
- * SSE stream of real-time progress events for a run on this instance.
63
- *
64
- * @deprecated
58
+ * Stream a run's progress as
59
+ * [server-sent events](https://developer.mozilla.org/en-US/docs/Web/API/Server-sent_events)
60
+ * (`text/event-stream`). Create the run with `enable_events: true` to have events
61
+ * published. A keep-alive comment is sent every 15 seconds.
65
62
  */
66
63
  streamEvents(runID: string, params: RunStreamEventsParams, options?: RequestOptions): APIPromise<void> {
67
64
  const { agent_id } = params;
68
- return this._client.get(path`/v1/task-agents/${agent_id}/runs/${runID}/events`, {
65
+ return this._client.get(path`/v2/agents/${agent_id}/runs/${runID}/events`, {
69
66
  ...options,
70
67
  headers: buildHeaders([{ Accept: '*/*' }, options?.headers]),
71
68
  });
72
69
  }
73
70
  }
74
71
 
72
+ export interface RunCreateResponse {
73
+ /**
74
+ * Run identifier, format "task*run*{uuid}".
75
+ */
76
+ id: string;
77
+
78
+ /**
79
+ * When the run was created.
80
+ */
81
+ created_at: string;
82
+
83
+ /**
84
+ * Effort level used for the run.
85
+ */
86
+ effort: 'low' | 'medium' | 'high' | 'x-high' | 'max';
87
+
88
+ /**
89
+ * Interaction ID.
90
+ */
91
+ interaction_id: string;
92
+
93
+ /**
94
+ * True while status is 'queued' or 'running'.
95
+ */
96
+ is_active: boolean;
97
+
98
+ /**
99
+ * Current run status.
100
+ */
101
+ status: 'queued' | 'running' | 'completed' | 'failed' | 'cancelled';
102
+
103
+ /**
104
+ * Web Search Agent instance this run belongs to.
105
+ */
106
+ web_search_agent_id: string;
107
+
108
+ /**
109
+ * When the run completed.
110
+ */
111
+ completed_at?: string | null;
112
+
113
+ /**
114
+ * Error details when the run failed.
115
+ */
116
+ error?: RunCreateResponse.Error | null;
117
+
118
+ /**
119
+ * Prompt submitted for the run.
120
+ */
121
+ prompt?: string | null;
122
+
123
+ /**
124
+ * When the run started executing.
125
+ */
126
+ started_at?: string | null;
127
+ }
128
+
129
+ export namespace RunCreateResponse {
130
+ /**
131
+ * Error details when the run failed.
132
+ */
133
+ export interface Error {
134
+ /**
135
+ * Human-readable error description.
136
+ */
137
+ message: string;
138
+
139
+ /**
140
+ * Reference ID (equals the run id).
141
+ */
142
+ ref_id: string;
143
+ }
144
+ }
145
+
75
146
  export interface RunListResponse {
76
147
  /**
77
148
  * Items returned in this page.
@@ -244,25 +315,25 @@ export namespace RunGetResponse {
244
315
  }
245
316
  }
246
317
 
247
- export type RunGetResultResponse =
248
- | RunGetResultResponse.TaskRunResultPublicV1
249
- | RunGetResultResponse.TaskRunFailedResultPublicV1;
318
+ export type RunResultResponse =
319
+ | RunResultResponse.TaskRunResultPublicV2
320
+ | RunResultResponse.TaskRunFailedResultPublicV2;
250
321
 
251
- export namespace RunGetResultResponse {
252
- export interface TaskRunResultPublicV1 {
322
+ export namespace RunResultResponse {
323
+ export interface TaskRunResultPublicV2 {
253
324
  /**
254
325
  * Output from the completed task.
255
326
  */
256
- output: TaskRunResultPublicV1.TaskRunTextOutputPublicV1 | TaskRunResultPublicV1.TaskRunJsonOutputPublicV1;
327
+ output: TaskRunResultPublicV2.TaskRunTextOutputPublicV2 | TaskRunResultPublicV2.TaskRunJsonOutputPublicV2;
257
328
 
258
329
  /**
259
330
  * Task run object with status 'completed'.
260
331
  */
261
- run: TaskRunResultPublicV1.Run;
332
+ run: TaskRunResultPublicV2.Run;
262
333
  }
263
334
 
264
- export namespace TaskRunResultPublicV1 {
265
- export interface TaskRunTextOutputPublicV1 {
335
+ export namespace TaskRunResultPublicV2 {
336
+ export interface TaskRunTextOutputPublicV2 {
266
337
  /**
267
338
  * The final prose answer.
268
339
  */
@@ -271,7 +342,7 @@ export namespace RunGetResultResponse {
271
342
  /**
272
343
  * Trust and citation metadata for the output.
273
344
  */
274
- trust: TaskRunTextOutputPublicV1.Trust;
345
+ trust: TaskRunTextOutputPublicV2.Trust;
275
346
 
276
347
  /**
277
348
  * Output content type.
@@ -279,7 +350,7 @@ export namespace RunGetResultResponse {
279
350
  type?: 'text';
280
351
  }
281
352
 
282
- export namespace TaskRunTextOutputPublicV1 {
353
+ export namespace TaskRunTextOutputPublicV2 {
283
354
  /**
284
355
  * Trust and citation metadata for the output.
285
356
  */
@@ -438,7 +509,7 @@ export namespace RunGetResultResponse {
438
509
  }
439
510
  }
440
511
 
441
- export interface TaskRunJsonOutputPublicV1 {
512
+ export interface TaskRunJsonOutputPublicV2 {
442
513
  /**
443
514
  * The final structured output.
444
515
  */
@@ -447,7 +518,7 @@ export namespace RunGetResultResponse {
447
518
  /**
448
519
  * Trust and citation metadata for the output.
449
520
  */
450
- trust: TaskRunJsonOutputPublicV1.Trust;
521
+ trust: TaskRunJsonOutputPublicV2.Trust;
451
522
 
452
523
  /**
453
524
  * Output content type.
@@ -455,7 +526,7 @@ export namespace RunGetResultResponse {
455
526
  type?: 'json';
456
527
  }
457
528
 
458
- export namespace TaskRunJsonOutputPublicV1 {
529
+ export namespace TaskRunJsonOutputPublicV2 {
459
530
  /**
460
531
  * Trust and citation metadata for the output.
461
532
  */
@@ -692,19 +763,19 @@ export namespace RunGetResultResponse {
692
763
  }
693
764
  }
694
765
 
695
- export interface TaskRunFailedResultPublicV1 {
766
+ export interface TaskRunFailedResultPublicV2 {
696
767
  /**
697
768
  * Structured error detail.
698
769
  */
699
- error: TaskRunFailedResultPublicV1.Error;
770
+ error: TaskRunFailedResultPublicV2.Error;
700
771
 
701
772
  /**
702
773
  * Task run object with status 'failed'.
703
774
  */
704
- run: TaskRunFailedResultPublicV1.Run;
775
+ run: TaskRunFailedResultPublicV2.Run;
705
776
  }
706
777
 
707
- export namespace TaskRunFailedResultPublicV1 {
778
+ export namespace TaskRunFailedResultPublicV2 {
708
779
  /**
709
780
  * Structured error detail.
710
781
  */
@@ -799,6 +870,107 @@ export namespace RunGetResultResponse {
799
870
  }
800
871
  }
801
872
 
873
+ export interface RunCreateParams {
874
+ /**
875
+ * User prompt or task instructions for the run.
876
+ */
877
+ input: string;
878
+
879
+ /**
880
+ * Canonical effort tier names for the research graph.
881
+ */
882
+ effort?: 'low' | 'medium' | 'high' | 'x-high' | 'max' | null;
883
+
884
+ /**
885
+ * Whether to stream run events when supported.
886
+ */
887
+ enable_events?: boolean;
888
+
889
+ /**
890
+ * Existing records to ENRICH: a list of partial rows, or a single object,
891
+ * mirroring output_schema's shape.
892
+ */
893
+ input_data?: Array<{ [key: string]: unknown }> | { [key: string]: unknown } | null;
894
+
895
+ /**
896
+ * JSON schema overriding the agent's default structured output for this run.
897
+ */
898
+ output_schema?: { [key: string]: unknown } | null;
899
+
900
+ /**
901
+ * Previous interaction identifier used to continue a conversation.
902
+ */
903
+ previous_interaction_id?: string | null;
904
+
905
+ /**
906
+ * Source guidance overriding the agent default.
907
+ */
908
+ sources?: RunCreateParams.Sources | null;
909
+ }
910
+
911
+ export namespace RunCreateParams {
912
+ /**
913
+ * Source guidance overriding the agent default.
914
+ */
915
+ export interface Sources {
916
+ /**
917
+ * Source groups the agent is allowed to use.
918
+ */
919
+ allow?: Array<Sources.Allow>;
920
+
921
+ /**
922
+ * Free-text guidance describing sources or domains to avoid.
923
+ */
924
+ avoid?: string | null;
925
+
926
+ /**
927
+ * Source groups the agent should not use.
928
+ */
929
+ block?: Array<Sources.Block>;
930
+
931
+ /**
932
+ * Free-text guidance describing sources or domains to prioritize.
933
+ */
934
+ prioritize?: string | null;
935
+ }
936
+
937
+ export namespace Sources {
938
+ export interface Allow {
939
+ /**
940
+ * Domains included in this source group.
941
+ */
942
+ domains: Array<string>;
943
+
944
+ /**
945
+ * Source group title.
946
+ */
947
+ title: string;
948
+
949
+ /**
950
+ * Zero-based source group position.
951
+ */
952
+ order?: number;
953
+ }
954
+
955
+ export interface Block {
956
+ /**
957
+ * Domains included in this source group.
958
+ */
959
+ domains: Array<string>;
960
+
961
+ /**
962
+ * Source group title.
963
+ */
964
+ title: string;
965
+
966
+ /**
967
+ * Zero-based source group position.
968
+ */
969
+ order?: number;
970
+ }
971
+ }
972
+ }
973
+
802
974
  export interface RunListParams {
803
975
  limit?: number;
804
976
 
@@ -809,7 +981,7 @@ export interface RunGetParams {
809
981
  agent_id: string;
810
982
  }
811
983
 
812
- export interface RunGetResultParams {
984
+ export interface RunResultParams {
813
985
  agent_id: string;
814
986
  }
815
987
 
@@ -819,12 +991,14 @@ export interface RunStreamEventsParams {
819
991
 
820
992
  export declare namespace Runs {
821
993
  export {
994
+ type RunCreateResponse as RunCreateResponse,
822
995
  type RunListResponse as RunListResponse,
823
996
  type RunGetResponse as RunGetResponse,
824
- type RunGetResultResponse as RunGetResultResponse,
997
+ type RunResultResponse as RunResultResponse,
998
+ type RunCreateParams as RunCreateParams,
825
999
  type RunListParams as RunListParams,
826
1000
  type RunGetParams as RunGetParams,
827
- type RunGetResultParams as RunGetResultParams,
1001
+ type RunResultParams as RunResultParams,
828
1002
  type RunStreamEventsParams as RunStreamEventsParams,
829
1003
  };
830
1004
  }
@@ -7,24 +7,21 @@ import { path } from '../../internal/utils/path';
7
7
 
8
8
  export class Templates extends APIResource {
9
9
  /**
10
- * List Templates
11
- *
12
- * @deprecated
10
+ * List the pre-built agent templates available to your account. Use a template's
11
+ * `template_name` with `POST /v2/agents` to create an agent instance from it.
13
12
  */
14
13
  list(
15
14
  query: TemplateListParams | null | undefined = {},
16
15
  options?: RequestOptions,
17
16
  ): APIPromise<TemplateListResponse> {
18
- return this._client.get('/v1/task-agents/templates', { query, ...options });
17
+ return this._client.get('/v2/agents/templates', { query, ...options });
19
18
  }
20
19
 
21
20
  /**
22
- * Get Template
23
- *
24
- * @deprecated
21
+ * Retrieve a single agent template by its stable `template_name`.
25
22
  */
26
23
  get(templateName: string, options?: RequestOptions): APIPromise<TemplateGetResponse> {
27
- return this._client.get(path`/v1/task-agents/templates/${templateName}`, options);
24
+ return this._client.get(path`/v2/agents/templates/${templateName}`, options);
28
25
  }
29
26
  }
30
27
 
@@ -1,3 +1,3 @@
1
1
  // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
2
 
3
- export * from './task-agent/index';
3
+ export * from './agents/index';
@@ -11,7 +11,7 @@ export class Batches extends APIResource {
11
11
  * Retrieve a paginated list of batches for the authenticated account.
12
12
  */
13
13
  list(options?: RequestOptions): APIPromise<void> {
14
- return this._client.get('/v1/batches', {
14
+ return this._client.get('/v2/batches', {
15
15
  ...options,
16
16
  headers: buildHeaders([{ Accept: '*/*' }, options?.headers]),
17
17
  });
@@ -21,7 +21,7 @@ export class Batches extends APIResource {
21
21
  * Retrieve the details of a batch including all its tasks and completion status.
22
22
  */
23
23
  get(batchID: string, options?: RequestOptions): APIPromise<BatchGetResponse> {
24
- return this._client.get(path`/v1/batches/${batchID}`, options);
24
+ return this._client.get(path`/v2/batches/${batchID}`, options);
25
25
  }
26
26
 
27
27
  /**
@@ -29,7 +29,7 @@ export class Batches extends APIResource {
29
29
  * details.
30
30
  */
31
31
  progress(batchID: string, options?: RequestOptions): APIPromise<BatchProgressResponse> {
32
- return this._client.get(path`/v1/batches/${batchID}/progress`, options);
32
+ return this._client.get(path`/v2/batches/${batchID}/progress`, options);
33
33
  }
34
34
  }
35
35
 
@@ -19,7 +19,7 @@ export class Crawl extends APIResource {
19
19
  query: CrawlListParams | null | undefined = {},
20
20
  options?: RequestOptions,
21
21
  ): APIPromise<CrawlListResponse> {
22
- return this._client.get('/v1/crawl', { query, ...options });
22
+ return this._client.get('/v2/crawl', { query, ...options });
23
23
  }
24
24
 
25
25
  /**
@@ -31,7 +31,7 @@ export class Crawl extends APIResource {
31
31
  * ```
32
32
  */
33
33
  run(body: CrawlRunParams, options?: RequestOptions): APIPromise<CrawlRunResponse> {
34
- return this._client.post('/v1/crawl', { body, ...options });
34
+ return this._client.post('/v2/crawl', { body, ...options });
35
35
  }
36
36
 
37
37
  /**
@@ -45,7 +45,7 @@ export class Crawl extends APIResource {
45
45
  * ```
46
46
  */
47
47
  status(id: string, options?: RequestOptions): APIPromise<CrawlStatusResponse> {
48
- return this._client.get(path`/v1/crawl/${id}`, options);
48
+ return this._client.get(path`/v2/crawl/${id}`, options);
49
49
  }
50
50
 
51
51
  /**
@@ -59,7 +59,7 @@ export class Crawl extends APIResource {
59
59
  * ```
60
60
  */
61
61
  terminate(id: string, options?: RequestOptions): APIPromise<CrawlTerminateResponse> {
62
- return this._client.delete(path`/v1/crawl/${id}`, options);
62
+ return this._client.delete(path`/v2/crawl/${id}`, options);
63
63
  }
64
64
  }
65
65
 
@@ -13,7 +13,7 @@ export class DomainKnowledge extends APIResource {
13
13
  query: DomainKnowledgeGetDriverParams | null | undefined = {},
14
14
  options?: RequestOptions,
15
15
  ): APIPromise<DomainKnowledgeGetDriverResponse> {
16
- return this._client.get('/v1/domain-knowledge/driver', { query, ...options });
16
+ return this._client.get('/v2/domain-knowledge/driver', { query, ...options });
17
17
  }
18
18
  }
19
19