exa-js 2.13.0 → 2.14.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.
- package/README.md +4 -7
- package/dist/index.d.mts +83 -19
- package/dist/index.d.ts +83 -19
- package/dist/index.js +228 -59
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +227 -59
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -120,11 +120,10 @@ for await (const chunk of exa.streamAnswer("Explain quantum computing")) {
|
|
|
120
120
|
}
|
|
121
121
|
```
|
|
122
122
|
|
|
123
|
-
## Agent API
|
|
123
|
+
## Agent API
|
|
124
124
|
|
|
125
125
|
```ts
|
|
126
|
-
const run = await exa.
|
|
127
|
-
betas: ["agent-2026-05-07"],
|
|
126
|
+
const run = await exa.agent.runs.create({
|
|
128
127
|
query:
|
|
129
128
|
"Find engineering leaders at AI infrastructure companies that raised a Series A or B in the last 6 months.",
|
|
130
129
|
outputSchema: {
|
|
@@ -149,9 +148,7 @@ const run = await exa.beta.agent.runs.create({
|
|
|
149
148
|
effort: "auto",
|
|
150
149
|
});
|
|
151
150
|
|
|
152
|
-
const completedRun = await exa.
|
|
153
|
-
betas: ["agent-2026-05-07"],
|
|
154
|
-
});
|
|
151
|
+
const completedRun = await exa.agent.runs.pollUntilFinished(run.id);
|
|
155
152
|
console.log(completedRun.output?.structured);
|
|
156
153
|
```
|
|
157
154
|
|
|
@@ -176,4 +173,4 @@ Pull requests welcome! For major changes, open an issue first.
|
|
|
176
173
|
|
|
177
174
|
## License
|
|
178
175
|
|
|
179
|
-
[MIT](LICENSE)
|
|
176
|
+
[MIT](LICENSE).
|
package/dist/index.d.mts
CHANGED
|
@@ -4,9 +4,17 @@ import { ZodSchema } from 'zod';
|
|
|
4
4
|
* Types for the Exa Agent API.
|
|
5
5
|
*/
|
|
6
6
|
|
|
7
|
+
/**
|
|
8
|
+
* @deprecated Agent API beta header is no longer required for `exa.agent`.
|
|
9
|
+
* Retained for legacy `exa.beta.agent` compatibility.
|
|
10
|
+
*/
|
|
7
11
|
declare const AGENT_BETA_HEADER = "agent-2026-05-07";
|
|
8
12
|
interface AgentBetaOptions {
|
|
9
|
-
|
|
13
|
+
/**
|
|
14
|
+
* @deprecated Agent API beta header is no longer required for `exa.agent`.
|
|
15
|
+
* Values supplied to `exa.beta.agent` are sent as the `Exa-Beta` header.
|
|
16
|
+
*/
|
|
17
|
+
betas?: string[];
|
|
10
18
|
}
|
|
11
19
|
type AgentRunStatus = "queued" | "running" | "completed" | "failed" | "cancelled";
|
|
12
20
|
type AgentStopReason = "schema_satisfied" | "budget_reached" | "error" | "cancelled";
|
|
@@ -79,7 +87,7 @@ type AgentRunTyped<T> = Omit<AgentRun, "output"> & {
|
|
|
79
87
|
structured?: T;
|
|
80
88
|
}) | null;
|
|
81
89
|
};
|
|
82
|
-
interface ListAgentRunsParams
|
|
90
|
+
interface ListAgentRunsParams {
|
|
83
91
|
cursor?: string;
|
|
84
92
|
limit?: number;
|
|
85
93
|
}
|
|
@@ -101,7 +109,7 @@ interface AgentEvent {
|
|
|
101
109
|
createdAt?: string;
|
|
102
110
|
[key: string]: unknown;
|
|
103
111
|
}
|
|
104
|
-
interface ListAgentRunEventsParams
|
|
112
|
+
interface ListAgentRunEventsParams {
|
|
105
113
|
cursor?: string;
|
|
106
114
|
limit?: number;
|
|
107
115
|
}
|
|
@@ -112,7 +120,6 @@ interface ListAgentRunEventsResponse {
|
|
|
112
120
|
nextCursor: string | null;
|
|
113
121
|
}
|
|
114
122
|
interface CreateAgentRunParams {
|
|
115
|
-
betas: string[];
|
|
116
123
|
query: string;
|
|
117
124
|
systemPrompt?: string;
|
|
118
125
|
input?: AgentInput;
|
|
@@ -137,8 +144,8 @@ type RequestBody$2 = Record<string, unknown>;
|
|
|
137
144
|
declare class AgentBaseClient {
|
|
138
145
|
protected client: Exa;
|
|
139
146
|
constructor(client: Exa);
|
|
140
|
-
protected request<T = unknown>(endpoint: string,
|
|
141
|
-
protected rawRequest(endpoint: string,
|
|
147
|
+
protected request<T = unknown>(endpoint: string, method?: string, data?: RequestBody$2, params?: QueryParams$3, headers?: Record<string, string>): Promise<T>;
|
|
148
|
+
protected rawRequest(endpoint: string, method?: string, data?: RequestBody$2, params?: QueryParams$3, headers?: Record<string, string>): Promise<Response>;
|
|
142
149
|
protected buildPaginationParams(pagination?: ListAgentRunsParams | ListAgentRunEventsParams): QueryParams$3;
|
|
143
150
|
}
|
|
144
151
|
|
|
@@ -146,11 +153,12 @@ declare class AgentBaseClient {
|
|
|
146
153
|
* Client for the Exa Agent API.
|
|
147
154
|
*/
|
|
148
155
|
|
|
156
|
+
type WithBetaOptions<T> = T & AgentBetaOptions;
|
|
149
157
|
declare class AgentRunEventsClient extends AgentBaseClient {
|
|
150
158
|
/**
|
|
151
159
|
* List stored events for an Agent run.
|
|
152
160
|
*/
|
|
153
|
-
list(runId: string, options
|
|
161
|
+
list(runId: string, options?: ListAgentRunEventsParams): Promise<ListAgentRunEventsResponse>;
|
|
154
162
|
}
|
|
155
163
|
declare class AgentRunsClient extends AgentBaseClient {
|
|
156
164
|
/**
|
|
@@ -171,50 +179,98 @@ declare class AgentRunsClient extends AgentBaseClient {
|
|
|
171
179
|
/**
|
|
172
180
|
* Get an Agent run by ID.
|
|
173
181
|
*/
|
|
174
|
-
get(runId: string
|
|
182
|
+
get(runId: string): Promise<AgentRun>;
|
|
175
183
|
/**
|
|
176
184
|
* List Agent runs.
|
|
177
185
|
*/
|
|
178
|
-
list(options
|
|
186
|
+
list(options?: ListAgentRunsParams): Promise<ListAgentRunsResponse>;
|
|
179
187
|
/**
|
|
180
188
|
* Iterate through all Agent runs, handling pagination automatically.
|
|
181
189
|
*/
|
|
182
|
-
listAll(options
|
|
190
|
+
listAll(options?: ListAgentRunsParams): AsyncGenerator<AgentRun>;
|
|
183
191
|
/**
|
|
184
192
|
* Collect all Agent runs into an array.
|
|
185
193
|
*/
|
|
186
|
-
getAll(options
|
|
194
|
+
getAll(options?: ListAgentRunsParams): Promise<AgentRun[]>;
|
|
187
195
|
/**
|
|
188
196
|
* Cancel a queued or running Agent run.
|
|
189
197
|
*/
|
|
190
|
-
cancel(runId: string
|
|
198
|
+
cancel(runId: string): Promise<AgentRun>;
|
|
191
199
|
/**
|
|
192
200
|
* Delete a stored Agent run.
|
|
193
201
|
*/
|
|
194
|
-
delete(runId: string
|
|
202
|
+
delete(runId: string): Promise<DeletedAgentRun>;
|
|
195
203
|
/**
|
|
196
204
|
* Poll an Agent run until it reaches a terminal status.
|
|
197
205
|
*/
|
|
198
|
-
pollUntilFinished(runId: string, options
|
|
206
|
+
pollUntilFinished(runId: string, options?: {
|
|
199
207
|
pollInterval?: number;
|
|
200
208
|
timeoutMs?: number;
|
|
201
209
|
}): Promise<AgentRun & {
|
|
202
210
|
status: "completed" | "failed" | "cancelled";
|
|
203
211
|
}>;
|
|
204
212
|
}
|
|
205
|
-
declare class
|
|
213
|
+
declare class AgentClient {
|
|
214
|
+
/**
|
|
215
|
+
* @internal
|
|
216
|
+
*/
|
|
217
|
+
readonly client: Exa;
|
|
206
218
|
/**
|
|
207
219
|
* Client for Agent runs.
|
|
208
220
|
*/
|
|
209
221
|
runs: AgentRunsClient;
|
|
210
222
|
constructor(client: Exa);
|
|
211
223
|
}
|
|
224
|
+
declare class AgentBetaRunEventsClient extends AgentRunEventsClient {
|
|
225
|
+
/**
|
|
226
|
+
* List stored events for an Agent run.
|
|
227
|
+
*
|
|
228
|
+
* @deprecated Use exa.agent.runs.events instead.
|
|
229
|
+
*/
|
|
230
|
+
list(runId: string, options?: WithBetaOptions<ListAgentRunEventsParams>): Promise<ListAgentRunEventsResponse>;
|
|
231
|
+
}
|
|
232
|
+
declare class AgentBetaRunsClient extends AgentRunsClient {
|
|
233
|
+
/**
|
|
234
|
+
* @deprecated Use exa.agent.runs.events instead.
|
|
235
|
+
*/
|
|
236
|
+
events: AgentBetaRunEventsClient;
|
|
237
|
+
constructor(client: Exa);
|
|
238
|
+
create<T>(params: WithBetaOptions<AgentCreateOptions<T>> & {
|
|
239
|
+
stream: true;
|
|
240
|
+
}): Promise<AsyncGenerator<AgentEvent>>;
|
|
241
|
+
create<T>(params: WithBetaOptions<AgentCreateOptions<T>> & {
|
|
242
|
+
stream?: false;
|
|
243
|
+
}): Promise<AgentRunTyped<T>>;
|
|
244
|
+
create(params: CreateAgentRunParams & AgentBetaOptions): Promise<AgentRun>;
|
|
245
|
+
get(runId: string, options?: AgentBetaOptions): Promise<AgentRun>;
|
|
246
|
+
list(options?: WithBetaOptions<ListAgentRunsParams>): Promise<ListAgentRunsResponse>;
|
|
247
|
+
listAll(options?: WithBetaOptions<ListAgentRunsParams>): AsyncGenerator<AgentRun>;
|
|
248
|
+
getAll(options?: WithBetaOptions<ListAgentRunsParams>): Promise<AgentRun[]>;
|
|
249
|
+
cancel(runId: string, options?: AgentBetaOptions): Promise<AgentRun>;
|
|
250
|
+
delete(runId: string, options?: AgentBetaOptions): Promise<DeletedAgentRun>;
|
|
251
|
+
pollUntilFinished(runId: string, options?: WithBetaOptions<{
|
|
252
|
+
pollInterval?: number;
|
|
253
|
+
timeoutMs?: number;
|
|
254
|
+
}>): Promise<AgentRun & {
|
|
255
|
+
status: "completed" | "failed" | "cancelled";
|
|
256
|
+
}>;
|
|
257
|
+
}
|
|
258
|
+
/**
|
|
259
|
+
* @deprecated Use AgentClient instead.
|
|
260
|
+
*/
|
|
261
|
+
declare class AgentBetaClient extends AgentClient {
|
|
262
|
+
/**
|
|
263
|
+
* @deprecated Use exa.agent.runs instead.
|
|
264
|
+
*/
|
|
265
|
+
runs: AgentBetaRunsClient;
|
|
266
|
+
constructor(clientOrAgent: Exa | AgentClient);
|
|
267
|
+
}
|
|
212
268
|
declare class BetaClient {
|
|
213
269
|
/**
|
|
214
|
-
*
|
|
270
|
+
* @deprecated Use exa.agent instead.
|
|
215
271
|
*/
|
|
216
272
|
agent: AgentBetaClient;
|
|
217
|
-
constructor(
|
|
273
|
+
constructor(clientOrAgent: Exa | AgentClient);
|
|
218
274
|
}
|
|
219
275
|
|
|
220
276
|
/**
|
|
@@ -251,7 +307,11 @@ interface GroundingEntry {
|
|
|
251
307
|
}
|
|
252
308
|
interface SearchMonitorRunOutput {
|
|
253
309
|
results?: Record<string, unknown>[] | null;
|
|
254
|
-
|
|
310
|
+
/**
|
|
311
|
+
* Synthesized output. When the monitor is configured with an `outputSchema`,
|
|
312
|
+
* the API returns this as a structured object; otherwise it is a string.
|
|
313
|
+
*/
|
|
314
|
+
content?: string | Record<string, unknown> | null;
|
|
255
315
|
grounding?: GroundingEntry[] | null;
|
|
256
316
|
}
|
|
257
317
|
interface SearchMonitor {
|
|
@@ -4051,6 +4111,10 @@ declare class Exa {
|
|
|
4051
4111
|
* Search Monitors API client
|
|
4052
4112
|
*/
|
|
4053
4113
|
monitors: SearchMonitorsClient;
|
|
4114
|
+
/**
|
|
4115
|
+
* Agent API client
|
|
4116
|
+
*/
|
|
4117
|
+
agent: AgentClient;
|
|
4054
4118
|
/**
|
|
4055
4119
|
* Beta API clients
|
|
4056
4120
|
*/
|
|
@@ -4291,4 +4355,4 @@ declare class Exa {
|
|
|
4291
4355
|
private parseSSEStream;
|
|
4292
4356
|
}
|
|
4293
4357
|
|
|
4294
|
-
export { AGENT_BETA_HEADER, AgentBetaClient, type AgentBetaOptions, type AgentConfidence, type AgentCostDollars, type AgentCreateOptions, type AgentEffort, type AgentError, type AgentEvent, type AgentGroundingCitation, type AgentGroundingEntry, type AgentInput, type AgentOutput, type AgentRun, AgentRunEventsClient, type AgentRunStatus, type AgentRunTyped, AgentRunsClient, type AgentStopReason, type AgentUsage, type AnswerOptions, type AnswerOptionsTyped, type AnswerResponse, type AnswerResponseTyped, type AnswerStreamChunk, type AnswerStreamResponse, type ArticleEntity, type BaseSearchOptions, BetaClient, type CompanyEntity, type ContentsOptions, type ContentsResultComponent, type ContextOptions, type CostDollars, type CostDollarsContents, type CostDollarsSeearch, type CreateAgentRunParams, type CreateAgentRunParamsTyped, type CreateCriterionParameters, type CreateEnrichmentParameters, CreateEnrichmentParametersFormat, type CreateImportParameters, CreateImportParametersFormat, type CreateImportResponse, type CreateImportWithCsvParameters, type CreateMonitorParameters, type CreateSearchMonitorParams, type CreateSearchMonitorResponse, type CreateWebhookParameters, type CreateWebsetParameters, type CreateWebsetSearchParameters, type CsvDataInput, type CustomEntity, type DeepObjectOutputSchema, type DeepOutputSchema, type DeepSearchOutput, type DeepSearchOutputGrounding, type DeepSearchOutputGroundingCitation, type DeepSearchOutputGroundingConfidence, type DeepSearchType, type DeepTextOutputSchema, type Default, type DeletedAgentRun, type EnrichmentResult, type Entity, type EntityCompanyProperties, type EntityCompanyPropertiesFinancials, type EntityCompanyPropertiesFundingRound, type EntityCompanyPropertiesHeadquarters, type EntityCompanyPropertiesWebTraffic, type EntityCompanyPropertiesWorkforce, type EntityDateRange, type EntityPersonProperties, type EntityPersonPropertiesCompanyRef, type EntityPersonPropertiesWorkHistoryEntry, type Event, EventType, EventsClient, Exa, ExaError, type ExtrasOptions, type ExtrasResponse, type FindSimilarOptions, type GetWebsetResponse, type GroundingCitation, type GroundingEntry, type HighlightsContentsOptions, type HighlightsResponse, HttpStatusCode, type Import, ImportFailedReason, ImportFormat, ImportObject, ImportStatus, ImportsClient, type JSONSchema, type ListAgentRunEventsParams, type ListAgentRunEventsResponse, type ListAgentRunsParams, type ListAgentRunsResponse, type ListEventsResponse, type ListImportsResponse, type ListMonitorRunsResponse, type ListMonitorsOptions, type ListMonitorsResponse, type ListResearchRequest, type ListResearchResponse, type ListSearchMonitorRunsParams, type ListSearchMonitorRunsResponse, type ListSearchMonitorsParams, type ListSearchMonitorsResponse, type ListWebhookAttemptsResponse, type ListWebhooksResponse, type ListWebsetItemResponse, type ListWebsetItemsOptions, type ListWebsetsResponse, type LivecrawlOptions, type Monitor, type MonitorBehavior, type MonitorCadence, MonitorObject, type MonitorRun, MonitorRunObject, MonitorRunStatus, MonitorRunType, MonitorStatus, type PersonEntity, type PreviewWebsetParameters, type PreviewWebsetResponse, type RegularSearchOptions, type Research, type ResearchCreateParamsTyped, type ResearchCreateRequest, type ResearchCreateResponse, type ResearchDefinitionEvent, type ResearchEvent, type ResearchOperation, type ResearchOutputEvent, type ResearchPaperEntity, type ResearchPlanDefinitionEvent, type ResearchPlanOperationEvent, type ResearchPlanOutputEvent, type ResearchStatus, type ResearchStreamEvent, type ResearchStreamEventTyped, type ResearchTaskDefinitionEvent, type ResearchTaskOperationEvent, type ResearchTaskOutputEvent, type ResearchTyped, type SearchMonitor, type SearchMonitorRun, type SearchMonitorRunFailReason, type SearchMonitorRunOutput, type SearchMonitorRunStatus, SearchMonitorRunsClient, type SearchMonitorSearch, type SearchMonitorStatus, type SearchMonitorTrigger, type SearchMonitorWebhook, type SearchMonitorWebhookEvent, SearchMonitorsClient, type SearchResponse, type SearchResult, type SearchStreamChunk, type SectionTag, type Status, type SubpagesResponse, type SummaryContentsOptions, type SummaryContentsOptionsTyped, type SummaryResponse, type TextContentsOptions, type TextResponse, type TriggerSearchMonitorResponse, type UpdateEnrichmentParameters, type UpdateImport, type UpdateMonitor, UpdateMonitorStatus, type UpdateSearchMonitorParams, type UpdateWebhookParameters, type UpdateWebsetRequest, type VerbosityOptions, type WaitUntilCompletedOptions, type Webhook, type WebhookAttempt, WebhookStatus, type Webset, type WebsetEnrichment, WebsetEnrichmentFormat, WebsetEnrichmentStatus, WebsetEnrichmentsClient, WebsetExcludeSource, type WebsetHeadersLike, WebsetImportSource, type WebsetItem, type WebsetItemArticleProperties, type WebsetItemCompanyProperties, type WebsetItemCustomProperties, type WebsetItemEvaluation, WebsetItemEvaluationSatisfied, type WebsetItemPersonProperties, type WebsetItemResearchPaperProperties, WebsetItemSource, WebsetItemsClient, WebsetMonitorsClient, type WebsetSearch, WebsetSearchBehavior, WebsetSearchCanceledReason, WebsetSearchScopeSource, WebsetSearchStatus, WebsetSearchesClient, WebsetStatus, WebsetWebhooksClient, WebsetsClient, Exa as default };
|
|
4358
|
+
export { AGENT_BETA_HEADER, AgentBetaClient, type AgentBetaOptions, AgentClient, type AgentConfidence, type AgentCostDollars, type AgentCreateOptions, type AgentEffort, type AgentError, type AgentEvent, type AgentGroundingCitation, type AgentGroundingEntry, type AgentInput, type AgentOutput, type AgentRun, AgentRunEventsClient, type AgentRunStatus, type AgentRunTyped, AgentRunsClient, type AgentStopReason, type AgentUsage, type AnswerOptions, type AnswerOptionsTyped, type AnswerResponse, type AnswerResponseTyped, type AnswerStreamChunk, type AnswerStreamResponse, type ArticleEntity, type BaseSearchOptions, BetaClient, type CompanyEntity, type ContentsOptions, type ContentsResultComponent, type ContextOptions, type CostDollars, type CostDollarsContents, type CostDollarsSeearch, type CreateAgentRunParams, type CreateAgentRunParamsTyped, type CreateCriterionParameters, type CreateEnrichmentParameters, CreateEnrichmentParametersFormat, type CreateImportParameters, CreateImportParametersFormat, type CreateImportResponse, type CreateImportWithCsvParameters, type CreateMonitorParameters, type CreateSearchMonitorParams, type CreateSearchMonitorResponse, type CreateWebhookParameters, type CreateWebsetParameters, type CreateWebsetSearchParameters, type CsvDataInput, type CustomEntity, type DeepObjectOutputSchema, type DeepOutputSchema, type DeepSearchOutput, type DeepSearchOutputGrounding, type DeepSearchOutputGroundingCitation, type DeepSearchOutputGroundingConfidence, type DeepSearchType, type DeepTextOutputSchema, type Default, type DeletedAgentRun, type EnrichmentResult, type Entity, type EntityCompanyProperties, type EntityCompanyPropertiesFinancials, type EntityCompanyPropertiesFundingRound, type EntityCompanyPropertiesHeadquarters, type EntityCompanyPropertiesWebTraffic, type EntityCompanyPropertiesWorkforce, type EntityDateRange, type EntityPersonProperties, type EntityPersonPropertiesCompanyRef, type EntityPersonPropertiesWorkHistoryEntry, type Event, EventType, EventsClient, Exa, ExaError, type ExtrasOptions, type ExtrasResponse, type FindSimilarOptions, type GetWebsetResponse, type GroundingCitation, type GroundingEntry, type HighlightsContentsOptions, type HighlightsResponse, HttpStatusCode, type Import, ImportFailedReason, ImportFormat, ImportObject, ImportStatus, ImportsClient, type JSONSchema, type ListAgentRunEventsParams, type ListAgentRunEventsResponse, type ListAgentRunsParams, type ListAgentRunsResponse, type ListEventsResponse, type ListImportsResponse, type ListMonitorRunsResponse, type ListMonitorsOptions, type ListMonitorsResponse, type ListResearchRequest, type ListResearchResponse, type ListSearchMonitorRunsParams, type ListSearchMonitorRunsResponse, type ListSearchMonitorsParams, type ListSearchMonitorsResponse, type ListWebhookAttemptsResponse, type ListWebhooksResponse, type ListWebsetItemResponse, type ListWebsetItemsOptions, type ListWebsetsResponse, type LivecrawlOptions, type Monitor, type MonitorBehavior, type MonitorCadence, MonitorObject, type MonitorRun, MonitorRunObject, MonitorRunStatus, MonitorRunType, MonitorStatus, type PersonEntity, type PreviewWebsetParameters, type PreviewWebsetResponse, type RegularSearchOptions, type Research, type ResearchCreateParamsTyped, type ResearchCreateRequest, type ResearchCreateResponse, type ResearchDefinitionEvent, type ResearchEvent, type ResearchOperation, type ResearchOutputEvent, type ResearchPaperEntity, type ResearchPlanDefinitionEvent, type ResearchPlanOperationEvent, type ResearchPlanOutputEvent, type ResearchStatus, type ResearchStreamEvent, type ResearchStreamEventTyped, type ResearchTaskDefinitionEvent, type ResearchTaskOperationEvent, type ResearchTaskOutputEvent, type ResearchTyped, type SearchMonitor, type SearchMonitorRun, type SearchMonitorRunFailReason, type SearchMonitorRunOutput, type SearchMonitorRunStatus, SearchMonitorRunsClient, type SearchMonitorSearch, type SearchMonitorStatus, type SearchMonitorTrigger, type SearchMonitorWebhook, type SearchMonitorWebhookEvent, SearchMonitorsClient, type SearchResponse, type SearchResult, type SearchStreamChunk, type SectionTag, type Status, type SubpagesResponse, type SummaryContentsOptions, type SummaryContentsOptionsTyped, type SummaryResponse, type TextContentsOptions, type TextResponse, type TriggerSearchMonitorResponse, type UpdateEnrichmentParameters, type UpdateImport, type UpdateMonitor, UpdateMonitorStatus, type UpdateSearchMonitorParams, type UpdateWebhookParameters, type UpdateWebsetRequest, type VerbosityOptions, type WaitUntilCompletedOptions, type Webhook, type WebhookAttempt, WebhookStatus, type Webset, type WebsetEnrichment, WebsetEnrichmentFormat, WebsetEnrichmentStatus, WebsetEnrichmentsClient, WebsetExcludeSource, type WebsetHeadersLike, WebsetImportSource, type WebsetItem, type WebsetItemArticleProperties, type WebsetItemCompanyProperties, type WebsetItemCustomProperties, type WebsetItemEvaluation, WebsetItemEvaluationSatisfied, type WebsetItemPersonProperties, type WebsetItemResearchPaperProperties, WebsetItemSource, WebsetItemsClient, WebsetMonitorsClient, type WebsetSearch, WebsetSearchBehavior, WebsetSearchCanceledReason, WebsetSearchScopeSource, WebsetSearchStatus, WebsetSearchesClient, WebsetStatus, WebsetWebhooksClient, WebsetsClient, Exa as default };
|
package/dist/index.d.ts
CHANGED
|
@@ -4,9 +4,17 @@ import { ZodSchema } from 'zod';
|
|
|
4
4
|
* Types for the Exa Agent API.
|
|
5
5
|
*/
|
|
6
6
|
|
|
7
|
+
/**
|
|
8
|
+
* @deprecated Agent API beta header is no longer required for `exa.agent`.
|
|
9
|
+
* Retained for legacy `exa.beta.agent` compatibility.
|
|
10
|
+
*/
|
|
7
11
|
declare const AGENT_BETA_HEADER = "agent-2026-05-07";
|
|
8
12
|
interface AgentBetaOptions {
|
|
9
|
-
|
|
13
|
+
/**
|
|
14
|
+
* @deprecated Agent API beta header is no longer required for `exa.agent`.
|
|
15
|
+
* Values supplied to `exa.beta.agent` are sent as the `Exa-Beta` header.
|
|
16
|
+
*/
|
|
17
|
+
betas?: string[];
|
|
10
18
|
}
|
|
11
19
|
type AgentRunStatus = "queued" | "running" | "completed" | "failed" | "cancelled";
|
|
12
20
|
type AgentStopReason = "schema_satisfied" | "budget_reached" | "error" | "cancelled";
|
|
@@ -79,7 +87,7 @@ type AgentRunTyped<T> = Omit<AgentRun, "output"> & {
|
|
|
79
87
|
structured?: T;
|
|
80
88
|
}) | null;
|
|
81
89
|
};
|
|
82
|
-
interface ListAgentRunsParams
|
|
90
|
+
interface ListAgentRunsParams {
|
|
83
91
|
cursor?: string;
|
|
84
92
|
limit?: number;
|
|
85
93
|
}
|
|
@@ -101,7 +109,7 @@ interface AgentEvent {
|
|
|
101
109
|
createdAt?: string;
|
|
102
110
|
[key: string]: unknown;
|
|
103
111
|
}
|
|
104
|
-
interface ListAgentRunEventsParams
|
|
112
|
+
interface ListAgentRunEventsParams {
|
|
105
113
|
cursor?: string;
|
|
106
114
|
limit?: number;
|
|
107
115
|
}
|
|
@@ -112,7 +120,6 @@ interface ListAgentRunEventsResponse {
|
|
|
112
120
|
nextCursor: string | null;
|
|
113
121
|
}
|
|
114
122
|
interface CreateAgentRunParams {
|
|
115
|
-
betas: string[];
|
|
116
123
|
query: string;
|
|
117
124
|
systemPrompt?: string;
|
|
118
125
|
input?: AgentInput;
|
|
@@ -137,8 +144,8 @@ type RequestBody$2 = Record<string, unknown>;
|
|
|
137
144
|
declare class AgentBaseClient {
|
|
138
145
|
protected client: Exa;
|
|
139
146
|
constructor(client: Exa);
|
|
140
|
-
protected request<T = unknown>(endpoint: string,
|
|
141
|
-
protected rawRequest(endpoint: string,
|
|
147
|
+
protected request<T = unknown>(endpoint: string, method?: string, data?: RequestBody$2, params?: QueryParams$3, headers?: Record<string, string>): Promise<T>;
|
|
148
|
+
protected rawRequest(endpoint: string, method?: string, data?: RequestBody$2, params?: QueryParams$3, headers?: Record<string, string>): Promise<Response>;
|
|
142
149
|
protected buildPaginationParams(pagination?: ListAgentRunsParams | ListAgentRunEventsParams): QueryParams$3;
|
|
143
150
|
}
|
|
144
151
|
|
|
@@ -146,11 +153,12 @@ declare class AgentBaseClient {
|
|
|
146
153
|
* Client for the Exa Agent API.
|
|
147
154
|
*/
|
|
148
155
|
|
|
156
|
+
type WithBetaOptions<T> = T & AgentBetaOptions;
|
|
149
157
|
declare class AgentRunEventsClient extends AgentBaseClient {
|
|
150
158
|
/**
|
|
151
159
|
* List stored events for an Agent run.
|
|
152
160
|
*/
|
|
153
|
-
list(runId: string, options
|
|
161
|
+
list(runId: string, options?: ListAgentRunEventsParams): Promise<ListAgentRunEventsResponse>;
|
|
154
162
|
}
|
|
155
163
|
declare class AgentRunsClient extends AgentBaseClient {
|
|
156
164
|
/**
|
|
@@ -171,50 +179,98 @@ declare class AgentRunsClient extends AgentBaseClient {
|
|
|
171
179
|
/**
|
|
172
180
|
* Get an Agent run by ID.
|
|
173
181
|
*/
|
|
174
|
-
get(runId: string
|
|
182
|
+
get(runId: string): Promise<AgentRun>;
|
|
175
183
|
/**
|
|
176
184
|
* List Agent runs.
|
|
177
185
|
*/
|
|
178
|
-
list(options
|
|
186
|
+
list(options?: ListAgentRunsParams): Promise<ListAgentRunsResponse>;
|
|
179
187
|
/**
|
|
180
188
|
* Iterate through all Agent runs, handling pagination automatically.
|
|
181
189
|
*/
|
|
182
|
-
listAll(options
|
|
190
|
+
listAll(options?: ListAgentRunsParams): AsyncGenerator<AgentRun>;
|
|
183
191
|
/**
|
|
184
192
|
* Collect all Agent runs into an array.
|
|
185
193
|
*/
|
|
186
|
-
getAll(options
|
|
194
|
+
getAll(options?: ListAgentRunsParams): Promise<AgentRun[]>;
|
|
187
195
|
/**
|
|
188
196
|
* Cancel a queued or running Agent run.
|
|
189
197
|
*/
|
|
190
|
-
cancel(runId: string
|
|
198
|
+
cancel(runId: string): Promise<AgentRun>;
|
|
191
199
|
/**
|
|
192
200
|
* Delete a stored Agent run.
|
|
193
201
|
*/
|
|
194
|
-
delete(runId: string
|
|
202
|
+
delete(runId: string): Promise<DeletedAgentRun>;
|
|
195
203
|
/**
|
|
196
204
|
* Poll an Agent run until it reaches a terminal status.
|
|
197
205
|
*/
|
|
198
|
-
pollUntilFinished(runId: string, options
|
|
206
|
+
pollUntilFinished(runId: string, options?: {
|
|
199
207
|
pollInterval?: number;
|
|
200
208
|
timeoutMs?: number;
|
|
201
209
|
}): Promise<AgentRun & {
|
|
202
210
|
status: "completed" | "failed" | "cancelled";
|
|
203
211
|
}>;
|
|
204
212
|
}
|
|
205
|
-
declare class
|
|
213
|
+
declare class AgentClient {
|
|
214
|
+
/**
|
|
215
|
+
* @internal
|
|
216
|
+
*/
|
|
217
|
+
readonly client: Exa;
|
|
206
218
|
/**
|
|
207
219
|
* Client for Agent runs.
|
|
208
220
|
*/
|
|
209
221
|
runs: AgentRunsClient;
|
|
210
222
|
constructor(client: Exa);
|
|
211
223
|
}
|
|
224
|
+
declare class AgentBetaRunEventsClient extends AgentRunEventsClient {
|
|
225
|
+
/**
|
|
226
|
+
* List stored events for an Agent run.
|
|
227
|
+
*
|
|
228
|
+
* @deprecated Use exa.agent.runs.events instead.
|
|
229
|
+
*/
|
|
230
|
+
list(runId: string, options?: WithBetaOptions<ListAgentRunEventsParams>): Promise<ListAgentRunEventsResponse>;
|
|
231
|
+
}
|
|
232
|
+
declare class AgentBetaRunsClient extends AgentRunsClient {
|
|
233
|
+
/**
|
|
234
|
+
* @deprecated Use exa.agent.runs.events instead.
|
|
235
|
+
*/
|
|
236
|
+
events: AgentBetaRunEventsClient;
|
|
237
|
+
constructor(client: Exa);
|
|
238
|
+
create<T>(params: WithBetaOptions<AgentCreateOptions<T>> & {
|
|
239
|
+
stream: true;
|
|
240
|
+
}): Promise<AsyncGenerator<AgentEvent>>;
|
|
241
|
+
create<T>(params: WithBetaOptions<AgentCreateOptions<T>> & {
|
|
242
|
+
stream?: false;
|
|
243
|
+
}): Promise<AgentRunTyped<T>>;
|
|
244
|
+
create(params: CreateAgentRunParams & AgentBetaOptions): Promise<AgentRun>;
|
|
245
|
+
get(runId: string, options?: AgentBetaOptions): Promise<AgentRun>;
|
|
246
|
+
list(options?: WithBetaOptions<ListAgentRunsParams>): Promise<ListAgentRunsResponse>;
|
|
247
|
+
listAll(options?: WithBetaOptions<ListAgentRunsParams>): AsyncGenerator<AgentRun>;
|
|
248
|
+
getAll(options?: WithBetaOptions<ListAgentRunsParams>): Promise<AgentRun[]>;
|
|
249
|
+
cancel(runId: string, options?: AgentBetaOptions): Promise<AgentRun>;
|
|
250
|
+
delete(runId: string, options?: AgentBetaOptions): Promise<DeletedAgentRun>;
|
|
251
|
+
pollUntilFinished(runId: string, options?: WithBetaOptions<{
|
|
252
|
+
pollInterval?: number;
|
|
253
|
+
timeoutMs?: number;
|
|
254
|
+
}>): Promise<AgentRun & {
|
|
255
|
+
status: "completed" | "failed" | "cancelled";
|
|
256
|
+
}>;
|
|
257
|
+
}
|
|
258
|
+
/**
|
|
259
|
+
* @deprecated Use AgentClient instead.
|
|
260
|
+
*/
|
|
261
|
+
declare class AgentBetaClient extends AgentClient {
|
|
262
|
+
/**
|
|
263
|
+
* @deprecated Use exa.agent.runs instead.
|
|
264
|
+
*/
|
|
265
|
+
runs: AgentBetaRunsClient;
|
|
266
|
+
constructor(clientOrAgent: Exa | AgentClient);
|
|
267
|
+
}
|
|
212
268
|
declare class BetaClient {
|
|
213
269
|
/**
|
|
214
|
-
*
|
|
270
|
+
* @deprecated Use exa.agent instead.
|
|
215
271
|
*/
|
|
216
272
|
agent: AgentBetaClient;
|
|
217
|
-
constructor(
|
|
273
|
+
constructor(clientOrAgent: Exa | AgentClient);
|
|
218
274
|
}
|
|
219
275
|
|
|
220
276
|
/**
|
|
@@ -251,7 +307,11 @@ interface GroundingEntry {
|
|
|
251
307
|
}
|
|
252
308
|
interface SearchMonitorRunOutput {
|
|
253
309
|
results?: Record<string, unknown>[] | null;
|
|
254
|
-
|
|
310
|
+
/**
|
|
311
|
+
* Synthesized output. When the monitor is configured with an `outputSchema`,
|
|
312
|
+
* the API returns this as a structured object; otherwise it is a string.
|
|
313
|
+
*/
|
|
314
|
+
content?: string | Record<string, unknown> | null;
|
|
255
315
|
grounding?: GroundingEntry[] | null;
|
|
256
316
|
}
|
|
257
317
|
interface SearchMonitor {
|
|
@@ -4051,6 +4111,10 @@ declare class Exa {
|
|
|
4051
4111
|
* Search Monitors API client
|
|
4052
4112
|
*/
|
|
4053
4113
|
monitors: SearchMonitorsClient;
|
|
4114
|
+
/**
|
|
4115
|
+
* Agent API client
|
|
4116
|
+
*/
|
|
4117
|
+
agent: AgentClient;
|
|
4054
4118
|
/**
|
|
4055
4119
|
* Beta API clients
|
|
4056
4120
|
*/
|
|
@@ -4291,4 +4355,4 @@ declare class Exa {
|
|
|
4291
4355
|
private parseSSEStream;
|
|
4292
4356
|
}
|
|
4293
4357
|
|
|
4294
|
-
export { AGENT_BETA_HEADER, AgentBetaClient, type AgentBetaOptions, type AgentConfidence, type AgentCostDollars, type AgentCreateOptions, type AgentEffort, type AgentError, type AgentEvent, type AgentGroundingCitation, type AgentGroundingEntry, type AgentInput, type AgentOutput, type AgentRun, AgentRunEventsClient, type AgentRunStatus, type AgentRunTyped, AgentRunsClient, type AgentStopReason, type AgentUsage, type AnswerOptions, type AnswerOptionsTyped, type AnswerResponse, type AnswerResponseTyped, type AnswerStreamChunk, type AnswerStreamResponse, type ArticleEntity, type BaseSearchOptions, BetaClient, type CompanyEntity, type ContentsOptions, type ContentsResultComponent, type ContextOptions, type CostDollars, type CostDollarsContents, type CostDollarsSeearch, type CreateAgentRunParams, type CreateAgentRunParamsTyped, type CreateCriterionParameters, type CreateEnrichmentParameters, CreateEnrichmentParametersFormat, type CreateImportParameters, CreateImportParametersFormat, type CreateImportResponse, type CreateImportWithCsvParameters, type CreateMonitorParameters, type CreateSearchMonitorParams, type CreateSearchMonitorResponse, type CreateWebhookParameters, type CreateWebsetParameters, type CreateWebsetSearchParameters, type CsvDataInput, type CustomEntity, type DeepObjectOutputSchema, type DeepOutputSchema, type DeepSearchOutput, type DeepSearchOutputGrounding, type DeepSearchOutputGroundingCitation, type DeepSearchOutputGroundingConfidence, type DeepSearchType, type DeepTextOutputSchema, type Default, type DeletedAgentRun, type EnrichmentResult, type Entity, type EntityCompanyProperties, type EntityCompanyPropertiesFinancials, type EntityCompanyPropertiesFundingRound, type EntityCompanyPropertiesHeadquarters, type EntityCompanyPropertiesWebTraffic, type EntityCompanyPropertiesWorkforce, type EntityDateRange, type EntityPersonProperties, type EntityPersonPropertiesCompanyRef, type EntityPersonPropertiesWorkHistoryEntry, type Event, EventType, EventsClient, Exa, ExaError, type ExtrasOptions, type ExtrasResponse, type FindSimilarOptions, type GetWebsetResponse, type GroundingCitation, type GroundingEntry, type HighlightsContentsOptions, type HighlightsResponse, HttpStatusCode, type Import, ImportFailedReason, ImportFormat, ImportObject, ImportStatus, ImportsClient, type JSONSchema, type ListAgentRunEventsParams, type ListAgentRunEventsResponse, type ListAgentRunsParams, type ListAgentRunsResponse, type ListEventsResponse, type ListImportsResponse, type ListMonitorRunsResponse, type ListMonitorsOptions, type ListMonitorsResponse, type ListResearchRequest, type ListResearchResponse, type ListSearchMonitorRunsParams, type ListSearchMonitorRunsResponse, type ListSearchMonitorsParams, type ListSearchMonitorsResponse, type ListWebhookAttemptsResponse, type ListWebhooksResponse, type ListWebsetItemResponse, type ListWebsetItemsOptions, type ListWebsetsResponse, type LivecrawlOptions, type Monitor, type MonitorBehavior, type MonitorCadence, MonitorObject, type MonitorRun, MonitorRunObject, MonitorRunStatus, MonitorRunType, MonitorStatus, type PersonEntity, type PreviewWebsetParameters, type PreviewWebsetResponse, type RegularSearchOptions, type Research, type ResearchCreateParamsTyped, type ResearchCreateRequest, type ResearchCreateResponse, type ResearchDefinitionEvent, type ResearchEvent, type ResearchOperation, type ResearchOutputEvent, type ResearchPaperEntity, type ResearchPlanDefinitionEvent, type ResearchPlanOperationEvent, type ResearchPlanOutputEvent, type ResearchStatus, type ResearchStreamEvent, type ResearchStreamEventTyped, type ResearchTaskDefinitionEvent, type ResearchTaskOperationEvent, type ResearchTaskOutputEvent, type ResearchTyped, type SearchMonitor, type SearchMonitorRun, type SearchMonitorRunFailReason, type SearchMonitorRunOutput, type SearchMonitorRunStatus, SearchMonitorRunsClient, type SearchMonitorSearch, type SearchMonitorStatus, type SearchMonitorTrigger, type SearchMonitorWebhook, type SearchMonitorWebhookEvent, SearchMonitorsClient, type SearchResponse, type SearchResult, type SearchStreamChunk, type SectionTag, type Status, type SubpagesResponse, type SummaryContentsOptions, type SummaryContentsOptionsTyped, type SummaryResponse, type TextContentsOptions, type TextResponse, type TriggerSearchMonitorResponse, type UpdateEnrichmentParameters, type UpdateImport, type UpdateMonitor, UpdateMonitorStatus, type UpdateSearchMonitorParams, type UpdateWebhookParameters, type UpdateWebsetRequest, type VerbosityOptions, type WaitUntilCompletedOptions, type Webhook, type WebhookAttempt, WebhookStatus, type Webset, type WebsetEnrichment, WebsetEnrichmentFormat, WebsetEnrichmentStatus, WebsetEnrichmentsClient, WebsetExcludeSource, type WebsetHeadersLike, WebsetImportSource, type WebsetItem, type WebsetItemArticleProperties, type WebsetItemCompanyProperties, type WebsetItemCustomProperties, type WebsetItemEvaluation, WebsetItemEvaluationSatisfied, type WebsetItemPersonProperties, type WebsetItemResearchPaperProperties, WebsetItemSource, WebsetItemsClient, WebsetMonitorsClient, type WebsetSearch, WebsetSearchBehavior, WebsetSearchCanceledReason, WebsetSearchScopeSource, WebsetSearchStatus, WebsetSearchesClient, WebsetStatus, WebsetWebhooksClient, WebsetsClient, Exa as default };
|
|
4358
|
+
export { AGENT_BETA_HEADER, AgentBetaClient, type AgentBetaOptions, AgentClient, type AgentConfidence, type AgentCostDollars, type AgentCreateOptions, type AgentEffort, type AgentError, type AgentEvent, type AgentGroundingCitation, type AgentGroundingEntry, type AgentInput, type AgentOutput, type AgentRun, AgentRunEventsClient, type AgentRunStatus, type AgentRunTyped, AgentRunsClient, type AgentStopReason, type AgentUsage, type AnswerOptions, type AnswerOptionsTyped, type AnswerResponse, type AnswerResponseTyped, type AnswerStreamChunk, type AnswerStreamResponse, type ArticleEntity, type BaseSearchOptions, BetaClient, type CompanyEntity, type ContentsOptions, type ContentsResultComponent, type ContextOptions, type CostDollars, type CostDollarsContents, type CostDollarsSeearch, type CreateAgentRunParams, type CreateAgentRunParamsTyped, type CreateCriterionParameters, type CreateEnrichmentParameters, CreateEnrichmentParametersFormat, type CreateImportParameters, CreateImportParametersFormat, type CreateImportResponse, type CreateImportWithCsvParameters, type CreateMonitorParameters, type CreateSearchMonitorParams, type CreateSearchMonitorResponse, type CreateWebhookParameters, type CreateWebsetParameters, type CreateWebsetSearchParameters, type CsvDataInput, type CustomEntity, type DeepObjectOutputSchema, type DeepOutputSchema, type DeepSearchOutput, type DeepSearchOutputGrounding, type DeepSearchOutputGroundingCitation, type DeepSearchOutputGroundingConfidence, type DeepSearchType, type DeepTextOutputSchema, type Default, type DeletedAgentRun, type EnrichmentResult, type Entity, type EntityCompanyProperties, type EntityCompanyPropertiesFinancials, type EntityCompanyPropertiesFundingRound, type EntityCompanyPropertiesHeadquarters, type EntityCompanyPropertiesWebTraffic, type EntityCompanyPropertiesWorkforce, type EntityDateRange, type EntityPersonProperties, type EntityPersonPropertiesCompanyRef, type EntityPersonPropertiesWorkHistoryEntry, type Event, EventType, EventsClient, Exa, ExaError, type ExtrasOptions, type ExtrasResponse, type FindSimilarOptions, type GetWebsetResponse, type GroundingCitation, type GroundingEntry, type HighlightsContentsOptions, type HighlightsResponse, HttpStatusCode, type Import, ImportFailedReason, ImportFormat, ImportObject, ImportStatus, ImportsClient, type JSONSchema, type ListAgentRunEventsParams, type ListAgentRunEventsResponse, type ListAgentRunsParams, type ListAgentRunsResponse, type ListEventsResponse, type ListImportsResponse, type ListMonitorRunsResponse, type ListMonitorsOptions, type ListMonitorsResponse, type ListResearchRequest, type ListResearchResponse, type ListSearchMonitorRunsParams, type ListSearchMonitorRunsResponse, type ListSearchMonitorsParams, type ListSearchMonitorsResponse, type ListWebhookAttemptsResponse, type ListWebhooksResponse, type ListWebsetItemResponse, type ListWebsetItemsOptions, type ListWebsetsResponse, type LivecrawlOptions, type Monitor, type MonitorBehavior, type MonitorCadence, MonitorObject, type MonitorRun, MonitorRunObject, MonitorRunStatus, MonitorRunType, MonitorStatus, type PersonEntity, type PreviewWebsetParameters, type PreviewWebsetResponse, type RegularSearchOptions, type Research, type ResearchCreateParamsTyped, type ResearchCreateRequest, type ResearchCreateResponse, type ResearchDefinitionEvent, type ResearchEvent, type ResearchOperation, type ResearchOutputEvent, type ResearchPaperEntity, type ResearchPlanDefinitionEvent, type ResearchPlanOperationEvent, type ResearchPlanOutputEvent, type ResearchStatus, type ResearchStreamEvent, type ResearchStreamEventTyped, type ResearchTaskDefinitionEvent, type ResearchTaskOperationEvent, type ResearchTaskOutputEvent, type ResearchTyped, type SearchMonitor, type SearchMonitorRun, type SearchMonitorRunFailReason, type SearchMonitorRunOutput, type SearchMonitorRunStatus, SearchMonitorRunsClient, type SearchMonitorSearch, type SearchMonitorStatus, type SearchMonitorTrigger, type SearchMonitorWebhook, type SearchMonitorWebhookEvent, SearchMonitorsClient, type SearchResponse, type SearchResult, type SearchStreamChunk, type SectionTag, type Status, type SubpagesResponse, type SummaryContentsOptions, type SummaryContentsOptionsTyped, type SummaryResponse, type TextContentsOptions, type TextResponse, type TriggerSearchMonitorResponse, type UpdateEnrichmentParameters, type UpdateImport, type UpdateMonitor, UpdateMonitorStatus, type UpdateSearchMonitorParams, type UpdateWebhookParameters, type UpdateWebsetRequest, type VerbosityOptions, type WaitUntilCompletedOptions, type Webhook, type WebhookAttempt, WebhookStatus, type Webset, type WebsetEnrichment, WebsetEnrichmentFormat, WebsetEnrichmentStatus, WebsetEnrichmentsClient, WebsetExcludeSource, type WebsetHeadersLike, WebsetImportSource, type WebsetItem, type WebsetItemArticleProperties, type WebsetItemCompanyProperties, type WebsetItemCustomProperties, type WebsetItemEvaluation, WebsetItemEvaluationSatisfied, type WebsetItemPersonProperties, type WebsetItemResearchPaperProperties, WebsetItemSource, WebsetItemsClient, WebsetMonitorsClient, type WebsetSearch, WebsetSearchBehavior, WebsetSearchCanceledReason, WebsetSearchScopeSource, WebsetSearchStatus, WebsetSearchesClient, WebsetStatus, WebsetWebhooksClient, WebsetsClient, Exa as default };
|