AI stacks
Type-safe agents with Piloterr scraping tools
Build Pydantic AI agents that call Piloterr REST APIs as typed tools. Get structured JSON from protected sites with validated inputs, outputs, and dependency injection.
- Typed @agent.tool functions with Pydantic models
- Async-friendly HTTP calls to Piloterr
- Structured JSON ideal for validated agent outputs
- Anti-bot bypass without browser maintenance
At a glance
Typed
tool I/O
400+
data sources
Async
HTTP ready
REST
HTTP API
Why connect Pydantic AI
Validated tool contracts
Define Pydantic input/output models for each Piloterr endpoint, catch bad payloads before they hit the API.
Modern Python agents
Lightweight agent runtime with first-class async support for I/O-bound scrape calls.
Dependency injection
Inject API keys and HTTP clients via RunContext, clean secrets handling in production.
Reliable web data
Agents consume Piloterr JSON instead of parsing HTML, fewer hallucinations, better citations.
Pydantic AI + Piloterr use cases
Production Python agents powered by live web data.
Research agents
Typed news and SERP tools feed summarized answers with source metadata.
Enrichment services
API endpoint that enriches leads via LinkedIn and company scrapes.
Monitoring agents
Scheduled runs compare scrape outputs and emit structured alerts.
Internal copilots
Slack or CLI bots backed by Piloterr tools with strict schemas.
Why Pydantic AI + Piloterr
| Approach | DIY | Piloterr |
|---|---|---|
| Untyped requests tools | Schema drift, runtime errors | Pydantic-validated I/O |
| DIY httpx scrapers | Blocked on WAF targets | Managed bypass |
| Raw dict responses | Agent misreads fields | Stable JSON schemas |
| Heavy agent frameworks | Complex setup | Minimal tool wrapper |
Connect Pydantic AI in four steps
Step 1
Install Pydantic AI
pip install pydantic-ai httpx
Step 2
Get your API key
Set PILOTERR_API_KEY in your environment.
Get your API keyStep 3
Register Piloterr tools
Add @agent.tool functions that call REST endpoints and return typed models.
Step 4
Run the agent
agent.run_sync() or await agent.run(), the model picks tools when live data is needed.
Workflow recipes
Typed enrichment API
FastAPI route runs a Pydantic AI agent with LinkedIn + company tools.
Async research bot
Concurrent httpx calls to multiple Piloterr endpoints in one agent run.
Validated monitoring job
Cron invokes agent that outputs a Pydantic alert model when prices change.
CLI research assistant
Terminal copilot with strict output schema for weekly market intel.
When to pick Pydantic AI vs other frameworks
Scenario
Type-safe Python agents
Recommendation: Pydantic AI
Scenario
Multi-role agent crews
Recommendation: CrewAI
Scenario
Graphs with checkpoints
Recommendation: LangGraph
Scenario
IDE coding assistants
Recommendation: MCP
Pydantic AI tool example
A typed agent with a Google News tool via Piloterr.
import os
import httpx
from pydantic import BaseModel
from pydantic_ai import Agent, RunContext
PILOTERR_KEY = os.environ["PILOTERR_API_KEY"]
BASE = "https://api.piloterr.com/v2"
class NewsQuery(BaseModel):
query: str
location: str = "Paris, FR"
agent = Agent(
"openai:gpt-4.1-mini",
system_prompt="You are a research assistant with web scraping tools.",
)
@agent.tool
async def search_google_news(ctx: RunContext[None], params: NewsQuery) -> dict:
"""Search Google News for recent articles."""
async with httpx.AsyncClient(timeout=60) as client:
response = await client.post(
f"{BASE}/google/news",
headers={"x-api-key": PILOTERR_KEY, "Content-Type": "application/json"},
json={"query": params.query, "location": params.location, "page": 1},
)
response.raise_for_status()
return response.json()
result = agent.run_sync("What are the latest AI regulation headlines in France?")
print(result.output)Transparent credit pricing
Pay only for successful requests. Start with +500 credits, then scale with plans from $49/mo.
Premium
$49/mo
18,000 credits
Premium+
$99/mo
40,000 credits
Startup
$249/mo
110,000 credits