Overview
The@nimble-way/ai-sdk package provides a pre-built tool for Vercel’s AI SDK v6, making it easy to add real-time web search to your AI applications. Register nimbleSearch() on an agent and the model decides when to search, runs the query through Nimble, and gets back clean, structured results to cite.
- One tool, zero boilerplate — drop
nimbleSearch()into your agent and you’re done. - Works with any model — OpenAI, Anthropic, Google, and others supported by the AI SDK.
- Two search depths —
litefor fast metadata,deepfor full page content. - Type-safe — written in TypeScript with typed options and output.
v1 ships Web Search only. Extract, Map, Crawl, and Agents are planned as follow-ups.
Quick Start
Install
ai (v6) and zod are peer dependencies. The examples use OpenAI via @ai-sdk/openai, but nimbleSearch works with any AI SDK model provider.Set your API keys
Get a Nimble key from the dashboard (free trial available), then set both keys:You can also pass the Nimble key inline:
nimbleSearch({ apiKey: '...' }).How it works
The model receives the tool
nimbleSearch() registers a webSearch tool the model can call when it needs current information.The model decides to search
When the prompt needs live data, the model emits a tool call with a
query (and optional maxResults).Nimble runs the search
The query goes to Nimble’s Web Search API, which returns clean, structured results.
Next.js route handler
For a streaming chat app, swapgenerateText for streamText inside a route handler and return toUIMessageStreamResponse(). The client connects with the AI SDK useChat hook — no extra wiring needed.
Configuration options
ConfigurenimbleSearch() once; the model only ever supplies { query, maxResults? }.
apiKey
apiKey
Nimble API credentials. Defaults to
process.env.NIMBLE_API_KEY.searchDepth
searchDepth
'lite' returns metadata only (fast); 'deep' returns full page content. Default 'lite'.maxResults
maxResults
Default number of results per search. Type
number, default 5.maxResultsCap
maxResultsCap
Hard upper limit on results the model can request. Type
number, default 10.maxContentLength
maxContentLength
Per-result content truncation, in characters. Type
number, default 10_000.country
country
Two-letter country code for localization. Type
string, default 'US'.locale
locale
Language preference. Type
string, default 'en'.client
client
Injectable
NimbleSearchClient for testing. Optional.Response shape
Each tool call returns a structured result the model can reason over:Limitations
- Web Search only in v1 — Extract, Map, Crawl, and Agents are planned follow-ups.
- No built-in answer generation — the tool returns results; the model writes the answer.
- Node.js runtime (≥18) is the supported target; edge/serverless compatibility is unverified.
Resources
npm Package
@nimble-way/ai-sdk on npm.GitHub Repository
Source, README, and issues.
Web Search API
Nimble’s underlying search capability.
Example Cookbook
Runnable integration examples.