unlob for CrewAI
Multi-agent crews benefit unusually from filtered retrieval — a researcher agent and a fact-checker agent want genuinely different corroboration thresholds.
import os, requests
from crewai.tools import BaseTool
BASE = "https://api.unlob.com"
HEADERS = {"x-api-key": os.environ["UNLOB_API_KEY"]}
class UnlobSearch(BaseTool):
name: str = "web_search"
description: str = "Search the web. Metadata-only hits with trust signals."
min_sources: int = 1 # raise this for a fact-checking agent
def _run(self, query: str) -> list[dict]:
r = requests.get(f"{BASE}/search", headers=HEADERS, timeout=10,
params={"q": query, "limit": 8, "collapse": "story",
"min_independent_sources": self.min_sources})
r.raise_for_status()
return r.json()["results"]
researcher_tool = UnlobSearch(min_sources=1) # broad
checker_tool = UnlobSearch(min_sources=3) # corroborated onlySetup
Get an API key
10,000 free requests a month.
Subclass BaseTool
One tool class, parameterised by the filters each role needs.
Vary thresholds by role
A researcher wants breadth; a fact-checker should only see claims carried by several independent hosts. Same API, different floor.
Assign per agent
Give each agent the configured instance rather than a shared one.
Worth knowing
- Varying min_independent_sources per role is the cheapest way to give a crew genuinely different epistemics.
- Watch your quota — crews multiply calls quickly. /account reports usage against quota.
Frequently asked questions
How many requests will a crew use?
More than you expect — each agent searches independently, often several times per task. Monitor /account, and consider raising min_quality to reduce follow-up searches caused by poor first results.
Get a key and connect it
10,000 requests a month, no card. The config above works unchanged once you have a key.