@alasano/pi-exa 0.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +109 -0
- package/assets/screenshot.png +0 -0
- package/assets/web_search_exa.png +0 -0
- package/extensions/agent-tracker.ts +258 -0
- package/extensions/agent-widget.ts +136 -0
- package/extensions/agent.ts +289 -0
- package/extensions/auth.ts +66 -0
- package/extensions/client.ts +146 -0
- package/extensions/format.ts +436 -0
- package/extensions/index.ts +69 -0
- package/extensions/output.ts +52 -0
- package/extensions/render.ts +394 -0
- package/extensions/schemas.ts +239 -0
- package/extensions/settings.ts +263 -0
- package/extensions/tools/helpers.ts +26 -0
- package/extensions/tools/index.ts +28 -0
- package/extensions/tools/web-agent-runs.ts +377 -0
- package/extensions/tools/web-agent.ts +328 -0
- package/extensions/tools/web-answer.ts +92 -0
- package/extensions/tools/web-fetch.ts +94 -0
- package/extensions/tools/web-search-advanced.ts +164 -0
- package/extensions/tools/web-search.ts +112 -0
- package/extensions/types.ts +238 -0
- package/extensions/util.ts +26 -0
- package/package.json +46 -0
- package/skills/exa-search/SKILL.md +81 -0
- package/skills/exa-search/references/web-agent-exa.md +277 -0
|
@@ -0,0 +1,277 @@
|
|
|
1
|
+
# Exa Agent Tool Reference
|
|
2
|
+
|
|
3
|
+
Use Exa Agent for async, higher-compute web workflows that need more than a search result set or one fetched page. Agent is best for multi-hop research, structured list building, row enrichment, entity research across many fields, and tasks where the output should be validated against a JSON Schema.
|
|
4
|
+
|
|
5
|
+
Prefer `web_search_exa`, `web_search_advanced_exa`, `web_fetch_exa`, or `web_answer_exa` for simpler lookups. If Agent is a plausible but more expensive option, recommend it to the user before using it unless the user already asked for deep research, enrichment, or list building.
|
|
6
|
+
|
|
7
|
+
## Tools
|
|
8
|
+
|
|
9
|
+
- `web_agent_exa`: create a run. Use `mode: "wait"` for foreground work and `mode: "background"` for long-running work.
|
|
10
|
+
- `web_agent_get_exa`: retrieve a known run by ID, including output, sources, usage, and cost.
|
|
11
|
+
- `web_agent_list_exa`: list recent runs when you need to find a run ID or inspect statuses.
|
|
12
|
+
- `web_agent_cancel_exa`: cancel a queued or running run.
|
|
13
|
+
- `web_agent_delete_exa`: delete a stored run only when explicitly requested.
|
|
14
|
+
- `web_agent_events_exa`: list stored lifecycle events for a run, or replay stored events with `replay: true` and optional `lastEventId`.
|
|
15
|
+
|
|
16
|
+
## When Agent Is Best
|
|
17
|
+
|
|
18
|
+
Use Agent when the task has one or more of these properties:
|
|
19
|
+
|
|
20
|
+
- It requires multi-hop discovery: find entities first, then enrich each one.
|
|
21
|
+
- It needs many structured fields with citations or evidence.
|
|
22
|
+
- It processes `input.data` rows supplied by the user or another system.
|
|
23
|
+
- It needs exclusions or continuation from `previousRunId`.
|
|
24
|
+
- It is expected to take longer than normal search but return a high-value structured result.
|
|
25
|
+
|
|
26
|
+
Do not use Agent just because a question mentions the web. Normal search plus selected fetches is usually better for quick factual lookup, source discovery, official docs, current news checks, or one-page extraction.
|
|
27
|
+
|
|
28
|
+
## Modes
|
|
29
|
+
|
|
30
|
+
Foreground:
|
|
31
|
+
|
|
32
|
+
```json
|
|
33
|
+
{
|
|
34
|
+
"query": "Research Acme Corp as a potential vendor. Verify identity, summarize business lines, list recent public signals, and cite sources.",
|
|
35
|
+
"effort": "medium",
|
|
36
|
+
"mode": "wait",
|
|
37
|
+
"monitor": "stream"
|
|
38
|
+
}
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
Use foreground when the user needs the result in the current answer. `monitor: "stream"` is the default and surfaces lifecycle events while the run works. `monitor: "poll"` is available if streaming is not desirable. `monitor` applies only to `mode: "wait"`. A completed foreground run returns the full Agent result payload to the agent, including `output.text`, `output.structured`, `output.grounding`, usage, cost, and run metadata.
|
|
42
|
+
|
|
43
|
+
Background:
|
|
44
|
+
|
|
45
|
+
```json
|
|
46
|
+
{
|
|
47
|
+
"query": "Find up to 25 current sales leaders at companies matching these criteria and return cited profile evidence.",
|
|
48
|
+
"effort": "auto",
|
|
49
|
+
"mode": "background",
|
|
50
|
+
"outputSchema": {
|
|
51
|
+
"type": "object",
|
|
52
|
+
"required": ["people"],
|
|
53
|
+
"properties": {
|
|
54
|
+
"people": {
|
|
55
|
+
"type": "array",
|
|
56
|
+
"maxItems": 25,
|
|
57
|
+
"items": {
|
|
58
|
+
"type": "object",
|
|
59
|
+
"required": ["name", "company", "title", "profile_url", "evidence_urls"],
|
|
60
|
+
"properties": {
|
|
61
|
+
"name": { "type": "string" },
|
|
62
|
+
"company": { "type": "string" },
|
|
63
|
+
"title": { "type": "string" },
|
|
64
|
+
"profile_url": { "type": "string", "format": "uri" },
|
|
65
|
+
"evidence_urls": {
|
|
66
|
+
"type": "array",
|
|
67
|
+
"maxItems": 3,
|
|
68
|
+
"items": { "type": "string", "format": "uri" }
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
Use background for long-running, expensive, or broad workflows. Save the returned run ID. Background mode ignores `monitor`; it always returns promptly, then the extension tracks the run during the session with lightweight status polling, shows an active-run UI indicator, and sends a compact follow-up when it reaches a terminal status. That follow-up is only a completion notice and summary. Before answering with detailed findings from a background run, call `web_agent_get_exa` for the full stored result. Do not repeatedly call `web_agent_get_exa` or `web_agent_events_exa` after starting a background run unless the user explicitly asks for progress/history or the completion notice has arrived.
|
|
79
|
+
|
|
80
|
+
## System Prompt
|
|
81
|
+
|
|
82
|
+
Use `systemPrompt` for behavior rules that should be separate from the task itself:
|
|
83
|
+
|
|
84
|
+
- source preferences, such as primary sources, official docs, SEC filings, or IR pages
|
|
85
|
+
- disambiguation rules, such as exact company domain or avoiding similarly named entities
|
|
86
|
+
- novelty or deduplication constraints
|
|
87
|
+
- evidence standards, such as public proof of current employment
|
|
88
|
+
- output tone or omission rules
|
|
89
|
+
|
|
90
|
+
## Effort
|
|
91
|
+
|
|
92
|
+
- `minimal`: very narrow factual tasks with one or two shallow fields.
|
|
93
|
+
- `low`: simple lookups where cost and latency matter.
|
|
94
|
+
- `medium`: default for standard single-entity research.
|
|
95
|
+
- `high`: harder research, larger schemas, stricter verification.
|
|
96
|
+
- `xhigh`: high-value, complex, completeness-sensitive tasks.
|
|
97
|
+
- `auto`: variable-scope list building or workflows where entity count and work are not known ahead of time.
|
|
98
|
+
|
|
99
|
+
Use fixed effort when predictable request/compute cost matters. Search calls and contact enrichment can still add cost. Use `auto` when scope can vary significantly.
|
|
100
|
+
|
|
101
|
+
Agent runs can time out after one hour. Agent concurrency is limited by account QPS; on default pay-as-you-go limits, expect about two active Agent runs at a time.
|
|
102
|
+
|
|
103
|
+
## Structured Output
|
|
104
|
+
|
|
105
|
+
Use `outputSchema` when the answer needs to be machine-readable or when a bounded result set is important. Agent supports JSON Schema draft-07, 2019-09, and 2020-12 via `$schema`. Standard string formats are supported, plus `phone`. Always bound arrays with `maxItems` when possible.
|
|
106
|
+
|
|
107
|
+
Example single-entity profile:
|
|
108
|
+
|
|
109
|
+
```json
|
|
110
|
+
{
|
|
111
|
+
"query": "Research Example Inc. Verify the company identity and return concise public intelligence with citations.",
|
|
112
|
+
"effort": "medium",
|
|
113
|
+
"outputSchema": {
|
|
114
|
+
"type": "object",
|
|
115
|
+
"required": ["company"],
|
|
116
|
+
"properties": {
|
|
117
|
+
"company": {
|
|
118
|
+
"type": "object",
|
|
119
|
+
"required": ["name", "domain", "identity_verified", "summary", "source_urls"],
|
|
120
|
+
"properties": {
|
|
121
|
+
"name": { "type": "string" },
|
|
122
|
+
"domain": { "type": "string" },
|
|
123
|
+
"identity_verified": { "type": "boolean" },
|
|
124
|
+
"summary": { "type": "string" },
|
|
125
|
+
"recent_signals": {
|
|
126
|
+
"type": "array",
|
|
127
|
+
"maxItems": 5,
|
|
128
|
+
"items": { "type": "string" }
|
|
129
|
+
},
|
|
130
|
+
"source_urls": {
|
|
131
|
+
"type": "array",
|
|
132
|
+
"maxItems": 8,
|
|
133
|
+
"items": { "type": "string", "format": "uri" }
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
```
|
|
141
|
+
|
|
142
|
+
Example row enrichment:
|
|
143
|
+
|
|
144
|
+
```json
|
|
145
|
+
{
|
|
146
|
+
"query": "For each input company, produce a concise research brief with current public evidence. Return one report per input row.",
|
|
147
|
+
"effort": "medium",
|
|
148
|
+
"input": {
|
|
149
|
+
"data": [
|
|
150
|
+
{ "company": "Ramp", "domain": "ramp.com" },
|
|
151
|
+
{ "company": "Mercury", "domain": "mercury.com" }
|
|
152
|
+
]
|
|
153
|
+
},
|
|
154
|
+
"outputSchema": {
|
|
155
|
+
"type": "object",
|
|
156
|
+
"required": ["reports"],
|
|
157
|
+
"properties": {
|
|
158
|
+
"reports": {
|
|
159
|
+
"type": "array",
|
|
160
|
+
"maxItems": 2,
|
|
161
|
+
"items": {
|
|
162
|
+
"type": "object",
|
|
163
|
+
"required": ["company", "domain", "overview", "source_urls"],
|
|
164
|
+
"properties": {
|
|
165
|
+
"company": { "type": "string" },
|
|
166
|
+
"domain": { "type": "string" },
|
|
167
|
+
"overview": { "type": "string" },
|
|
168
|
+
"source_urls": {
|
|
169
|
+
"type": "array",
|
|
170
|
+
"maxItems": 5,
|
|
171
|
+
"items": { "type": "string", "format": "uri" }
|
|
172
|
+
}
|
|
173
|
+
}
|
|
174
|
+
}
|
|
175
|
+
}
|
|
176
|
+
}
|
|
177
|
+
}
|
|
178
|
+
}
|
|
179
|
+
```
|
|
180
|
+
|
|
181
|
+
## Contact Fields
|
|
182
|
+
|
|
183
|
+
Contact-oriented schemas can trigger separate email or phone enrichment costs. Only request contact fields when the user asked for them or the workflow clearly requires them. Bound result arrays with `maxItems`.
|
|
184
|
+
|
|
185
|
+
```json
|
|
186
|
+
{
|
|
187
|
+
"query": "Find current developer relations leaders at companies matching these criteria. Include only people with public evidence of current role.",
|
|
188
|
+
"effort": "auto",
|
|
189
|
+
"outputSchema": {
|
|
190
|
+
"type": "object",
|
|
191
|
+
"required": ["people"],
|
|
192
|
+
"properties": {
|
|
193
|
+
"people": {
|
|
194
|
+
"type": "array",
|
|
195
|
+
"maxItems": 10,
|
|
196
|
+
"items": {
|
|
197
|
+
"type": "object",
|
|
198
|
+
"required": ["name", "title", "company", "profile_url", "evidence_urls"],
|
|
199
|
+
"properties": {
|
|
200
|
+
"name": { "type": "string" },
|
|
201
|
+
"title": { "type": "string" },
|
|
202
|
+
"company": { "type": "string" },
|
|
203
|
+
"contact_email": { "type": "string", "format": "email" },
|
|
204
|
+
"profile_url": { "type": "string", "format": "uri" },
|
|
205
|
+
"evidence_urls": {
|
|
206
|
+
"type": "array",
|
|
207
|
+
"maxItems": 3,
|
|
208
|
+
"items": { "type": "string", "format": "uri" }
|
|
209
|
+
}
|
|
210
|
+
}
|
|
211
|
+
}
|
|
212
|
+
}
|
|
213
|
+
}
|
|
214
|
+
}
|
|
215
|
+
}
|
|
216
|
+
```
|
|
217
|
+
|
|
218
|
+
## Continuation And Exclusions
|
|
219
|
+
|
|
220
|
+
Use `previousRunId` when a follow-up should continue from an earlier completed run. The previous run must be completed and belong to the same team. Exa documents follow-up runs as sharing the same run ID as the supplied `previousRunId`, so do not assume a continuation creates a brand-new ID.
|
|
221
|
+
|
|
222
|
+
Use `input.exclusion` to avoid returning records already known to the user or entities known to be wrong matches.
|
|
223
|
+
|
|
224
|
+
```json
|
|
225
|
+
{
|
|
226
|
+
"query": "Find 10 additional companies that match the previous criteria, excluding companies already returned.",
|
|
227
|
+
"previousRunId": "agent_run_01j...",
|
|
228
|
+
"input": {
|
|
229
|
+
"exclusion": [{ "company": "Existing Result", "domain": "existing.example" }]
|
|
230
|
+
}
|
|
231
|
+
}
|
|
232
|
+
```
|
|
233
|
+
|
|
234
|
+
## Events
|
|
235
|
+
|
|
236
|
+
Use `web_agent_events_exa` for lifecycle inspection, debugging, or replaying event history. Events are not the final research output; use `web_agent_get_exa` for the completed run output.
|
|
237
|
+
|
|
238
|
+
JSON event listing:
|
|
239
|
+
|
|
240
|
+
```json
|
|
241
|
+
{
|
|
242
|
+
"runId": "agent_run_01j...",
|
|
243
|
+
"limit": 20
|
|
244
|
+
}
|
|
245
|
+
```
|
|
246
|
+
|
|
247
|
+
Stored SSE replay:
|
|
248
|
+
|
|
249
|
+
```json
|
|
250
|
+
{
|
|
251
|
+
"runId": "agent_run_01j...",
|
|
252
|
+
"replay": true,
|
|
253
|
+
"lastEventId": "1"
|
|
254
|
+
}
|
|
255
|
+
```
|
|
256
|
+
|
|
257
|
+
Use replay when a stream was interrupted or when you need to reconstruct the lifecycle timeline after a known event ID. Do not replay events repeatedly for a background run that pi-exa is already tracking.
|
|
258
|
+
|
|
259
|
+
## Output Discipline
|
|
260
|
+
|
|
261
|
+
When returning Agent results to the user:
|
|
262
|
+
|
|
263
|
+
- Summarize the result first.
|
|
264
|
+
- Include run ID, status, and cost when relevant.
|
|
265
|
+
- Cite or preserve source URLs for claims that depend on web evidence.
|
|
266
|
+
- Do not paste every field from large structured output unless the user asked for the raw payload.
|
|
267
|
+
- Use `web_agent_get_exa` for full stored output when a background follow-up was compact.
|
|
268
|
+
|
|
269
|
+
## Production Checklist
|
|
270
|
+
|
|
271
|
+
- Give Agent a specific `query` that names the unit of work and desired source quality.
|
|
272
|
+
- Use `input.data` for known records instead of embedding rows in the prompt.
|
|
273
|
+
- Use `input.exclusion` for records that should not be returned again.
|
|
274
|
+
- Add `outputSchema` whenever downstream code consumes the result.
|
|
275
|
+
- Use `maxItems` on arrays when you need predictable scope and cost.
|
|
276
|
+
- Store the returned run ID so you can inspect costs, replay events, or continue from the run later.
|
|
277
|
+
- Add explicit disambiguation for people, companies, job boards, and similarly named entities.
|