crewAI-tools icon indicating copy to clipboard operation
crewAI-tools copied to clipboard

feat: Add a tool to search a Chroma database

Open kylediaz opened this issue 4 months ago • 5 comments

Hello from the Chroma team 👋

This adds a basic tool that lets agents query their data in Chroma.

We also unpinned the chromadb version. Ideally, we'd like to get you on >1.0.0 because CrewAI uses ChromaDB for short-term memory. Since we rewrote it in rust, upgrading to 1.0.0 should make Chroma 4x faster, instantly.

import chromadb
from crewai_tools import ChromaSearchTool

client = chromadb.PersistentClient(path="./chroma_db")
collection = client.get_or_create_collection(name="my_documents")

tool = ChromaSearchTool(
    collection=collection,
)

kylediaz avatar Aug 19 '25 22:08 kylediaz

@kylediaz I think bumping to > 1.0.0 is currently blocked by the embedchain dependency

greysonlalonde avatar Aug 28 '25 15:08 greysonlalonde

Hey @kylediaz , could you record a Loom showing this tool in action with a Crew?

uv init
uv add chromadb crewai
cd [crewai-tools repo]
uv pip install -e .
import os
import crewai
from crewai_tools import ChromaSearchTool
import chromadb

client = chromadb.CloudClient(
  api_key=os.getenv('CHROMA_API_KEY'),
  tenant=os.getenv('CHROMA_TENANT'),
  database='test-db'
)

collection = client.get_collection(name="demo-data-upload")

search_tool = ChromaSearchTool(collection=collection)


rag_agent = crewai.Agent(
    role="RAG Agent",
    goal="You are a helpful assistant that can answer questions about the documents in the collection.",
    backstory="You are a helpful assistant that can answer questions about the documents in the collection.",
    verbose=True,
    model='openai/gpt-4o',
    api_key=os.getenv('OPENAI_API_KEY'),
    tools=[search_tool],
)

task = crewai.Task(
    description="Answer the question: Tell me about the user's preferences?",
    expected_output="The user's preferences",
    agent=rag_agent,
)

crew = crewai.Crew(
    agents=[rag_agent],
    tasks=[task],
    verbose=True,
)

crew.kickoff()

https://github.com/user-attachments/assets/d00a6ee5-7ce4-4aed-85da-a7eb3e867571

kylediaz avatar Aug 28 '25 18:08 kylediaz

bump on this

kylediaz avatar Sep 16 '25 00:09 kylediaz

@lucasgomide hi! bump on this :)

kylediaz avatar Oct 01 '25 19:10 kylediaz

@lucasgomide @greysonlalonde bump!

kylediaz avatar Oct 15 '25 20:10 kylediaz