parallel-web 0.3.1 → 0.4.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 (121) hide show
  1. package/CHANGELOG.md +76 -0
  2. package/README.md +2 -2
  3. package/client.d.mts +46 -3
  4. package/client.d.mts.map +1 -1
  5. package/client.d.ts +46 -3
  6. package/client.d.ts.map +1 -1
  7. package/client.js +66 -19
  8. package/client.js.map +1 -1
  9. package/client.mjs +66 -19
  10. package/client.mjs.map +1 -1
  11. package/core/streaming.js.map +1 -1
  12. package/core/streaming.mjs.map +1 -1
  13. package/internal/parse.d.mts.map +1 -1
  14. package/internal/parse.d.ts.map +1 -1
  15. package/internal/parse.js +5 -0
  16. package/internal/parse.js.map +1 -1
  17. package/internal/parse.mjs +5 -0
  18. package/internal/parse.mjs.map +1 -1
  19. package/internal/utils/env.js +2 -2
  20. package/internal/utils/env.js.map +1 -1
  21. package/internal/utils/env.mjs +2 -2
  22. package/internal/utils/env.mjs.map +1 -1
  23. package/internal/utils/query.d.mts +5 -0
  24. package/internal/utils/query.d.mts.map +1 -0
  25. package/internal/utils/query.d.ts +5 -0
  26. package/internal/utils/query.d.ts.map +1 -0
  27. package/internal/utils/query.js +23 -0
  28. package/internal/utils/query.js.map +1 -0
  29. package/internal/utils/query.mjs +20 -0
  30. package/internal/utils/query.mjs.map +1 -0
  31. package/internal/utils.d.mts +1 -0
  32. package/internal/utils.d.ts +1 -0
  33. package/internal/utils.js +1 -0
  34. package/internal/utils.js.map +1 -1
  35. package/internal/utils.mjs +1 -0
  36. package/package.json +12 -1
  37. package/resources/beta/beta.d.mts +52 -72
  38. package/resources/beta/beta.d.mts.map +1 -1
  39. package/resources/beta/beta.d.ts +52 -72
  40. package/resources/beta/beta.d.ts.map +1 -1
  41. package/resources/beta/beta.js +10 -4
  42. package/resources/beta/beta.js.map +1 -1
  43. package/resources/beta/beta.mjs +10 -4
  44. package/resources/beta/beta.mjs.map +1 -1
  45. package/resources/beta/findall.d.mts +171 -9
  46. package/resources/beta/findall.d.mts.map +1 -1
  47. package/resources/beta/findall.d.ts +171 -9
  48. package/resources/beta/findall.d.ts.map +1 -1
  49. package/resources/beta/findall.js +111 -0
  50. package/resources/beta/findall.js.map +1 -1
  51. package/resources/beta/findall.mjs +111 -0
  52. package/resources/beta/findall.mjs.map +1 -1
  53. package/resources/beta/index.d.mts +2 -2
  54. package/resources/beta/index.d.mts.map +1 -1
  55. package/resources/beta/index.d.ts +2 -2
  56. package/resources/beta/index.d.ts.map +1 -1
  57. package/resources/beta/index.js.map +1 -1
  58. package/resources/beta/index.mjs.map +1 -1
  59. package/resources/beta/task-group.d.mts +60 -4
  60. package/resources/beta/task-group.d.mts.map +1 -1
  61. package/resources/beta/task-group.d.ts +60 -4
  62. package/resources/beta/task-group.d.ts.map +1 -1
  63. package/resources/beta/task-group.js +52 -1
  64. package/resources/beta/task-group.js.map +1 -1
  65. package/resources/beta/task-group.mjs +52 -1
  66. package/resources/beta/task-group.mjs.map +1 -1
  67. package/resources/beta/task-run.d.mts +85 -266
  68. package/resources/beta/task-run.d.mts.map +1 -1
  69. package/resources/beta/task-run.d.ts +85 -266
  70. package/resources/beta/task-run.d.ts.map +1 -1
  71. package/resources/beta/task-run.js +21 -2
  72. package/resources/beta/task-run.js.map +1 -1
  73. package/resources/beta/task-run.mjs +21 -2
  74. package/resources/beta/task-run.mjs.map +1 -1
  75. package/resources/index.d.mts +2 -1
  76. package/resources/index.d.mts.map +1 -1
  77. package/resources/index.d.ts +2 -1
  78. package/resources/index.d.ts.map +1 -1
  79. package/resources/index.js.map +1 -1
  80. package/resources/index.mjs.map +1 -1
  81. package/resources/shared.d.mts +4 -2
  82. package/resources/shared.d.mts.map +1 -1
  83. package/resources/shared.d.ts +4 -2
  84. package/resources/shared.d.ts.map +1 -1
  85. package/resources/task-run.d.mts +324 -29
  86. package/resources/task-run.d.mts.map +1 -1
  87. package/resources/task-run.d.ts +324 -29
  88. package/resources/task-run.d.ts.map +1 -1
  89. package/resources/task-run.js +71 -4
  90. package/resources/task-run.js.map +1 -1
  91. package/resources/task-run.mjs +71 -4
  92. package/resources/task-run.mjs.map +1 -1
  93. package/resources/top-level.d.mts +317 -0
  94. package/resources/top-level.d.mts.map +1 -0
  95. package/resources/top-level.d.ts +317 -0
  96. package/resources/top-level.d.ts.map +1 -0
  97. package/resources/top-level.js +4 -0
  98. package/resources/top-level.js.map +1 -0
  99. package/resources/top-level.mjs +3 -0
  100. package/resources/top-level.mjs.map +1 -0
  101. package/src/client.ts +118 -24
  102. package/src/core/streaming.ts +2 -2
  103. package/src/internal/parse.ts +6 -0
  104. package/src/internal/utils/env.ts +2 -2
  105. package/src/internal/utils/query.ts +23 -0
  106. package/src/internal/utils.ts +1 -0
  107. package/src/resources/beta/api.md +87 -0
  108. package/src/resources/beta/beta.ts +67 -84
  109. package/src/resources/beta/findall.ts +191 -7
  110. package/src/resources/beta/index.ts +7 -4
  111. package/src/resources/beta/task-group.ts +64 -6
  112. package/src/resources/beta/task-run.ts +103 -300
  113. package/src/resources/index.ts +20 -0
  114. package/src/resources/shared.ts +4 -2
  115. package/src/resources/task-run.ts +410 -31
  116. package/src/resources/top-level.ts +385 -0
  117. package/src/version.ts +1 -1
  118. package/version.d.mts +1 -1
  119. package/version.d.ts +1 -1
  120. package/version.js +1 -1
  121. package/version.mjs +1 -1
