[ clawifi for pydantic ai ]
Web search and page reading for Pydantic AI
Give a Pydantic AI agent Clawifi’s MCP tools in a few lines, and it can search the web, read pages and PDFs, and get back the passages that answer each question, with sources.
What Clawifi gives Pydantic AI#
Pydantic AI agents call the tools you hand them. Clawifi’s hosted MCP server is one toolset: web search, page reading and passage selection, so you do not write and maintain your own fetchers.
- Search:
search_freesearches many engines as one and returns ranked results with their sources. - Read:
fetch_urlandscrape_urlread pages and PDFs as Markdown; with aquery,scrape_urlreturns only the passages that answer it. - Parse and discover:
extract_urlpulls structured fields from a page;map_sitelists a site’s URLs;start_crawlandget_crawlread several pages. - Jobs, history and monitors:
create_job,get_job,list_historyandlist_monitorsfor longer runs and scheduled checks. - Cost first:
estimateprices a call before it runs, and the account tools show your credits.
Set it up#
1. Get an API key
Create an account at clawifi.dev/signup. The Free plan includes 1,000 credits a month. Copy the key the console shows you (it is shown once) and keep it in an environment variable,
CLAWIFI_API_KEY.2. Install Pydantic AI with MCP support
The MCP client ships as an extra of
pydantic-ai-slim(Pydantic AI MCP client docs).pip install "pydantic-ai-slim[mcp]"3. Add Clawifi as a toolset
MCPToolsetconnects to the hosted server over Streamable HTTP. Itsauthargument takes your key and sends it asAuthorization: Bearer <key>. Replaceyour-modelwith a model Pydantic AI supports.import asyncio import os from pydantic_ai import Agent from pydantic_ai.mcp import MCPToolset clawifi = MCPToolset("https://api.clawifi.dev/mcp", auth=os.environ["CLAWIFI_API_KEY"]) agent = Agent("your-model", toolsets=[clawifi]) async def main(): result = await agent.run("Search the web for the MCP specification and summarise it with sources.") print(result.output) asyncio.run(main())4. Run it
Set
CLAWIFI_API_KEYand your model provider’s key, then run the script. Without a key, onlysearch_free,fetch_url,scrape_urlandmap_siterun, as a trial: 12 calls a minute and 50 a day per address. The other tools are still listed, but calling one without a key fails with an authorization error, so add your key before you rely on them.
Sources for this setup: Remote MCP · Pydantic AI MCP client docs. Clawifi works with Pydantic AI; it is not affiliated with its makers.
Example prompts#
Search the web for the three most cited papers on retrieval-augmented generation, read their abstracts, and return the titles with links.
Read https://pydantic.dev/docs/ai/mcp/client/ and return only the passages about authentication.
Map https://docs.python.org/3/library/ and list the first 20 URLs, then read the asyncio page and summarise it.
Questions#
How do I use Clawifi tools in Pydantic AI?
Install pydantic-ai-slim[mcp], create MCPToolset("https://api.clawifi.dev/mcp", auth=<your key>), and pass it to Agent(..., toolsets=[...]). The connection opens when the agent runs.
My other toolsets use the same tool names. What now?
Call .prefixed("clawifi") on the toolset, and the tools become clawifi_search_free, clawifi_fetch_url and so on.
Can I use the Python SDK instead of MCP?
Yes. pip install clawifi includes a Python client you can wrap in your own tools; see SDK and CLI. MCP saves you writing the wrappers.
What does it cost?
Each tool call is billed like the API route it runs: most cost 1 credit and a browser render 3. Cache hits, failures on Clawifi’s side and answers with nothing to read (a blocked page, a JavaScript shell, a 404) cost 0. The Free plan includes 1,000 credits a month. See Pricing.
Other agents and frameworks#
Next: Integrations · Docs · Pricing