Definition
A plugin for Google Genkit (the Firebase AI framework) that adds web search capabilities as a tool, enabling Genkit-based AI agents and flows to query search APIs and incorporate real-time web data into their responses.
In Depth
Google Genkit is an open-source framework for building AI-powered applications, tightly integrated with Firebase. It provides a flow-based architecture for chaining LLM calls, tools, and data retrieval. Search plugins extend Genkit with web search capabilities that agents can call during flow execution.
Plugin architecture: Genkit plugins export tool definitions that the framework registers. A search plugin defines a 'webSearch' tool with input schema (query, platform, num_results) and an execute function that calls the search API. During flow execution, the LLM can invoke this tool when it needs web data.
Implementation with Scavio: the plugin wraps Scavio's REST API as a Genkit tool. Configuration requires the API key and default parameters. The tool accepts a query string and optional platform parameter, calls api.scavio.dev/api/v2/google, and returns structured results. Cost: $0.005/query, same as direct API usage.
Genkit's advantage over raw API calls: (1) Observability -- Genkit's developer UI shows tool call traces, including search queries, response times, and result counts. (2) Testing -- Genkit flows can be tested with mock tool responses without making real API calls. (3) Deployment -- Genkit flows deploy to Firebase Cloud Functions, scaling automatically. (4) Caching -- Genkit's flow system can cache tool results to avoid duplicate queries.
Genkit vs LangChain for search integration: Genkit is simpler (fewer abstractions) and Firebase-native. LangChain has more pre-built integrations but more complexity. For Firebase/GCP teams, Genkit is the natural choice.
Example Usage
// Genkit search plugin definition (TypeScript) import { defineTool } from '@genkit-ai/ai'; import { z } from 'zod'; // Scavio has one endpoint per product: there is no dispatcher URL and no // "platform" request parameter. const ENDPOINTS = { google: "https://api.scavio.dev/api/v2/google", }; const webSearch = defineTool( { name: 'webSearch', description: 'Search the web via Scavio', inputSchema: z.object({ query: z.string() }), outputSchema: z.any() }, async (input) => { const res = await fetch(ENDPOINTS.google, { method: 'POST', headers: { Authorization: `Bearer ${process.env.SCAVIO_KEY!}`, 'Content-Type': 'application/json' }, body: JSON.stringify(input), }); return res.json(); } );
Platforms
Genkit Search Plugin is relevant across the following platforms, all accessible through Scavio's unified API:
- Amazon
- YouTube