feat: add Exa AI-powered search tool#310
Open
tgonzalezc5 wants to merge 1 commit into
Open
Conversation
Adds an `ExaSearchTool` that lets agents query the open web through the Exa AI search API. The tool follows the same `BaseTool` pattern as `LoadMemoryTool`: a `_getDeclaration` describing the call schema and a client-side `runAsync` that hits the API and returns structured results. Authentication uses the `EXA_API_KEY` environment variable or an `apiKey` constructor option. The tool exposes search type, category, domain/text filtering, date ranges, and configurable per-result content (highlights/text/summary) with graceful snippet fallback.
|
Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA). View this failed invocation of the CLA check for more information. For the most up to date status, view the checks section at the bottom of the pull request. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
ExaSearchTool, a client-sideBaseToolthat searches the open web via the Exa AI search API. It complements the existingGoogleSearchToolandVertexAiSearchTool, which are server-side Gemini built-ins, by giving agents a model-agnostic search option that returns structured results the model can read directly.type(auto/fast/neural/hybrid/instant),numResults,category, domain and text include/exclude filters, published-date ranges, and per-resultcontents(highlights, text, summary) with snippet fallback.EXA_API_KEYenvironment variable or an explicitapiKeyon the constructor; the SDK client is created lazily so the tool can be instantiated without a key.Usage
The model can also pass per-call options to refine the query, e.g.
category: 'research paper',includeDomains: ['arxiv.org'], or a date range.Files changed
core/src/tools/exa_search_tool.ts— new tool, schema declaration, and response normalization with highlights → summary → text snippet fallback.core/src/common.ts— exportsExaSearchTooland its public types.core/test/tools/exa_search_tool_test.ts— vitest unit tests covering the function declaration schema, missing-key error, default + per-call argument forwarding,numResultsclamping, snippet fallback, query validation, and env-var fallback.core/package.json/package-lock.json— addexa-jsdependency.Test plan
npx vitest run --project unit:core core/test/tools/exa_search_tool_test.ts(8 / 8 passing)npx vitest run --project unit:core core/test/tools/— all 22 tool test files (150 tests) pass, no regressionsnpx eslint core/src/tools/exa_search_tool.ts core/test/tools/exa_search_tool_test.ts— cleannpx prettier --checkon the new files — cleannpm run build— succeeds