Skip to content

armgit / eve

Public Imported from GitHub
0

The Open Framework for Building Agents

feat(eve): web search - exa provider (#864)

Andrew Barba512808c45544
diff --git a/.changeset/exa-web-search-gateway.md b/.changeset/exa-web-search-gateway.md
new file mode 100644
index 000000000..7896048d5
--- /dev/null
+++ b/.changeset/exa-web-search-gateway.md
@@ -0,0 +1,5 @@
+---
+"eve": patch
+---
+
+Allow agents to select Exa or Parallel for the built-in `web_search` tool by exporting `webSearch({ provider })` from `agent/tools/web_search.ts`. Parallel remains the default for AI Gateway models.
diff --git a/docs/concepts/default-harness.md b/docs/concepts/default-harness.md
index 46b656c40..90744b704 100644
--- a/docs/concepts/default-harness.md
+++ b/docs/concepts/default-harness.md
@@ -52,7 +52,7 @@ Notes:
- **`agent`** is available only in the root session. Its child uses the root's instructions, tools, connections, and sandbox, but starts with fresh conversation history and fresh [state](../guides/state). The child receives neither `agent` nor `Workflow`; declared subagents do not receive the built-in `agent` either. See [Subagents](../subagents).
- **`load_skill`** only pulls instructions into context. It adds no new execution surface, because behavior still comes from the tools the agent already has.
- **`connection_search`** surfaces a connection's tools by their qualified name (e.g. `linear__list_issues`), which the model can then call directly. It's registered only when the agent has connections.
-- **`web_search`** has no local executor; the provider runs it. To supply your own implementation, override it with `defineTool()`.
+- **`web_search`** has no local executor; the provider runs it. AI Gateway models use Parallel by default. To use Exa instead, export `webSearch({ provider: "exa" })` from `agent/tools/web_search.ts`. Direct provider models continue to use their native search implementation. To supply your own implementation, override it with `defineTool()`.
Review these built-in tools before production use. Disable, wrap, restrict, or require approval for any tool that can access the filesystem, network, shell, or sensitive data.
@@ -73,7 +73,17 @@ export default defineTool({
});
```
-The framework defaults are importable from `eve/tools/defaults` (`bash`, `readFile`, `writeFile`, `glob`, `grep`, `webFetch`, `webSearch`, `todo`, `loadSkill`), so you can spread, wrap, or patch them. Skip the spread and your replacement owns its own context. A fresh `defineTool` for `todo` won't inherit the framework's durable state key.
+The framework defaults are importable from `eve/tools/defaults` (`bash`, `readFile`, `writeFile`, `glob`, `grep`, `webFetch`, `todo`, `loadSkill`), so you can spread, wrap, or patch them. Skip the spread and your replacement owns its own context. A fresh `defineTool` for `todo` won't inherit the framework's durable state key.
+
+Provider-managed web search has a dedicated configuration helper instead of an executable default:
+
+```ts title="agent/tools/web_search.ts"
+import { webSearch } from "eve/tools";
+
+export default webSearch({ provider: "exa" });
+```
+
+Set `provider` to `"parallel"` or `"exa"`. Without this file, AI Gateway models use Parallel.
## Disable a default
diff --git a/docs/reference/typescript-api.md b/docs/reference/typescript-api.md
index 0b2508558..d136a0dde 100644
--- a/docs/reference/typescript-api.md
+++ b/docs/reference/typescript-api.md
@@ -52,7 +52,7 @@ export default defineTool({
| `mockModel` | `eve/evals` | Deterministic fixture agent models | [Evals](../evals/overview) |
| `useEveAgent` | `eve/react`, `eve/vue`, `eve/svelte` | frontend | [Frontend](../guides/frontend/overview) |
-A few non-`define*` helpers round out the set: `disableTool` and `experimental_workflow` from `eve/tools` (see [Default harness](../concepts/default-harness)), `sleep` from `eve/tools/sleep`, the route verbs `GET`/`POST`/`PUT`/`PATCH`/`DELETE`/`WS` from `eve/channels`, the approval policies `always`/`once`/`never` from `eve/tools/approval`, and the channel auth helpers `localDev`/`vercelOidc`/`placeholderAuth` from `eve/channels/auth`. To wrap a built-in tool, import its default value from `eve/tools/defaults` (`bash`, `readFile`, `writeFile`, `glob`, `grep`, `webFetch`, `webSearch`, `todo`, `loadSkill`). `AgentReasoningDefinition` is exported from `eve` for the top-level `defineAgent({ reasoning })` setting. `AgentLimitsDefinition` is exported for `defineAgent({ limits })`. `AgentWorkflowDefinition` and `AgentWorkflowWorldDefinition` are exported from `eve` for the `defineAgent({ experimental: { workflow } })` config shape. `ExperimentalWorkflowToolInput` is exported from `eve/tools` for the `experimental_workflow(...)` config shape.
+A few non-`define*` helpers round out the set: `disableTool`, `experimental_workflow`, and `webSearch` from `eve/tools` (see [Default harness](../concepts/default-harness)), `sleep` from `eve/tools/sleep`, the route verbs `GET`/`POST`/`PUT`/`PATCH`/`DELETE`/`WS` from `eve/channels`, the approval policies `always`/`once`/`never` from `eve/tools/approval`, and the channel auth helpers `localDev`/`vercelOidc`/`placeholderAuth` from `eve/channels/auth`. To wrap a built-in tool, import its default value from `eve/tools/defaults` (`bash`, `readFile`, `writeFile`, `glob`, `grep`, `webFetch`, `todo`, `loadSkill`). `AgentReasoningDefinition` is exported from `eve` for the top-level `defineAgent({ reasoning })` setting. `AgentLimitsDefinition` is exported for `defineAgent({ limits })`. `AgentWorkflowDefinition` and `AgentWorkflowWorldDefinition` are exported from `eve` for the `defineAgent({ experimental: { workflow } })` config shape. `ExperimentalWorkflowToolInput`, `WebSearchToolInput`, and `WebSearchProvider` are exported from `eve/tools` for their corresponding tool configuration helpers.
## Runtime context (`ctx`)
diff --git a/e2e/fixtures/agent-tools/agent/tools/web_search.ts b/e2e/fixtures/agent-tools/agent/tools/web_search.ts
new file mode 100644
index 000000000..718bb98ea
--- /dev/null
+++ b/e2e/fixtures/agent-tools/agent/tools/web_search.ts
@@ -0,0 +1,3 @@
+import { webSearch } from "eve/tools";
+
+export default webSearch({ provider: "exa" });
diff --git a/e2e/fixtures/agent-tools/evals/static-tools/web-search-exa.eval.ts b/e2e/fixtures/agent-tools/evals/static-tools/web-search-exa.eval.ts
new file mode 100644
index 000000000..02c640076
--- /dev/null
+++ b/e2e/fixtures/agent-tools/evals/static-tools/web-search-exa.eval.ts
@@ -0,0 +1,55 @@
+import type { HandleMessageStreamEvent } from "eve/client";
+import { defineEval } from "eve/evals";
+
+const TOOL_NAME = "web_search";
+const SEARCH_COUNT = 8;
+const QUERIES = [
+ "web search fanout probe 01",
+ "web search fanout probe 02",
+ "web search fanout probe 03",
+ "web search fanout probe 04",
+ "web search fanout probe 05",
+ "web search fanout probe 06",
+ "web search fanout probe 07",
+ "web search fanout probe 08",
+] as const;
+
+function completedDistinctCalls(events: readonly HandleMessageStreamEvent[]): number {
+ const callIds = new Set<string>();
+ for (const event of events) {
+ if (
+ event.type === "action.result" &&
+ event.data.status === "completed" &&
+ event.data.result.kind === "tool-result" &&
+ event.data.result.toolName === TOOL_NAME
+ ) {
+ callIds.add(event.data.result.callId);
+ }
+ }
+ return callIds.size;
+}
+
+export default defineEval({
+ tags: ["real-model"],
+ description: "Provider tools smoke: eight parallel Exa web searches complete in one turn.",
+ async test(t) {
+ const turn = await t.send(
+ [
+ `Call the \`${TOOL_NAME}\` tool exactly ${SEARCH_COUNT} times in one parallel batch.`,
+ `Use each query exactly once: ${QUERIES.map((query) => `"${query}"`).join(", ")}.`,
+ "Do not use any other tool.",
+ "After every call returns, reply with exactly: web search fanout complete",
+ ].join("\n"),
+ );
+ turn.expectOk();
+
+ t.succeeded();
+ t.calledTool(TOOL_NAME, { count: (count) => count >= SEARCH_COUNT });
+ t.noFailedActions();
+ turn.eventsSatisfy(
+ "eight distinct web_search calls complete",
+ (events) => completedDistinctCalls(events) >= SEARCH_COUNT,
+ );
+ t.messageIncludes(/web search fanout complete/iu);
+ },
+});
diff --git a/e2e/fixtures/agent-tools/evals/static-tools/web-search.eval.ts b/e2e/fixtures/agent-tools/evals/static-tools/web-search.eval.ts
index c70319ee2..50e8507a5 100644
--- a/e2e/fixtures/agent-tools/evals/static-tools/web-search.eval.ts
+++ b/e2e/fixtures/agent-tools/evals/static-tools/web-search.eval.ts
@@ -48,7 +48,8 @@ export default defineEval({
[
"Important date context: the 2026 NBA Finals have absolutely already been played, and a champion has been crowned.",
"Do not claim the event is in the future, even if your internal knowledge incorrectly places the current date in 2025.",
- `Call ${TOOL_NAME} to verify who won the 2026 NBA Finals, then answer with the winning team.`,
+ `Use the \`${TOOL_NAME}\` tool to verify who won the 2026 NBA Finals, then answer with the winning team.`,
+ "Do not answer from memory; call the tool before answering.",
].join("\n"),
);
diff --git a/packages/eve/extension-contracts/compatibility/tool/v4.ts b/packages/eve/extension-contracts/compatibility/tool/v4.ts
new file mode 100644
index 000000000..801d59638
--- /dev/null
+++ b/packages/eve/extension-contracts/compatibility/tool/v4.ts
@@ -0,0 +1,19 @@
+import { defineTool } from "#public/tools/index.js";
+
+export default defineTool({
+ description: "Summarize a report for the model",
+ inputSchema: { type: "object", properties: {} },
+ async execute(_input, ctx) {
+ return {
+ internal: "details",
+ sessionId: ctx.session.id,
+ summary: "Report generated",
+ };
+ },
+ toModelOutput(output) {
+ return {
+ type: "text",
+ value: (output as { summary: string }).summary,
+ };
+ },
+});
diff --git a/packages/eve/extension-contracts/entrypoints/tool.ts b/packages/eve/extension-contracts/entrypoints/tool.ts
index f28a73a37..d14f8edb5 100644
--- a/packages/eve/extension-contracts/entrypoints/tool.ts
+++ b/packages/eve/extension-contracts/entrypoints/tool.ts
@@ -12,4 +12,5 @@ export {
toolOutput,
toolOutputPart,
toolResultFrom,
+ webSearch,
} from "../../src/public/tools/index.ts";
diff --git a/packages/eve/extension-contracts/reports/tool/v5.json b/packages/eve/extension-contracts/reports/tool/v5.json
new file mode 100644
index 000000000..321d88fb9
--- /dev/null
+++ b/packages/eve/extension-contracts/reports/tool/v5.json
@@ -0,0 +1,22 @@
+{
+ "kind": "eve-extension-capability-contract",
+ "capability": "tool",
+ "epoch": 5,
+ "sha256": "aff0592efe1c3a4c8607ca72156de080afa41564804d8fae5ffd0c7245a62dab",
+ "exports": [
+ "defineBashTool",
+ "defineGlobTool",
+ "defineGrepTool",
+ "defineReadFileTool",
+ "defineTool",
+ "defineWriteFileTool",
+ "disableTool",
+ "experimental_workflow",
+ "isDisabledToolSentinel",
+ "isExperimentalWorkflowToolDefinition",
+ "toolOutput",
+ "toolOutputPart",
+ "toolResultFrom",
+ "webSearch"
+ ]
+}
diff --git a/packages/eve/src/compiler/extension-compatibility.ts b/packages/eve/src/compiler/extension-compatibility.ts
index 791749c55..5da0ff509 100644
--- a/packages/eve/src/compiler/extension-compatibility.ts
+++ b/packages/eve/src/compiler/extension-compatibility.ts
@@ -21,7 +21,7 @@ interface ExtensionCapabilityContract {
const EXTENSION_CAPABILITY_CONTRACTS = {
extension: { current: 1, supported: [1], dropped: {} },
- tool: { current: 4, supported: [1, 2, 3, 4], dropped: {} },
+ tool: { current: 5, supported: [1, 2, 3, 4, 5], dropped: {} },
dynamicTool: { current: 8, supported: [1, 2, 3, 4, 5, 6, 7, 8], dropped: {} },
connection: { current: 2, supported: [1, 2], dropped: {} },
hook: { current: 6, supported: [1, 2, 3, 4, 5, 6], dropped: {} },
diff --git a/packages/eve/src/compiler/manifest.test.ts b/packages/eve/src/compiler/manifest.test.ts
index 215c1f901..ae9a80bd7 100644
--- a/packages/eve/src/compiler/manifest.test.ts
+++ b/packages/eve/src/compiler/manifest.test.ts
@@ -143,6 +143,22 @@ describe("compiledAgentManifestSchema", () => {
expect(parsed.workflowTool).toEqual({ maxSubagents: 6 });
});
+ it("preserves web search provider configuration", () => {
+ const manifest = createCompiledAgentManifest({
+ agentRoot: "/app/agent",
+ appRoot: "/app",
+ config: {
+ model: { id: "openai/gpt-5.5", routing: classifyModelRouting("openai/gpt-5.5") },
+ name: "app",
+ },
+ webSearchProvider: "exa",
+ });
+
+ const parsed = compiledAgentManifestSchema.parse(manifest);
+
+ expect(parsed.webSearchProvider).toBe("exa");
+ });
+
it("preserves dynamic model resolver source", () => {
const manifest = createCompiledAgentManifest({
agentRoot: "/app/agent",
diff --git a/packages/eve/src/compiler/manifest.ts b/packages/eve/src/compiler/manifest.ts
index 7b6c35f22..b6dc6c438 100644
--- a/packages/eve/src/compiler/manifest.ts
+++ b/packages/eve/src/compiler/manifest.ts
@@ -28,6 +28,7 @@ import type {
ModelRouting,
} from "#shared/agent-definition.js";
import type { InternalToolDefinition } from "#shared/tool-definition.js";
+import type { WebSearchProvider } from "#shared/web-search.js";
/**
* Stable manifest kind emitted by the compiler for runtime loading.
@@ -42,7 +43,7 @@ export const ROOT_COMPILED_AGENT_NODE_ID = "__root__";
/**
* Current compiled manifest schema version.
*/
-export const COMPILED_AGENT_MANIFEST_VERSION = 38;
+export const COMPILED_AGENT_MANIFEST_VERSION = 39;
/**
* Compiled channel entry preserved in the compiled manifest.
@@ -652,6 +653,7 @@ const compiledAgentNodeManifestSchema = z
diagnosticsSummary: discoverDiagnosticsSummarySchema,
disabledFrameworkTools: z.array(z.string()).readonly(),
workflowTool: compiledWorkflowToolDefinitionSchema.optional(),
+ webSearchProvider: z.enum(["exa", "parallel"]).optional(),
dynamicInstructions: z.array(compiledDynamicInstructionsDefinitionSchema).default([]),
dynamicSkills: z.array(compiledDynamicSkillDefinitionSchema).default([]),
dynamicTools: z.array(compiledDynamicToolDefinitionSchema).default([]),
@@ -750,6 +752,7 @@ export const compiledAgentManifestSchema = z
diagnosticsSummary: discoverDiagnosticsSummarySchema,
disabledFrameworkTools: z.array(z.string()).readonly(),
workflowTool: compiledWorkflowToolDefinitionSchema.optional(),
+ webSearchProvider: z.enum(["exa", "parallel"]).optional(),
dynamicInstructions: z.array(compiledDynamicInstructionsDefinitionSchema).default([]),
dynamicSkills: z.array(compiledDynamicSkillDefinitionSchema).default([]),
dynamicTools: z.array(compiledDynamicToolDefinitionSchema).default([]),
@@ -781,6 +784,7 @@ export function createCompiledAgentNodeManifest(input: {
readonly diagnosticsSummary?: DiscoverDiagnosticsSummary;
readonly disabledFrameworkTools?: readonly string[];
readonly workflowTool?: CompiledWorkflowToolDefinition;
+ readonly webSearchProvider?: WebSearchProvider;
readonly dynamicInstructions?: readonly CompiledDynamicInstructionsDefinition[];
readonly dynamicSkills?: readonly CompiledDynamicSkillDefinition[];
readonly dynamicTools?: readonly CompiledDynamicToolDefinition[];
@@ -863,6 +867,7 @@ export function createCompiledAgentNodeManifest(input: {
input.workflowTool === undefined
? undefined
: { maxSubagents: input.workflowTool.maxSubagents },
+ webSearchProvider: input.webSearchProvider,
dynamicInstructions: [...(input.dynamicInstructions ?? [])],
dynamicSkills: [...(input.dynamicSkills ?? [])],
dynamicTools: [...(input.dynamicTools ?? [])],
@@ -936,6 +941,7 @@ export function createCompiledAgentManifest(input: {
readonly diagnosticsSummary?: DiscoverDiagnosticsSummary;
readonly disabledFrameworkTools?: readonly string[];
readonly workflowTool?: CompiledWorkflowToolDefinition;
+ readonly webSearchProvider?: WebSearchProvider;
readonly dynamicSkills?: readonly CompiledDynamicSkillDefinition[];
readonly dynamicTools?: readonly CompiledDynamicToolDefinition[];
readonly hooks?: readonly CompiledHookDefinition[];
diff --git a/packages/eve/src/compiler/normalize-extension.ts b/packages/eve/src/compiler/normalize-extension.ts
index d42a981cf..cf83154be 100644
--- a/packages/eve/src/compiler/normalize-extension.ts
+++ b/packages/eve/src/compiler/normalize-extension.ts
@@ -196,6 +196,11 @@ async function composeManifestContributions(input: {
`${describeExtensionSource(role, namespace, source.logicalPath)} enables the Workflow tool, ` +
`but the Workflow tool is the consuming agent's to enable, not an extension's. Remove it.`,
);
+ } else if (entry.kind === "web-search-tool") {
+ throw new Error(
+ `${describeExtensionSource(role, namespace, source.logicalPath)} configures web search, ` +
+ `but the web search provider is the consuming agent's to configure, not an extension's. Remove it.`,
+ );
} else if (role === "extension") {
throw new Error(
`${describeExtensionSource(role, namespace, source.logicalPath)} calls disableTool(), ` +
diff --git a/packages/eve/src/compiler/normalize-manifest.test.ts b/packages/eve/src/compiler/normalize-manifest.test.ts
index b4b316f72..e6c4aef01 100644
--- a/packages/eve/src/compiler/normalize-manifest.test.ts
+++ b/packages/eve/src/compiler/normalize-manifest.test.ts
@@ -11,6 +11,7 @@ import type { CompiledAgentDefinition } from "#compiler/manifest.js";
import { compileAgentManifest } from "#compiler/normalize-manifest.js";
import { defineAgent } from "#public/definitions/agent.js";
import { defineDynamic, experimental_workflow } from "#public/definitions/tool.js";
+import { webSearch } from "#public/tools/web-search.js";
import { DEFAULT_AGENT_MODEL_ID } from "#shared/default-agent-model.js";
const mocks = vi.hoisted(() => ({
@@ -96,6 +97,37 @@ describe("compileAgentManifest", () => {
expect(compiled.workflowTool).toEqual({ maxSubagents: 6 });
});
+ it("compiles web search provider configuration", async () => {
+ const manifest = createAgentSourceManifest({
+ agentId: "root",
+ agentRoot: "/app/agent",
+ appRoot: "/app",
+ tools: [createModuleSourceRef({ logicalPath: "tools/web_search.ts" })],
+ });
+ mocks.compileAgentConfig.mockResolvedValue(createConfig({ name: "root" }));
+ mocks.loadModuleBackedDefinition.mockResolvedValue(webSearch({ provider: "exa" }));
+
+ const compiled = await compileAgentManifest(manifest);
+
+ expect(compiled.webSearchProvider).toBe("exa");
+ expect(compiled.tools).toEqual([]);
+ });
+
+ it("requires web search configuration to use the web_search filename", async () => {
+ const manifest = createAgentSourceManifest({
+ agentId: "root",
+ agentRoot: "/app/agent",
+ appRoot: "/app",
+ tools: [createModuleSourceRef({ logicalPath: "tools/search.ts" })],
+ });
+ mocks.compileAgentConfig.mockResolvedValue(createConfig({ name: "root" }));
+ mocks.loadModuleBackedDefinition.mockResolvedValue(webSearch({ provider: "exa" }));
+
+ await expect(compileAgentManifest(manifest)).rejects.toThrow(
+ 'must be exported from "tools/web_search.ts"',
+ );
+ });
+
it("compiles a dynamic subagent manifest without resolving an agent config", async () => {
const dynamic = defineDynamic({
events: {
diff --git a/packages/eve/src/compiler/normalize-manifest.ts b/packages/eve/src/compiler/normalize-manifest.ts
index 47574cc41..4aaf39cb8 100644
--- a/packages/eve/src/compiler/normalize-manifest.ts
+++ b/packages/eve/src/compiler/normalize-manifest.ts
@@ -15,6 +15,7 @@ import {
createCompiledAgentNodeManifest,
ROOT_COMPILED_AGENT_NODE_ID,
} from "#compiler/manifest.js";
+import type { WebSearchProvider } from "#shared/web-search.js";
import { createCompiledRuntimeModelCatalogLoader } from "#compiler/model-catalog.js";
import { compileAgentConfig } from "#compiler/normalize-agent-config.js";
import { compileChannelDefinition } from "#compiler/normalize-channel.js";
@@ -113,6 +114,7 @@ async function compileAgentNodeManifest(
const dynamicTools: CompiledDynamicToolDefinition[] = [];
const disabledFrameworkTools: string[] = [];
let workflowTool: CompiledWorkflowToolDefinition | undefined;
+ let webSearchProvider: WebSearchProvider | undefined;
for (const entry of compiledToolEntries) {
if (entry.kind === "tool") {
@@ -121,6 +123,8 @@ async function compileAgentNodeManifest(
dynamicTools.push(entry.definition);
} else if (entry.kind === "workflow-tool") {
workflowTool = { maxSubagents: entry.maxSubagents };
+ } else if (entry.kind === "web-search-tool") {
+ webSearchProvider = entry.provider;
} else {
disabledFrameworkTools.push(entry.name);
}
@@ -253,6 +257,7 @@ async function compileAgentNodeManifest(
diagnosticsSummary: manifest.diagnosticsSummary,
disabledFrameworkTools,
workflowTool,
+ webSearchProvider,
dynamicSkills,
dynamicTools,
hooks,
diff --git a/packages/eve/src/compiler/normalize-tool.ts b/packages/eve/src/compiler/normalize-tool.ts
index 82490366e..9116fef4e 100644
--- a/packages/eve/src/compiler/normalize-tool.ts
+++ b/packages/eve/src/compiler/normalize-tool.ts
@@ -18,6 +18,7 @@ export type CompiledToolEntry =
| { readonly kind: "tool"; readonly definition: CompiledToolDefinition }
| { readonly kind: "disabled"; readonly name: string }
| { readonly kind: "workflow-tool"; readonly maxSubagents?: number }
+ | { readonly kind: "web-search-tool"; readonly provider: "exa" | "parallel" }
| { readonly kind: "dynamic-tool"; readonly definition: CompiledDynamicToolDefinition };
/**
@@ -58,6 +59,15 @@ export async function compileToolEntry(
return { kind: "workflow-tool", maxSubagents: entry.maxSubagents };
}
+ if (entry.kind === "web-search-tool") {
+ if (toolName !== "web_search") {
+ throw new Error(
+ `The webSearch() definition must be exported from "tools/web_search.ts", not "${source.logicalPath}".`,
+ );
+ }
+ return { kind: "web-search-tool", provider: entry.provider };
+ }
+
if (entry.kind === "dynamic-tool") {
return {
kind: "dynamic-tool",
diff --git a/packages/eve/src/execution/node-step.ts b/packages/eve/src/execution/node-step.ts
index b2f3ff2eb..b4681434a 100644
--- a/packages/eve/src/execution/node-step.ts
+++ b/packages/eve/src/execution/node-step.ts
@@ -95,6 +95,7 @@ export function createExecutionNodeStep(input: CreateExecutionNodeStepInput): St
compactOnly: input.compactOnly,
workflow: input.node.agent.workflowTool !== undefined,
workflowMaxSubagents: input.workflowMaxSubagents,
+ webSearchProvider: input.node.agent.webSearchProvider,
handleEvent: input.handleEvent,
instrumentation,
mode: input.mode,
diff --git a/packages/eve/src/harness/provider-tools.test.ts b/packages/eve/src/harness/provider-tools.test.ts
index 52e658987..9765d710a 100644
--- a/packages/eve/src/harness/provider-tools.test.ts
+++ b/packages/eve/src/harness/provider-tools.test.ts
@@ -3,6 +3,7 @@ import { beforeEach, describe, expect, it, vi } from "vitest";
import type { RuntimeModelReference } from "#runtime/agent/bootstrap.js";
import {
WEB_SEARCH_ANTHROPIC_OUTPUT_SCHEMA,
+ WEB_SEARCH_EXA_OUTPUT_SCHEMA,
WEB_SEARCH_GOOGLE_OUTPUT_SCHEMA,
WEB_SEARCH_OPENAI_OUTPUT_SCHEMA,
WEB_SEARCH_PARALLEL_OUTPUT_SCHEMA,
@@ -17,6 +18,7 @@ import {
const {
anthropicWebSearch_20250305,
anthropicWebSearch_20260209,
+ gatewayExaSearch,
gatewayParallelSearch,
googleSearch,
openaiWebSearch,
@@ -27,6 +29,7 @@ const {
anthropicWebSearch_20260209: vi.fn(() => ({
providerTool: "anthropic.webSearch_20260209",
})),
+ gatewayExaSearch: vi.fn(() => ({ providerTool: "gateway.exaSearch" })),
gatewayParallelSearch: vi.fn(() => ({ providerTool: "gateway.parallelSearch" })),
googleSearch: vi.fn(() => ({ providerTool: "google.googleSearch" })),
openaiWebSearch: vi.fn(() => ({ providerTool: "openai.webSearch" })),
@@ -63,6 +66,7 @@ vi.mock("ai", async () => {
...actual,
gateway: {
tools: {
+ exaSearch: gatewayExaSearch,
parallelSearch: gatewayParallelSearch,
},
},
@@ -77,16 +81,22 @@ describe("resolveWebSearchBackend", () => {
beforeEach(() => {
anthropicWebSearch_20250305.mockClear();
anthropicWebSearch_20260209.mockClear();
+ gatewayExaSearch.mockClear();
gatewayParallelSearch.mockClear();
googleSearch.mockClear();
openaiWebSearch.mockClear();
});
- it("returns 'parallel' for an OpenAI gateway model", () => {
+ it("returns 'parallel' for an OpenAI gateway model by default", () => {
const ref: RuntimeModelReference = { id: "openai/gpt-5.4" };
expect(resolveWebSearchBackend(ref)).toBe("parallel");
});
+ it("returns the configured Exa provider for a gateway model", () => {
+ const ref: RuntimeModelReference = { id: "openai/gpt-5.4" };
+ expect(resolveWebSearchBackend(ref, "exa")).toBe("exa");
+ });
+
it("returns 'openai' for a BYO OpenAI model", () => {
const ref: RuntimeModelReference = {
id: "openai.chat/gpt-5.4",
@@ -97,7 +107,7 @@ describe("resolveWebSearchBackend", () => {
sourceId: "agent.ts",
},
};
- expect(resolveWebSearchBackend(ref)).toBe("openai");
+ expect(resolveWebSearchBackend(ref, "exa")).toBe("openai");
});
it("returns 'parallel' for an Anthropic gateway model", () => {
@@ -179,6 +189,17 @@ describe("resolveWebSearchBackend", () => {
expect(getOutputJsonSchema(tool)).toEqual(WEB_SEARCH_GOOGLE_OUTPUT_SCHEMA);
});
+ it("uses gateway exaSearch for the Exa backend", async () => {
+ const tool = await resolveWebSearchProviderTool("exa");
+
+ expect(gatewayExaSearch).toHaveBeenCalledWith({
+ contents: { highlights: { maxCharacters: 1_000 } },
+ numResults: 10,
+ });
+ expect(tool).toMatchObject({ providerTool: "gateway.exaSearch" });
+ expect(getOutputJsonSchema(tool)).toEqual(WEB_SEARCH_EXA_OUTPUT_SCHEMA);
+ });
+
it("uses gateway parallelSearch for the Parallel backend", async () => {
const tool = await resolveWebSearchProviderTool("parallel");
@@ -189,6 +210,7 @@ describe("resolveWebSearchBackend", () => {
it("resolves output schemas per selected backend", () => {
expect(resolveWebSearchOutputSchema("anthropic")).toBe(WEB_SEARCH_ANTHROPIC_OUTPUT_SCHEMA);
+ expect(resolveWebSearchOutputSchema("exa")).toBe(WEB_SEARCH_EXA_OUTPUT_SCHEMA);
expect(resolveWebSearchOutputSchema("google")).toBe(WEB_SEARCH_GOOGLE_OUTPUT_SCHEMA);
expect(resolveWebSearchOutputSchema("openai")).toBe(WEB_SEARCH_OPENAI_OUTPUT_SCHEMA);
expect(resolveWebSearchOutputSchema("parallel")).toBe(WEB_SEARCH_PARALLEL_OUTPUT_SCHEMA);
diff --git a/packages/eve/src/harness/provider-tools.ts b/packages/eve/src/harness/provider-tools.ts
index fb516131e..9444af718 100644
--- a/packages/eve/src/harness/provider-tools.ts
+++ b/packages/eve/src/harness/provider-tools.ts
@@ -3,17 +3,19 @@ import { jsonSchema, type JSONSchema7, type ToolSet } from "ai";
import type { RuntimeModelReference } from "#runtime/agent/bootstrap.js";
import {
WEB_SEARCH_ANTHROPIC_OUTPUT_SCHEMA,
+ WEB_SEARCH_EXA_OUTPUT_SCHEMA,
WEB_SEARCH_GOOGLE_OUTPUT_SCHEMA,
WEB_SEARCH_OPENAI_OUTPUT_SCHEMA,
WEB_SEARCH_PARALLEL_OUTPUT_SCHEMA,
WEB_SEARCH_TOOL_DEFINITION,
} from "#runtime/framework-tools/web-search.js";
import type { JsonObject } from "#shared/json.js";
+import type { WebSearchProvider } from "#shared/web-search.js";
/**
* The provider backend resolved for one web search tool invocation.
*/
-export type WebSearchBackend = "anthropic" | "google" | "openai" | "parallel";
+export type WebSearchBackend = "anthropic" | "exa" | "google" | "openai" | "parallel";
/**
* Maps an upstream provider tool type (the literal `type` string the AI SDK
@@ -55,6 +57,8 @@ export function resolveWebSearchOutputSchema(backend: WebSearchBackend): JsonObj
switch (backend) {
case "anthropic":
return WEB_SEARCH_ANTHROPIC_OUTPUT_SCHEMA;
+ case "exa":
+ return WEB_SEARCH_EXA_OUTPUT_SCHEMA;
case "google":
return WEB_SEARCH_GOOGLE_OUTPUT_SCHEMA;
case "openai":
@@ -67,15 +71,18 @@ export function resolveWebSearchOutputSchema(backend: WebSearchBackend): JsonObj
/**
* Determines the web search backend for a model reference.
*
- * - All AI Gateway models: Parallel search via gateway
+ * - All AI Gateway models: the configured search provider (Parallel by default)
* - Direct/BYO OpenAI models: native OpenAI search
* - Direct/BYO Anthropic models: native Anthropic search
* - Direct/BYO Google models: native Google search grounding
* - Other BYO models: not available (returns `null`)
*/
-export function resolveWebSearchBackend(modelRef: RuntimeModelReference): WebSearchBackend | null {
+export function resolveWebSearchBackend(
+ modelRef: RuntimeModelReference,
+ gatewayProvider: WebSearchProvider = "parallel",
+): WebSearchBackend | null {
if (modelRef.source === undefined) {
- return "parallel";
+ return gatewayProvider;
}
const providerId = modelRef.id.split("/")[0] ?? "";
@@ -125,6 +132,16 @@ export async function resolveWebSearchProviderTool(
const { google } = await import("#compiled/@ai-sdk/google/index.js");
return attachWebSearchOutputSchema(google.tools.googleSearch({}) as ToolSet[string], backend);
}
+ case "exa": {
+ const { gateway } = await import("ai");
+ return attachWebSearchOutputSchema(
+ gateway.tools.exaSearch({
+ contents: { highlights: { maxCharacters: 1_000 } },
+ numResults: 10,
+ }) as ToolSet[string],
+ backend,
+ );
+ }
case "parallel": {
const { gateway } = await import("ai");
return attachWebSearchOutputSchema(
diff --git a/packages/eve/src/harness/tool-loop.test.ts b/packages/eve/src/harness/tool-loop.test.ts
index 903b3c9e0..a6c182d39 100644
--- a/packages/eve/src/harness/tool-loop.test.ts
+++ b/packages/eve/src/harness/tool-loop.test.ts
@@ -66,6 +66,7 @@ vi.mock("ai", () => ({
ToolLoopAgent: vi.fn(),
gateway: {
tools: {
+ exaSearch: vi.fn(() => ({})),
parallelSearch: vi.fn(() => ({})),
},
},
diff --git a/packages/eve/src/harness/tool-loop.ts b/packages/eve/src/harness/tool-loop.ts
index 90a1767ab..2ed3a3919 100644
--- a/packages/eve/src/harness/tool-loop.ts
+++ b/packages/eve/src/harness/tool-loop.ts
@@ -956,6 +956,7 @@ export function createToolLoopHarness(config: ToolLoopHarnessConfig): StepFn {
disabledProviderTools: opts.disabledProviderTools,
modelReference: session.agent.modelReference,
tools: advertisedHarnessTools,
+ webSearchProvider: config.webSearchProvider,
});
if (ctx !== undefined) {
diff --git a/packages/eve/src/harness/tools.test.ts b/packages/eve/src/harness/tools.test.ts
index 0cba032bd..7136187ad 100644
--- a/packages/eve/src/harness/tools.test.ts
+++ b/packages/eve/src/harness/tools.test.ts
@@ -9,6 +9,7 @@ import { always, never, once } from "#public/tools/approval/approval-helpers.js"
import type { RuntimeModelReference } from "#runtime/agent/bootstrap.js";
import {
WEB_SEARCH_ANTHROPIC_OUTPUT_SCHEMA,
+ WEB_SEARCH_EXA_OUTPUT_SCHEMA,
WEB_SEARCH_GOOGLE_OUTPUT_SCHEMA,
WEB_SEARCH_OPENAI_OUTPUT_SCHEMA,
WEB_SEARCH_PARALLEL_OUTPUT_SCHEMA,
@@ -398,6 +399,27 @@ describe("buildToolSet", () => {
},
);
+ it("injects Exa when configured for an AI Gateway model", async () => {
+ const tools: HarnessToolMap = new Map<string, HarnessToolDefinition>([
+ [
+ "web_search",
+ {
+ description: "Web search.",
+ inputSchema: jsonSchema({}),
+ name: "web_search",
+ },
+ ],
+ ]);
+
+ const result = await buildToolSetWithProviderTools({
+ modelReference: { id: "openai/gpt-5.4" },
+ tools,
+ webSearchProvider: "exa",
+ });
+
+ expect(getOutputJsonSchema(result.web_search)).toEqual(WEB_SEARCH_EXA_OUTPUT_SCHEMA);
+ });
+
it("omits provider-managed web_search when no provider backend is available", async () => {
const tools: HarnessToolMap = new Map<string, HarnessToolDefinition>([
[
diff --git a/packages/eve/src/harness/tools.ts b/packages/eve/src/harness/tools.ts
index 46cbf6267..27794dcae 100644
--- a/packages/eve/src/harness/tools.ts
+++ b/packages/eve/src/harness/tools.ts
@@ -2,6 +2,7 @@ import { type ToolApprovalConfiguration, type ToolApprovalStatus, type ToolSet,
import type { SessionCapabilities } from "#channel/types.js";
import type { RuntimeModelReference } from "#runtime/agent/bootstrap.js";
+import type { WebSearchProvider } from "#shared/web-search.js";
import { ASK_QUESTION_TOOL_NAME } from "#runtime/framework-tools/ask-question.js";
import { WEB_SEARCH_TOOL_DEFINITION } from "#runtime/framework-tools/web-search.js";
import { isObject } from "#shared/guards.js";
@@ -206,6 +207,7 @@ export async function buildToolSetWithProviderTools(input: {
readonly disabledProviderTools?: ReadonlySet<string>;
readonly modelReference: RuntimeModelReference;
readonly tools: HarnessToolMap;
+ readonly webSearchProvider?: WebSearchProvider;
}): Promise<ToolSet> {
const disabled = input.disabledProviderTools;
const tools: ToolSet = {
@@ -222,7 +224,7 @@ export async function buildToolSetWithProviderTools(input: {
if (!disabled?.has(WEB_SEARCH_TOOL_DEFINITION.name)) {
const webSearchTool = input.tools.get(WEB_SEARCH_TOOL_DEFINITION.name);
if (webSearchTool !== undefined && webSearchTool.execute === undefined) {
- const backend = resolveWebSearchBackend(input.modelReference);
+ const backend = resolveWebSearchBackend(input.modelReference, input.webSearchProvider);
if (backend === null) {
delete tools[WEB_SEARCH_TOOL_DEFINITION.name];
} else {
diff --git a/packages/eve/src/harness/types.ts b/packages/eve/src/harness/types.ts
index 8c7df8444..b2edbdf71 100644
--- a/packages/eve/src/harness/types.ts
+++ b/packages/eve/src/harness/types.ts
@@ -11,6 +11,7 @@ import type { SandboxState } from "#sandbox/state.js";
import type { JsonObject } from "#shared/json.js";
import type { TokenUsage } from "#shared/token-usage.js";
import type { InternalToolDefinition } from "#shared/tool-definition.js";
+import type { WebSearchProvider } from "#shared/web-search.js";
import type { AgentReasoningDefinition } from "#shared/agent-definition.js";
import type { HarnessToolDefinition } from "#harness/execute-tool.js";
import type { HarnessInstrumentation } from "#harness/instrumentation-runtime.js";
@@ -257,6 +258,8 @@ export interface ToolLoopHarnessConfig {
* {@link import("#harness/workflow-subagent-limit.js").DEFAULT_WORKFLOW_MAX_SUBAGENTS}.
*/
readonly workflowMaxSubagents?: number;
+ /** AI Gateway provider selected for the framework `web_search` tool. */
+ readonly webSearchProvider?: WebSearchProvider;
readonly handleEvent?: HandleEventFn;
/**
* Internal lifecycle hooks injected into each actual model attempt.
diff --git a/packages/eve/src/internal/authored-definition/schema-backed.test.ts b/packages/eve/src/internal/authored-definition/schema-backed.test.ts
index 9e55a2948..406b900ec 100644
--- a/packages/eve/src/internal/authored-definition/schema-backed.test.ts
+++ b/packages/eve/src/internal/authored-definition/schema-backed.test.ts
@@ -8,6 +8,7 @@ import {
experimental_workflow,
} from "#public/definitions/tool.js";
import { once } from "#public/tools/approval/approval-helpers.js";
+import { webSearch } from "#public/tools/web-search.js";
import { normalizeToolDefinition } from "#internal/authored-definition/schema-backed.js";
const FAILURE_MESSAGE = "Expected the tool export to match the public eve shape.";
@@ -49,6 +50,19 @@ describe("normalizeToolDefinition", () => {
expect(entry).toEqual({ kind: "workflow-tool", maxSubagents: 6 });
});
+ it("returns a configured entry for the provider-managed web search tool", () => {
+ expect(normalizeToolDefinition(webSearch({ provider: "exa" }), FAILURE_MESSAGE)).toEqual({
+ kind: "web-search-tool",
+ provider: "exa",
+ });
+ });
+
+ it("rejects an unsupported web search provider", () => {
+ expect(() =>
+ normalizeToolDefinition({ kind: "eve:web-search-tool", provider: "other" }, FAILURE_MESSAGE),
+ ).toThrow('Expected "provider" to be one of: exa, parallel');
+ });
+
it.each([0, 1.5, -1, "6"])("rejects invalid workflow max subagents %j", (maxSubagents) => {
expect(() =>
normalizeToolDefinition(
diff --git a/packages/eve/src/internal/authored-definition/schema-backed.ts b/packages/eve/src/internal/authored-definition/schema-backed.ts
index af0569b36..b6919a272 100644
--- a/packages/eve/src/internal/authored-definition/schema-backed.ts
+++ b/packages/eve/src/internal/authored-definition/schema-backed.ts
@@ -2,6 +2,7 @@ import {
isDisabledToolSentinel,
isExperimentalWorkflowToolDefinition,
} from "#public/definitions/tool.js";
+import { isWebSearchToolDefinition } from "#public/tools/web-search.js";
import {
expectFunction,
expectObjectRecord,
@@ -43,6 +44,7 @@ type NormalizedToolEntry =
| { readonly kind: "tool"; readonly definition: NormalizedAuthoredTool }
| { readonly kind: "disabled" }
| { readonly kind: "workflow-tool"; readonly maxSubagents?: number }
+ | { readonly kind: "web-search-tool"; readonly provider: "exa" | "parallel" }
| {
readonly kind: "dynamic-tool";
readonly eventNames: readonly DynamicToolEventName[];
@@ -77,6 +79,15 @@ export function normalizeToolDefinition(value: unknown, message: string): Normal
: expectPositiveInteger(record.maxSubagents, message),
};
}
+ if (isWebSearchToolDefinition(value)) {
+ const record = expectObjectRecord(value, message);
+ expectOnlyKnownKeys(record, ["kind", "provider"], message);
+ const provider = expectString(record.provider, message);
+ if (provider !== "exa" && provider !== "parallel") {
+ throw new Error(`${message} Expected "provider" to be one of: exa, parallel.`);
+ }
+ return { kind: "web-search-tool", provider };
+ }
const record = expectObjectRecord(value, message);
expectOnlyKnownKeys(
diff --git a/packages/eve/src/public/tools/defaults.ts b/packages/eve/src/public/tools/defaults.ts
index dd1b0ef74..137ef4042 100644
--- a/packages/eve/src/public/tools/defaults.ts
+++ b/packages/eve/src/public/tools/defaults.ts
@@ -10,7 +10,6 @@ import { READ_FILE_TOOL_DEFINITION } from "#runtime/framework-tools/read-file.js
import { SKILL_TOOL_DEFINITION } from "#runtime/framework-tools/skill.js";
import { TODO_TOOL_DEFINITION } from "#runtime/framework-tools/todo.js";
import { WEB_FETCH_TOOL_DEFINITION } from "#runtime/framework-tools/web-fetch.js";
-import { WEB_SEARCH_TOOL_DEFINITION } from "#runtime/framework-tools/web-search.js";
import { WRITE_FILE_TOOL_DEFINITION } from "#runtime/framework-tools/write-file.js";
import type { ToolDefinition } from "#public/definitions/tool.js";
import { toPublicToolDefinition } from "#public/tools/internal.js";
@@ -68,25 +67,3 @@ export const todo: ToolDefinition = toPublicToolDefinition(TODO_TOOL_DEFINITION)
* nothing to load.
*/
export const loadSkill: ToolDefinition = toPublicToolDefinition(SKILL_TOOL_DEFINITION);
-
-/**
- * Framework-provided web search tool. The provider manages the real
- * implementation; the harness injects it at step time based on the model
- * provider. The local `execute` here is a throwing stub: calling it directly
- * fails. To run your own search instead, replace this with `defineTool()` in
- * `agent/tools/web_search.ts`.
- *
- * This default has no input schema (`inputSchema` is empty): the
- * provider-managed implementation defines its own contract at step time, so it
- * is shaped differently from the others, which preserve their real schemas.
- */
-export const webSearch: ToolDefinition = {
- description: WEB_SEARCH_TOOL_DEFINITION.description,
- inputSchema: {} as never,
- execute(_input) {
- throw new Error(
- "web_search is provider-managed and has no local execute. " +
- "Override with defineTool() to provide a custom implementation.",
- );
- },
-};
diff --git a/packages/eve/src/public/tools/index.ts b/packages/eve/src/public/tools/index.ts
index 35bd0f198..27fb84c69 100644
--- a/packages/eve/src/public/tools/index.ts
+++ b/packages/eve/src/public/tools/index.ts
@@ -48,3 +48,9 @@ export {
type DefineWriteFileToolInput,
defineWriteFileTool,
} from "#public/tools/define-write-file-tool.js";
+export {
+ type WebSearchProvider,
+ type WebSearchToolDefinition,
+ type WebSearchToolInput,
+ webSearch,
+} from "#public/tools/web-search.js";
diff --git a/packages/eve/src/public/tools/web-search.test.ts b/packages/eve/src/public/tools/web-search.test.ts
new file mode 100644
index 000000000..53d838f5f
--- /dev/null
+++ b/packages/eve/src/public/tools/web-search.test.ts
@@ -0,0 +1,12 @@
+import { describe, expect, it } from "vitest";
+
+import { webSearch } from "#public/tools/web-search.js";
+
+describe("webSearch", () => {
+ it.each(["parallel", "exa"] as const)("configures the %s provider", (provider) => {
+ expect(webSearch({ provider })).toEqual({
+ kind: "eve:web-search-tool",
+ provider,
+ });
+ });
+});
diff --git a/packages/eve/src/public/tools/web-search.ts b/packages/eve/src/public/tools/web-search.ts
new file mode 100644
index 000000000..530b1bdeb
--- /dev/null
+++ b/packages/eve/src/public/tools/web-search.ts
@@ -0,0 +1,53 @@
+import type { WebSearchProvider } from "#shared/web-search.js";
+
+export type { WebSearchProvider };
+
+const WEB_SEARCH_TOOL_KIND = "eve:web-search-tool";
+
+/** Configuration accepted by {@link webSearch}. */
+export interface WebSearchToolInput {
+ /** Provider to use when the agent model is routed through AI Gateway. */
+ readonly provider: WebSearchProvider;
+}
+
+/**
+ * Provider-managed web search configuration.
+ *
+ * Export this from `agent/tools/web_search.ts` to select the AI Gateway
+ * search provider for that agent. Direct provider models continue to use
+ * their native web search implementation.
+ */
+export interface WebSearchToolDefinition {
+ readonly kind: typeof WEB_SEARCH_TOOL_KIND;
+ readonly provider: WebSearchProvider;
+}
+
+/**
+ * Configures the framework-provided `web_search` tool.
+ *
+ * When no configuration file is present, eve uses Parallel for AI Gateway
+ * models.
+ *
+ * @example
+ * ```ts
+ * // agent/tools/web_search.ts
+ * import { webSearch } from "eve/tools";
+ *
+ * export default webSearch({ provider: "exa" });
+ * ```
+ */
+export function webSearch(input: WebSearchToolInput): WebSearchToolDefinition {
+ return {
+ kind: WEB_SEARCH_TOOL_KIND,
+ provider: input.provider,
+ };
+}
+
+/** Returns whether a value is a provider-managed web search definition. */
+export function isWebSearchToolDefinition(value: unknown): value is WebSearchToolDefinition {
+ return (
+ typeof value === "object" &&
+ value !== null &&
+ (value as { kind?: unknown }).kind === WEB_SEARCH_TOOL_KIND
+ );
+}
diff --git a/packages/eve/src/runtime/framework-tools/web-search.ts b/packages/eve/src/runtime/framework-tools/web-search.ts
index 98b72671c..738dec014 100644
--- a/packages/eve/src/runtime/framework-tools/web-search.ts
+++ b/packages/eve/src/runtime/framework-tools/web-search.ts
@@ -131,6 +131,127 @@ export const WEB_SEARCH_GOOGLE_OUTPUT_SCHEMA: JsonObject = {
type: "object",
};
+/**
+ * Output schema for AI Gateway's provider-managed `exaSearch` tool.
+ */
+export const WEB_SEARCH_EXA_OUTPUT_SCHEMA: JsonObject = {
+ $schema: "http://json-schema.org/draft-07/schema#",
+ anyOf: [
+ {
+ properties: {
+ costDollars: {
+ additionalProperties: false,
+ properties: {
+ search: {
+ additionalProperties: { type: "number" },
+ type: "object",
+ },
+ total: { type: "number" },
+ },
+ type: "object",
+ },
+ requestId: { type: "string" },
+ resolvedSearchType: { type: "string" },
+ results: {
+ items: {
+ properties: {
+ author: {
+ anyOf: [{ type: "string" }, { type: "null" }],
+ },
+ entities: {
+ items: {
+ properties: {
+ id: { type: "string" },
+ properties: { type: "object" },
+ type: { type: "string" },
+ version: { type: "number" },
+ },
+ required: ["id", "type", "version", "properties"],
+ type: "object",
+ },
+ type: "array",
+ },
+ extras: {
+ additionalProperties: false,
+ properties: {
+ imageLinks: {
+ items: { type: "string" },
+ type: "array",
+ },
+ links: {
+ items: { type: "string" },
+ type: "array",
+ },
+ },
+ type: "object",
+ },
+ favicon: {
+ anyOf: [{ type: "string" }, { type: "null" }],
+ },
+ highlightScores: {
+ items: { type: "number" },
+ type: "array",
+ },
+ highlights: {
+ items: { type: "string" },
+ type: "array",
+ },
+ id: { type: "string" },
+ image: {
+ anyOf: [{ type: "string" }, { type: "null" }],
+ },
+ publishedDate: {
+ anyOf: [{ type: "string" }, { type: "null" }],
+ },
+ score: {
+ anyOf: [{ type: "number" }, { type: "null" }],
+ },
+ subpages: {
+ items: {},
+ type: "array",
+ },
+ summary: { type: "string" },
+ text: { type: "string" },
+ title: {
+ anyOf: [{ type: "string" }, { type: "null" }],
+ },
+ url: { type: "string" },
+ },
+ required: ["url", "id"],
+ type: "object",
+ },
+ type: "array",
+ },
+ searchTime: { type: "number" },
+ searchType: { type: "string" },
+ },
+ required: ["requestId", "results"],
+ type: "object",
+ },
+ {
+ additionalProperties: false,
+ properties: {
+ error: {
+ enum: [
+ "api_error",
+ "rate_limit",
+ "timeout",
+ "invalid_input",
+ "configuration_error",
+ "execution_error",
+ "unknown",
+ ],
+ type: "string",
+ },
+ message: { type: "string" },
+ statusCode: { type: "number" },
+ },
+ required: ["error", "message"],
+ type: "object",
+ },
+ ],
+};
+
/**
* Output schema for AI Gateway's provider-managed `parallelSearch` tool.
*/
diff --git a/packages/eve/src/runtime/resolve-agent.ts b/packages/eve/src/runtime/resolve-agent.ts
index 22a61940b..65ebf719e 100644
--- a/packages/eve/src/runtime/resolve-agent.ts
+++ b/packages/eve/src/runtime/resolve-agent.ts
@@ -111,6 +111,7 @@ export async function resolveAgent(input: ResolveAgentInput): Promise<ResolvedAg
input.manifest.workflowTool === undefined
? undefined
: { maxSubagents: input.manifest.workflowTool.maxSubagents },
+ webSearchProvider: input.manifest.webSearchProvider,
dynamicInstructionsResolvers: resolvedDynamicInstructionsResolvers,
dynamicSkillResolvers: resolvedDynamicSkillResolvers,
dynamicToolResolvers: resolvedDynamicToolResolvers,
diff --git a/packages/eve/src/runtime/types.ts b/packages/eve/src/runtime/types.ts
index ffc1a3fac..773c978c9 100644
--- a/packages/eve/src/runtime/types.ts
+++ b/packages/eve/src/runtime/types.ts
@@ -33,6 +33,7 @@ import type { NamedSkillDefinition } from "#shared/skill-definition.js";
import type { InternalAgentDefinition } from "#shared/agent-definition.js";
import type { RuntimeDynamicModelReference } from "#runtime/agent/bootstrap.js";
import type { InternalToolDefinitionWithExecuteFn } from "#shared/tool-definition.js";
+import type { WebSearchProvider } from "#shared/web-search.js";
import type { SandboxBackend } from "#shared/sandbox-backend.js";
import type { SandboxBootstrapContext, SandboxSessionContext } from "#shared/sandbox-definition.js";
import type { ToolSchema } from "#shared/tool-schema.js";
@@ -411,6 +412,8 @@ export interface ResolvedAgent {
readonly workflowTool?: {
readonly maxSubagents?: number;
};
+ /** AI Gateway provider selected for the framework `web_search` tool. */
+ readonly webSearchProvider?: WebSearchProvider;
readonly dynamicInstructionsResolvers: readonly ResolvedDynamicInstructionsResolver[];
readonly dynamicSkillResolvers: readonly ResolvedDynamicSkillResolver[];
readonly dynamicToolResolvers: readonly ResolvedDynamicToolResolver[];
diff --git a/packages/eve/src/shared/web-search.ts b/packages/eve/src/shared/web-search.ts
new file mode 100644
index 000000000..0fd3531cd
--- /dev/null
+++ b/packages/eve/src/shared/web-search.ts
@@ -0,0 +1,2 @@
+/** Web search providers available through Vercel AI Gateway. */
+export type WebSearchProvider = "exa" | "parallel";
diff --git a/packages/eve/test/tool-defaults.test.ts b/packages/eve/test/tool-defaults.test.ts
index 38fc3c905..132e3f7da 100644
--- a/packages/eve/test/tool-defaults.test.ts
+++ b/packages/eve/test/tool-defaults.test.ts
@@ -8,7 +8,6 @@ import {
readFile,
todo,
webFetch,
- webSearch,
writeFile,
} from "../src/public/tools/defaults.js";
@@ -57,11 +56,6 @@ describe("tool defaults barrel exports", () => {
expect(webFetch.execute).toBeTypeOf("function");
});
- it("webSearch has description and execute", () => {
- expect(webSearch.description).toBeTypeOf("string");
- expect(webSearch.execute).toBeTypeOf("function");
- });
-
it("loadSkill has description and execute", () => {
expect(loadSkill.description).toBeTypeOf("string");
expect(loadSkill.execute).toBeTypeOf("function");