Pydantic AI Integration
Scavio ships as a search tool for Pydantic AI via the pydantic-scavio package. Install it, add scavio_search_tool() to an Agent, and the model gets live Google results as clean, typed JSON — a cost-effective Tavily and SerpAPI alternative at 1 credit per search.
Typed results
list[ScavioSearchResult] — a validated TypedDict with position, title, url, domain, content, and date — so downstream code and the model always see the same shape.Introduction
The pydantic-scavio package wraps Scavio's Google Search (v2) endpoint as a Pydantic AI Tool. Before you start you need:
- Pydantic AI:
pydantic-aiorpydantic-ai-slim(Python 3.10+). - A Scavio API key from dashboard.scavio.dev (50 free signup credits, no credit card).
Step-by-Step Integration Guide
Step 1: Install
pip install pydantic-scavioStep 2: Set your API key
export SCAVIO_API_KEY=sk_live_your_keyStep 3: Basic usage
import os
from pydantic_ai import Agent
from pydantic_scavio import scavio_search_tool
agent = Agent(
"openai:gpt-5.5",
tools=[scavio_search_tool(os.environ["SCAVIO_API_KEY"])],
system_prompt="Search the web when you need current information.",
)
result = agent.run_sync("What changed in the latest Pydantic AI release?")
print(result.output)Fixing parameters for the agent
Parameters passed to the factory are fixed for every search and hidden from the LLM's tool schema. Parameters left unset stay available for the model to set per call.
# Always search from the US in English; the LLM only controls the query.
tool = scavio_search_tool(
os.environ["SCAVIO_API_KEY"],
country_code="us",
language="en",
)Sharing a client
Pass an existing AsyncScavioClient to share connection pooling and rate limiting across tools:
from scavio import AsyncScavioClient
from pydantic_scavio import scavio_search_tool
client = AsyncScavioClient(api_key=os.environ["SCAVIO_API_KEY"])
tool = scavio_search_tool(client=client)Result shape
| Field | Type | Description |
|---|---|---|
position | int | Rank of the result on the page |
title | str | Result title |
url | str | Result URL |
domain | str | Result domain |
content | str | Snippet |
date | str | None | Publication date when available |
Use every endpoint via MCP
For the full Scavio API (YouTube, Amazon, Walmart, Reddit, TikTok, Instagram, and all Google surfaces) with no extra install, point Pydantic AI at the hosted MCP server:
from pydantic_ai import Agent
from pydantic_ai.mcp import MCPServerStreamableHTTP
server = MCPServerStreamableHTTP(
url="https://mcp.scavio.dev/mcp",
headers={"x-api-key": "sk_live_..."},
)
agent = Agent("openai:gpt-5.5", toolsets=[server])Benefits of Scavio + Pydantic AI
- Typed end to end: validated results that match Pydantic AI's type-safe philosophy.
- Schema control: developer-fixed parameters never leak into the LLM tool schema.
- Cost-effective: 1 credit per search, full results.
- One key, every platform: the same account covers 46 MCP tools across 7 platforms.