Integrationen

CrewAI

Gib CrewAI-Agents ein Thunderbit-gestütztes Web-Recherche-Tool

CrewAI-Agents brauchen frischen, sauberen Webinhalt als Input. Verpacke /distill als CrewAI-Tool, damit jeder Agent in der Crew bei Bedarf URLs lesen kann.

Installation

pip install crewai httpx

Custom Tool

from crewai.tools import BaseTool
import httpx

API = "https://openapi.thunderbit.com/openapi/v1"
H = {"Authorization": "Bearer YOUR_API_KEY"}

class ReadUrlTool(BaseTool):
    name: str = "read_url"
    description: str = (
        "Fetch a URL and return clean Markdown. Use for any web research task: "
        "docs, articles, product pages, search results."
    )

    def _run(self, url: str) -> str:
        resp = httpx.post(f"{API}/distill",
                          headers=H,
                          json={"url": url, "renderMode": "basic"},
                          timeout=60.0)
        resp.raise_for_status()
        return resp.json()["data"]["markdown"]

In eine Crew einbinden

from crewai import Agent, Task, Crew

researcher = Agent(
    role="Web Researcher",
    goal="Gather authoritative information from public web pages",
    backstory="Skilled at distilling long pages into key facts.",
    tools=[ReadUrlTool()],
)

task = Task(
    description="Research how vector databases compare in 2026.",
    expected_output="A concise comparison table.",
    agent=researcher,
)

Crew(agents=[researcher], tasks=[task]).kickoff()

Tipps

  • Für Multi-Source-Recherche stelle /batch/distill als zweites Tool (read_urls) bereit, damit der Agent fan-out machen kann
  • Begrenze zurückgegebenes Markdown auf ~8k Tokens, bevor du es dem Agent reichst — vermeide Context-Aufblähung

Verwandt

Diese Integration wird mit Multi-Agent-Crew-Templates erweitert — schau bald wieder vorbei.