Skip to main content
We explain how to integrate Ceramic Search with CrewAI by building a two-agent crew: one that researches a topic using Ceramic search and one that writes an article from those results.

Setup

1. Installation

Install CrewAI and the Ceramic Python SDK:
pip install crewai 'crewai[tools]' ceramic_ai

2. API key

Obtain and set your Ceramic API key:

Get API Key

Create a Ceramic account for free to get an API key.
export CERAMIC_API_KEY=your_api_key_here
To persist it across sessions, add the line above to your ~/.zshrc, ~/.bashrc, or equivalent. Also set up any additional API keys you need, e.g., OpenAI:
export OPENAI_API_KEY=your_api_key_here

3. Define a custom Ceramic tool

Use the CrewAI @tool decorator to wrap the Ceramic SDK. Initialize the client, run a search, and return formatted results the agent can reason over.
from crewai.tools import tool
from ceramic_ai import Ceramic
import os

ceramic_api_key = os.getenv("CERAMIC_API_KEY")

@tool
def ceramic_search_tool(question: str) -> str:
    """
    Search the web using Ceramic.
    Use for accurate current information — news, prices, recent events, documentation, general fact checking.
    Returns up to 10 ranked results with titles, URLs, and descriptions.
    Ceramic matches exact keywords — it does not interpret natural language or synonyms automatically. Queries must be keyword-based.
    Keyword query conversion rules:
    - Queries must be 2-8 words
    - Extract specific entities, topics, locations, and dates
    - Replace conversational phrasing with concrete keywords
    - Do not include uninformative words such as articles (the, a, an). Avoid prepositions (on, about, in, for, of, at, by, with) unless they are within established phrases or names (United States of America, Into the Wild).
    - Include relevant synonyms explicitly when terminology is ambiguous
    - Keep word order meaningful (`house cat` and `cat house` return different results)
    - Good keyword query examples:
        - "2026 Super Bowl halftime performer"
        - "climate change effects global warming impact"
        - "beginner investing strategies stocks bonds basics"
    If the search returns no useful results, retry with a more specific keyword query.
    """

    client = Ceramic(api_key=ceramic_api_key)
    response = client.search(query=question)

    parsed = ''.join([
        f'<Title id={idx}>{r.title}</Title>'
        f'<URL id={idx}>{r.url}</URL>'
        f'<Description id={idx}>{r.description[:300]}</Description>'
        for idx, r in enumerate(response.result.results)
    ])

    return parsed

4. Set up agents

Import the relevant CrewAI modules and assign ceramic_tools to the custom search function defined above.
from crewai import Task, Crew, Agent

ceramic_tools = ceramic_search_tool
Define two agents — one to research using Ceramic search, another to write an article from those results:
researcher = Agent(
    role='Researcher',
    goal='Get the latest information on {topic}',
    verbose=True,
    memory=True,
    backstory=(
        "Driven by curiosity, you're at the forefront of"
        "innovation, eager to explore and share knowledge."
    ),
    tools=[ceramic_tools],
    allow_delegation=False
)

writer = Agent(
    role='Writer',
    goal='Write a great article on {topic}',
    verbose=True,
    memory=True,
    backstory=(
        "Driven by a love of writing, you are eager to"
        "share knowledge clearly and engagingly."
    ),
    tools=[ceramic_tools],
    allow_delegation=False
)

5. Define tasks and create the crew

Assign tasks to each agent and assemble them into a crew:
research_task = Task(
    description=(
        "Identify the latest information on {topic}. "
        "Your final report should clearly articulate the key points."
    ),
    expected_output='A comprehensive 3 paragraph report on {topic}.',
    tools=[ceramic_tools],
    agent=researcher,
)

write_article = Task(
    description=(
        "Write an article on the latest findings about {topic}."
        "Your article should be engaging, informative, and accurate."
    ),
    expected_output='A comprehensive 3 paragraph article on {topic}.',
    agent=writer,
)

crew = Crew(
    agents=[researcher, writer],
    tasks=[research_task, write_article],
    memory=True,
    cache=True,
    max_rpm=100,
    share_crew=True
)

6. Kick off the crew

Provide a topic as input and run the crew:
response = crew.kickoff(inputs={'topic': 'California rental laws'})

print(response)

7. Output

Ceramic’s search results enrich the agent’s output with relevant, up-to-date sources:
California’s rental laws in 2026 have undergone significant updates aimed at
strengthening tenant protections and ensuring fair landlord practices amid the
state’s ongoing housing challenges. Central to these changes is the continued
influence of the California Tenant Protection Act of 2019, which maintains
strict statewide rent control measures. This law limits annual rent increases
and shields tenants from unjust evictions, cementing California’s position as
one of the most tenant-friendly states in the nation. Furthermore, cities such
as Oakland and San Leandro supplement these protections with their own local
rent control ordinances, requiring landlords to navigate a complex regulatory
environment that balances tenant rights with landlord obligations.

[response continues]

CrewAI docs

View CrewAI documentation

PyPI

View Ceramic Python SDK