@@ -2,10 +2,24 @@
2
2
 
3
3
  import { APIResource } from '../core/resource';
4
4
  import * as Shared from './shared';
5
+ import * as BetaTaskRunAPI from './beta/task-run';
5
6
  import { APIPromise } from '../core/api-promise';
7
+ import { Stream } from '../core/streaming';
8
+ import { buildHeaders } from '../internal/headers';
6
9
  import { RequestOptions } from '../internal/request-options';
7
10
  import { path } from '../internal/utils/path';
8
11
 
12
+ /**
13
+ * The Task API executes web research and extraction tasks. Clients submit a natural-language objective with an optional input schema; the service plans retrieval, fetches relevant URLs, and returns outputs that conform to a provided or inferred JSON schema. Supports deep research style queries and can return rich structured JSON outputs. Processors trade-off between cost, latency, and quality. Each processor supports calibrated confidences.
14
+ * - Output metadata: citations, excerpts, reasoning, and confidence per field
15
+ *
16
+ * Task Groups enable batch execution of many independent Task runs with group-level monitoring and failure handling.
17
+ * - Submit hundreds or thousands of Tasks as a single group
18
+ * - Observe group progress and receive results as they complete
19
+ * - Real-time updates via Server-Sent Events (SSE)
20
+ * - Add tasks to an existing group while it is running
21
+ * - Group-level retry and error aggregation
22
+ */
9
23
  export class TaskRun extends APIResource {
10
24
  /**
11
25
  * Initiates a task run.
@@ -13,29 +27,85 @@ export class TaskRun extends APIResource {
13
27
  * Returns immediately with a run object in status 'queued'.
14
28
  *
15
29
  * Beta features can be enabled by setting the 'parallel-beta' header.
16
- */
17
- create(body: TaskRunCreateParams, options?: RequestOptions): APIPromise<TaskRun> {
18
- return this._client.post('/v1/tasks/runs', { body, ...options });
30
+ *
31
+ * @example
32
+ * ```ts
33
+ * const taskRun = await client.taskRun.create({
34
+ * input: 'What was the GDP of France in 2023?',
35
+ * processor: 'base',
36
+ * });
37
+ * ```
38
+ */
39
+ create(params: TaskRunCreateParams, options?: RequestOptions): APIPromise<TaskRun> {
40
+ const { betas, ...body } = params;
41
+ return this._client.post('/v1/tasks/runs', {
42
+ body,
43
+ ...options,
44
+ headers: buildHeaders([
45
+ { ...(betas?.toString() != null ? { 'parallel-beta': betas?.toString() } : undefined) },
46
+ options?.headers,
47
+ ]),
48
+ });
19
49
  }
20
50
 
21
51
  /**
22
52
  * Retrieves run status by run_id.
23
53
  *
24
54
  * The run result is available from the `/result` endpoint.
55
+ *
56
+ * @example
57
+ * ```ts
58
+ * const taskRun = await client.taskRun.retrieve('run_id');
59
+ * ```
25
60
  */
26
61
  retrieve(runID: string, options?: RequestOptions): APIPromise<TaskRun> {
27
62
  return this._client.get(path`/v1/tasks/runs/${runID}`, options);
28
63
  }
29
64
 
65
+ /**
66
+ * Streams events for a task run.
67
+ *
68
+ * Returns a stream of events showing progress updates and state changes for the
69
+ * task run.
70
+ *
71
+ * For task runs that did not have enable_events set to true during creation, the
72
+ * frequency of events will be reduced.
73
+ *
74
+ * @example
75
+ * ```ts
76
+ * const response = await client.taskRun.events('run_id');
77
+ * ```
78
+ */
79
+ events(runID: string, options?: RequestOptions): APIPromise<Stream<TaskRunEventsResponse>> {
80
+ return this._client.get(path`/v1/tasks/runs/${runID}/events`, {
81
+ ...options,
82
+ headers: buildHeaders([{ Accept: 'text/event-stream' }, options?.headers]),
83
+ stream: true,
84
+ }) as APIPromise<Stream<TaskRunEventsResponse>>;
85
+ }
86
+
30
87
  /**
31
88
  * Retrieves a run result by run_id, blocking until the run is completed.
89
+ *
90
+ * @example
91
+ * ```ts
92
+ * const taskRunResult = await client.taskRun.result('run_id');
93
+ * ```
32
94
  */
33
95
  result(
34
96
  runID: string,
35
- query: TaskRunResultParams | null | undefined = {},
97
+ params: TaskRunResultParams | null | undefined = {},
36
98
  options?: RequestOptions,
37
99
  ): APIPromise<TaskRunResult> {
38
- return this._client.get(path`/v1/tasks/runs/${runID}/result`, { query, ...options });
100
+ const { betas, ...query } = params ?? {};
101
+ return this._client.get(path`/v1/tasks/runs/${runID}/result`, {
102
+ query,
103
+ ...options,
104
+ headers: buildHeaders([
105
+ { ...(betas?.toString() != null ? { 'parallel-beta': betas?.toString() } : undefined) },
106
+ options?.headers,
107
+ ]),
108
+ });
39
109
  }
40
110
  }
41
111
 
@@ -70,6 +140,21 @@ export interface Citation {
70
140
  title?: string | null;
71
141
  }
72
142
 
143
+ /**
144
+ * Event indicating an error.
145
+ */
146
+ export interface ErrorEvent {
147
+ /**
148
+ * Error.
149
+ */
150
+ error: Shared.ErrorObject;
151
+
152
+ /**
153
+ * Event type; always 'error'.
154
+ */
155
+ type: 'error';
156
+ }
157
+
73
158
  /**
74
159
  * Citations and reasoning supporting one field of a task output.
75
160
  */
@@ -111,6 +196,71 @@ export interface JsonSchema {
111
196
  type?: 'json';
112
197
  }
113
198
 
199
+ /**
200
+ * MCP server configuration.
201
+ */
202
+ export interface McpServer {
203
+ /**
204
+ * Name of the MCP server.
205
+ */
206
+ name: string;
207
+
208
+ /**
209
+ * URL of the MCP server.
210
+ */
211
+ url: string;
212
+
213
+ /**
214
+ * List of allowed tools for the MCP server.
215
+ */
216
+ allowed_tools?: Array<string> | null;
217
+
218
+ /**
219
+ * Headers for the MCP server.
220
+ */
221
+ headers?: { [key: string]: string } | null;
222
+
223
+ /**
224
+ * Type of MCP server being configured. Always `url`.
225
+ */
226
+ type?: 'url';
227
+ }
228
+
229
+ /**
230
+ * Result of an MCP tool call.
231
+ */
232
+ export interface McpToolCall {
233
+ /**
234
+ * Arguments used to call the MCP tool.
235
+ */
236
+ arguments: string;
237
+
238
+ /**
239
+ * Name of the MCP server.
240
+ */
241
+ server_name: string;
242
+
243
+ /**
244
+ * Identifier for the tool call.
245
+ */
246
+ tool_call_id: string;
247
+
248
+ /**
249
+ * Name of the tool being called.
250
+ */
251
+ tool_name: string;
252
+
253
+ /**
254
+ * Output received from the tool call, if successful.
255
+ */
256
+ content?: string | null;
257
+
258
+ /**
259
+ * Error message if the tool call failed.
260
+ */
261
+ error?: string | null;
262
+ }
263
+
114
264
  /**
115
265
  * Request to run a task.
116
266
  */
@@ -125,12 +275,37 @@ export interface RunInput {
125
275
  */
126
276
  processor: string;
127
277
 
278
+ /**
279
+ * Advanced search configuration for a task run.
280
+ */
281
+ advanced_settings?: RunInput.AdvancedSettings | null;
282
+
283
+ /**
284
+ * Controls tracking of task run execution progress. When set to true, progress
285
+ * events are recorded and can be accessed via the
286
+ * [Task Run events](https://docs.parallel.ai/api-reference) endpoint. When false,
287
+ * no progress events are tracked. Note that progress tracking cannot be enabled
288
+ * after a run has been created. The flag is set to true by default for premium
289
+ * processors (pro and above).
290
+ */
291
+ enable_events?: boolean | null;
292
+
293
+ /**
294
+ * Optional list of MCP servers to use for the run.
295
+ */
296
+ mcp_servers?: Array<McpServer> | null;
297
+
128
298
  /**
129
299
  * User-provided metadata stored with the run. Keys and values must be strings with
130
300
  * a maximum length of 16 and 512 characters respectively.
131
301
  */
132
302
  metadata?: { [key: string]: string | number | boolean } | null;
133
303
 
304
+ /**
305
+ * Interaction ID to use as context for this request.
306
+ */
307
+ previous_interaction_id?: string | null;
308
+
134
309
  /**
135
310
  * Source policy for web search results.
136
311
  *
@@ -147,6 +322,23 @@ export interface RunInput {
147
322
  * For convenience bare strings are also accepted as input or output schemas.
148
323
  */
149
324
  task_spec?: TaskSpec | null;
325
+
326
+ /**
327
+ * Webhooks for Task Runs.
328
+ */
329
+ webhook?: Webhook | null;
330
+ }
331
+
332
+ export namespace RunInput {
333
+ /**
334
+ * Advanced search configuration for a task run.
335
+ */
336
+ export interface AdvancedSettings {
337
+ /**
338
+ * ISO 3166-1 alpha-2 country code for geo-targeted search results.
339
+ */
340
+ location?: string | null;
341
+ }
150
342
  }
151
343
 
152
344
  /**
@@ -158,6 +350,12 @@ export interface TaskRun {
158
350
  */
159
351
  created_at: string | null;
160
352
 
353
+ /**
354
+ * Identifier for this interaction. Pass this value as `previous_interaction_id` to
355
+ * reuse context for a future request.
356
+ */
357
+ interaction_id: string;
358
+
161
359
  /**
162
360
  * Whether the run is currently active, i.e. status is one of {'cancelling',
163
361
  * 'queued', 'running'}.
@@ -205,6 +403,38 @@ export interface TaskRun {
205
403
  warnings?: Array<Shared.Warning> | null;
206
404
  }
207
405
 
406
+ /**
407
+ * Event when a task run transitions to a non-active status.
408
+ *
409
+ * May indicate completion, cancellation, or failure.
410
+ */
411
+ export interface TaskRunEvent {
412
+ /**
413
+ * Cursor to resume the event stream. Always empty for non Task Group runs.
414
+ */
415
+ event_id: string | null;
416
+
417
+ /**
418
+ * Task run object.
419
+ */
420
+ run: TaskRun;
421
+
422
+ /**
423
+ * Event type; always 'task_run.state'.
424
+ */
425
+ type: 'task_run.state';
426
+
427
+ /**
428
+ * Request to run a task.
429
+ */
430
+ input?: RunInput | null;
431
+
432
+ /**
433
+ * Output from the run; included only if requested and if status == `completed`.
434
+ */
435
+ output?: TaskRunTextOutput | TaskRunJsonOutput | null;
436
+ }
437
+
208
438
  /**
209
439
  * Output from a task that returns JSON.
210
440
  */
@@ -229,19 +459,16 @@ export interface TaskRunJsonOutput {
229
459
  type: 'json';
230
460
 
231
461
  /**
232
- * Additional fields from beta features used in this task run. When beta features
233
- * are specified during both task run creation and result retrieval, this field
234
- * will be empty and instead the relevant beta attributes will be directly included
235
- * in the `BetaTaskRunJsonOutput` or corresponding output type. However, if beta
236
- * features were specified during task run creation but not during result
237
- * retrieval, this field will contain the dump of fields from those beta features.
238
- * Each key represents the beta feature version (one amongst parallel-beta headers)
239
- * and the values correspond to the beta feature attributes, if any. For now, only
240
- * MCP server beta features have attributes. For example,
241
- * `{mcp-server-2025-07-17: [{'server_name':'mcp_server', 'tool_call_id': 'tc_123', ...}]}}`
462
+ * @deprecated Deprecated. mcp-server-2025-07-17 is now included directly in the
463
+ * output (e.g. mcp_tool_calls).
242
464
  */
243
465
  beta_fields?: { [key: string]: unknown } | null;
244
466
 
467
+ /**
468
+ * MCP tool calls made by the task.
469
+ */
470
+ mcp_tool_calls?: Array<McpToolCall> | null;
471
+
245
472
  /**
246
473
  * Output schema for the Task Run. Populated only if the task was executed with an
247
474
  * auto schema.
@@ -285,18 +512,15 @@ export interface TaskRunTextOutput {
285
512
  type: 'text';
286
513
 
287
514
  /**
288
- * Additional fields from beta features used in this task run. When beta features
289
- * are specified during both task run creation and result retrieval, this field
290
- * will be empty and instead the relevant beta attributes will be directly included
291
- * in the `BetaTaskRunJsonOutput` or corresponding output type. However, if beta
292
- * features were specified during task run creation but not during result
293
- * retrieval, this field will contain the dump of fields from those beta features.
294
- * Each key represents the beta feature version (one amongst parallel-beta headers)
295
- * and the values correspond to the beta feature attributes, if any. For now, only
296
- * MCP server beta features have attributes. For example,
297
- * `{mcp-server-2025-07-17: [{'server_name':'mcp_server', 'tool_call_id': 'tc_123', ...}]}}`
515
+ * @deprecated Deprecated. mcp-server-2025-07-17 is now included directly in the
516
+ * output (e.g. mcp_tool_calls).
298
517
  */
299
518
  beta_fields?: { [key: string]: unknown } | null;
519
+
520
+ /**
521
+ * MCP tool calls made by the task.
522
+ */
523
+ mcp_tool_calls?: Array<McpToolCall> | null;
300
524
  }
301
525
 
302
526
  /**
@@ -338,32 +562,151 @@ export interface TextSchema {
338
562
  type?: 'text';
339
563
  }
340
564
 
565
+ /**
566
+ * Webhooks for Task Runs.
567
+ */
568
+ export interface Webhook {
569
+ /**
570
+ * URL for the webhook.
571
+ */
572
+ url: string;
573
+
574
+ /**
575
+ * Event types to send the webhook notifications for.
576
+ */
577
+ event_types?: Array<'task_run.status'>;
578
+ }
579
+
580
+ /**
581
+ * A progress update for a task run.
582
+ */
583
+ export type TaskRunEventsResponse =
584
+ | TaskRunEventsResponse.TaskRunProgressStatsEvent
585
+ | TaskRunEventsResponse.TaskRunProgressMessageEvent
586
+ | TaskRunEvent
587
+ | ErrorEvent;
588
+
589
+ export namespace TaskRunEventsResponse {
590
+ /**
591
+ * A progress update for a task run.
592
+ */
593
+ export interface TaskRunProgressStatsEvent {
594
+ /**
595
+ * Completion percentage of the task run. Ranges from 0 to 100 where 0 indicates no
596
+ * progress and 100 indicates completion.
597
+ */
598
+ progress_meter: number;
599
+
600
+ /**
601
+ * Source stats describing progress so far.
602
+ */
603
+ source_stats: TaskRunProgressStatsEvent.SourceStats;
604
+
605
+ /**
606
+ * Event type; always 'task_run.progress_stats'.
607
+ */
608
+ type: 'task_run.progress_stats';
609
+ }
610
+
611
+ export namespace TaskRunProgressStatsEvent {
612
+ /**
613
+ * Source stats describing progress so far.
614
+ */
615
+ export interface SourceStats {
616
+ /**
617
+ * Number of sources considered in processing the task.
618
+ */
619
+ num_sources_considered: number | null;
620
+
621
+ /**
622
+ * Number of sources read in processing the task.
623
+ */
624
+ num_sources_read: number | null;
625
+
626
+ /**
627
+ * A sample of URLs of sources read in processing the task.
628
+ */
629
+ sources_read_sample: Array<string> | null;
630
+ }
631
+ }
632
+
633
+ /**
634
+ * A message for a task run progress update.
635
+ */
636
+ export interface TaskRunProgressMessageEvent {
637
+ /**
638
+ * Progress update message.
639
+ */
640
+ message: string;
641
+
642
+ /**
643
+ * Timestamp of the message.
644
+ */
645
+ timestamp: string | null;
646
+
647
+ /**
648
+ * Event type; always starts with 'task_run.progress_msg'.
649
+ */
650
+ type:
651
+ | 'task_run.progress_msg.plan'
652
+ | 'task_run.progress_msg.search'
653
+ | 'task_run.progress_msg.result'
654
+ | 'task_run.progress_msg.tool_call'
655
+ | 'task_run.progress_msg.exec_status';
656
+ }
657
+ }
658
+
341
659
  export interface TaskRunCreateParams {
342
660
  /**
343
- * Input to the task, either text or a JSON object.
661
+ * Body param: Input to the task, either text or a JSON object.
344
662
  */
345
663
  input: string | { [key: string]: unknown };
346
664
 
347
665
  /**
348
- * Processor to use for the task.
666
+ * Body param: Processor to use for the task.
349
667
  */
350
668
  processor: string;
351
669
 
352
670
  /**
353
- * User-provided metadata stored with the run. Keys and values must be strings with
354
- * a maximum length of 16 and 512 characters respectively.
671
+ * Body param: Advanced search configuration for a task run.
672
+ */
673
+ advanced_settings?: TaskRunCreateParams.AdvancedSettings | null;
674
+
675
+ /**
676
+ * Body param: Controls tracking of task run execution progress. When set to true,
677
+ * progress events are recorded and can be accessed via the
678
+ * [Task Run events](https://docs.parallel.ai/api-reference) endpoint. When false,
679
+ * no progress events are tracked. Note that progress tracking cannot be enabled
680
+ * after a run has been created. The flag is set to true by default for premium
681
+ * processors (pro and above).
682
+ */
683
+ enable_events?: boolean | null;
684
+
685
+ /**
686
+ * Body param: Optional list of MCP servers to use for the run.
687
+ */
688
+ mcp_servers?: Array<McpServer> | null;
689
+
690
+ /**
691
+ * Body param: User-provided metadata stored with the run. Keys and values must be
692
+ * strings with a maximum length of 16 and 512 characters respectively.
355
693
  */
356
694
  metadata?: { [key: string]: string | number | boolean } | null;
357
695
 
358
696
  /**
359
- * Source policy for web search results.
697
+ * Body param: Interaction ID to use as context for this request.
698
+ */
699
+ previous_interaction_id?: string | null;
700
+
701
+ /**
702
+ * Body param: Source policy for web search results.
360
703
  *
361
704
  * This policy governs which sources are allowed/disallowed in results.
362
705
  */
363
706
  source_policy?: Shared.SourcePolicy | null;
364
707
 
365
708
  /**
366
- * Specification for a task.
709
+ * Body param: Specification for a task.
367
710
  *
368
711
  * Auto output schemas can be specified by setting `output_schema={"type":"auto"}`.
369
712
  * Not specifying a TaskSpec is the same as setting an auto output schema.
@@ -371,25 +714,61 @@ export interface TaskRunCreateParams {
371
714
  * For convenience bare strings are also accepted as input or output schemas.
372
715
  */
373
716
  task_spec?: TaskSpec | null;
717
+
718
+ /**
719
+ * Body param: Webhooks for Task Runs.
720
+ */
721
+ webhook?: Webhook | null;
722
+
723
+ /**
724
+ * Header param: Optional header to specify the beta version(s) to enable.
725
+ */
726
+ betas?: Array<BetaTaskRunAPI.ParallelBeta>;
727
+ }
728
+
729
+ export namespace TaskRunCreateParams {
730
+ /**
731
+ * Advanced search configuration for a task run.
732
+ */
733
+ export interface AdvancedSettings {
734
+ /**
735
+ * ISO 3166-1 alpha-2 country code for geo-targeted search results.
736
+ */
737
+ location?: string | null;
738
+ }
374
739
  }
375
740
 
376
741
  export interface TaskRunResultParams {
742
+ /**
743
+ * Query param
744
+ */
377
745
  timeout?: number;
746
+
747
+ /**
748
+ * Header param: Optional header to specify the beta version(s) to enable.
749
+ */
750
+ betas?: Array<BetaTaskRunAPI.ParallelBeta>;
378
751
  }
379
752
 
380
753
  export declare namespace TaskRun {
381
754
  export {
382
755
  type AutoSchema as AutoSchema,
383
756
  type Citation as Citation,
757
+ type ErrorEvent as ErrorEvent,
384
758
  type FieldBasis as FieldBasis,
385
759
  type JsonSchema as JsonSchema,
760
+ type McpServer as McpServer,
761
+ type McpToolCall as McpToolCall,
386
762
  type RunInput as RunInput,
387
763
  type TaskRun as TaskRun,
764
+ type TaskRunEvent as TaskRunEvent,
388
765
  type TaskRunJsonOutput as TaskRunJsonOutput,
389
766
  type TaskRunResult as TaskRunResult,
390
767
  type TaskRunTextOutput as TaskRunTextOutput,
391
768
  type TaskSpec as TaskSpec,
392
769
  type TextSchema as TextSchema,
770
+ type Webhook as Webhook,
771
+ type TaskRunEventsResponse as TaskRunEventsResponse,
393
772
  type TaskRunCreateParams as TaskRunCreateParams,
394
773
  type TaskRunResultParams as TaskRunResultParams,
395
774
  };