ChromaDB Async
Insert knowledge and run an agent with ainsert() and aprint_response() on a ChromaDB backend.
Code
import asyncio
from agno.agent import Agent
from agno.knowledge.knowledge import Knowledge
from agno.vectordb.chroma import ChromaDb
vector_db = ChromaDb(collection="recipes", path="tmp/chromadb", persistent_client=True)
knowledge = Knowledge(
vector_db=vector_db,
)
agent = Agent(knowledge=knowledge)
if __name__ == "__main__":
asyncio.run(
knowledge.ainsert(url="https://docs.agno.com/agents/overview.md")
)
asyncio.run(
agent.aprint_response("What is the purpose of an Agno Agent?", markdown=True)
)Usage
Set up your virtual environment
uv venv --python 3.12
source .venv/bin/activateInstall dependencies
uv pip install -U chromadb pypdf openai agnoSet environment variables
export OPENAI_API_KEY=xxxRun Agent
python async_chroma_db.py