통합

CrewAI

CrewAI 에이전트에 Thunderbit 기반 웹 리서치 Tool 장착하기

CrewAI 에이전트는 신선하고 깔끔한 웹 콘텐츠를 입력으로 필요로 합니다. /distill 을 CrewAI Tool 로 감싸 두면 crew 안의 어떤 Agent 든 필요할 때 URL 을 읽을 수 있습니다.

설치

pip install crewai httpx

커스텀 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"]

Crew 에 연결

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()

  • 다중 소스 리서치라면 /batch/distill 을 두 번째 Tool(read_urls) 로 노출해서 Agent 가 fan-out 할 수 있게 하세요
  • Agent 에 넘기기 전에 Markdown 을 ~8k 토큰 이내로 자르세요 —— 컨텍스트 비대화 방지

관련 문서

이 통합은 멀티 에이전트 crew 템플릿으로 확장 중입니다 —— 곧 다시 확인하세요.