[ 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_free searches many engines as one and returns ranked results with their sources.
  • Read: fetch_url and scrape_url read pages and PDFs as Markdown; with a query, scrape_url returns only the passages that answer it.
  • Parse and discover: extract_url pulls structured fields from a page; map_site lists a site’s URLs; start_crawl and get_crawl read several pages.
  • Jobs, history and monitors: create_job, get_job, list_history and list_monitors for longer runs and scheduled checks.
  • Cost first: estimate prices a call before it runs, and the account tools show your credits.

Set it up#

  1. 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. 2. Install Pydantic AI with MCP support

    The MCP client ships as an extra of pydantic-ai-slim (Pydantic AI MCP client docs).

    Terminal
    pip install "pydantic-ai-slim[mcp]"
  3. 3. Add Clawifi as a toolset

    MCPToolset connects to the hosted server over Streamable HTTP. Its auth argument takes your key and sends it as Authorization: Bearer <key>. Replace your-model with a model Pydantic AI supports.

    agent.py
    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. 4. Run it

    Set CLAWIFI_API_KEY and your model provider’s key, then run the script. Without a key, only search_free, fetch_url, scrape_url and map_site run, 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#

Agent prompt

Search the web for the three most cited papers on retrieval-augmented generation, read their abstracts, and return the titles with links.

Agent prompt

Read https://pydantic.dev/docs/ai/mcp/client/ and return only the passages about authentication.

Agent prompt

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

This page as Markdown · llms.txt