Skip to main content
Install Caesar beside your CrewAI project:
pip install caesar-search crewai pydantic

Search tool

from typing import Type

from caesar_search import Caesar
from crewai.tools import BaseTool
from pydantic import BaseModel, Field

client = Caesar()  # reads CAESAR_API_KEY; anonymous works without a key


class CaesarSearchInput(BaseModel):
    query: str = Field(..., description="Search query")
    max_results: int = Field(5, description="Maximum results, 1-50")


class CaesarSearchTool(BaseTool):
    name: str = "caesar_search"
    description: str = "Search the web with Caesar and return ranked results with doc_id handles."
    args_schema: Type[BaseModel] = CaesarSearchInput

    def _run(self, query: str, max_results: int = 5) -> str:
        response = client.search(query, max_results=max_results, verbosity="compact")
        return response.model_dump_json()

Read tool

class CaesarReadInput(BaseModel):
    target: str = Field(..., description="Caesar doc_id or URL")
    query: str | None = Field(None, description="Optional focus question")
    max_chars: int = Field(12000, description="Maximum characters to return")


class CaesarReadTool(BaseTool):
    name: str = "caesar_read"
    description: str = "Read a Caesar doc_id or URL as clean markdown."
    args_schema: Type[BaseModel] = CaesarReadInput

    def _run(self, target: str, query: str | None = None, max_chars: int = 12000) -> str:
        response = client.read(target, query=query, max_chars=max_chars)
        return response.model_dump_json()


tools = [CaesarSearchTool(), CaesarReadTool()]
Attach tools to the agents that need web retrieval. For a research crew, give search to the planning agent and read to the evidence-gathering agent, or give both tools to a single retrieval specialist.

Feedback

Crew handoffs can lose the search_id unless you preserve it. Store it with the chosen doc_id and send feedback after the task is complete:
client.feedback("result_helpful", search_id=search_id, doc_id=doc_id)

For agents

  • Keep the search result JSON available to the crew. It contains search_id for feedback and doc_id for reading.
  • Do not ask every agent to search independently. Let one retrieval agent search, then hand off selected doc_id values.
  • Use caesar_read for evidence before making claims. Snippets are for triage; documents are for citations.
  • If your crew runtime supports MCP, the remote MCP server is the lowest-maintenance integration.