Search for autonomous research agents
Give your agent a primitive it can call dozens of times per task.
Builders of autonomous research agents — deep research products, OSINT tools, AI analysts — where the LLM plans its own search sequence to answer multi-hop questions.
Start with this shape.
Paste, run, ship.
import os, json, anthropic, requests
claude = anthropic.Anthropic()
HEADERS = {"Authorization": f"Bearer {os.environ['SIFTQ_API_KEY']}"}
def siftq(q: str, scope: str = "webpage", size: int = 10) -> list[dict]:
r = requests.post(
"https://api.siftq.com/v1/search",
headers=HEADERS,
json={"q": q, "scope": scope, "size": str(size)},
timeout=15,
)
r.raise_for_status()
data = r.json()
return data.get("webpages") or data.get("scholars") or data.get("podcasts") or []
TOOLS = [{
"name": "search",
"description": "Search the web. Use scope=scholar for papers, news for recency.",
"input_schema": {
"type": "object",
"required": ["q"],
"properties": {
"q": {"type": "string"},
"scope": {"type": "string", "enum": ["webpage", "news", "scholar"]},
},
},
}]
def research(topic: str, max_steps: int = 8) -> str:
messages = [{"role": "user", "content": f"Research: {topic}"}]
for _ in range(max_steps):
resp = claude.messages.create(
model="claude-sonnet-4-6", max_tokens=2048,
tools=TOOLS, messages=messages,
)
if resp.stop_reason == "end_turn":
return resp.content[0].text
for block in resp.content:
if block.type == "tool_use":
hits = siftq(block.input["q"], block.input.get("scope", "webpage"))
messages.extend([
{"role": "assistant", "content": resp.content},
{"role": "user", "content": [{"type": "tool_result",
"tool_use_id": block.id,
"content": json.dumps(hits[:5])}]},
])
return "Step budget exhausted."
print(research("How has GPU pricing evolved in 2024-2025?"))- ✓Sub-180ms p50 keeps multi-step agents feeling responsive
- ✓One auth scheme covers web / scholar / news / podcast / video
- ✓Predictable per-query pricing — agents can budget search calls
- ✓Long-tail accuracy (Seal-0) wins on the obscure follow-ups agents always end up asking
Likely questions.
How many searches will a typical agent task make?
Deep research agents commonly fire 15-40 searches per task — initial breadth scan, follow-ups, cross-references, verification. Plan your free-tier or paid budget accordingly.
Should the agent pick the scope, or should I hard-code it?
Let the agent pick. Expose scope as a tool parameter with a brief description; modern models (Claude 4.x, GPT-5) reliably pick scholar for academic questions, news for "what happened", webpage for everything else.
How do I stop runaway tool calls?
Set a hard step budget (e.g. 12 search calls max) and a hard cost cap per task. If your agent hits the cap, fail fast and ask the user for narrower direction.
Try it on your
real workload.
The free tier covers most prototypes. No credit card.