DS DevShelfHub Projects · AI tools
Knowledge & RAG Page 18 of 29

CrewAI Knowledge Sources: Grounded RAG for Agent Crews

By DevShelfHub

Give agents grounded facts via knowledge sources — built-in adapters for PDF, CSV, JSON, Excel, Text, and Docling, plus full RAG configuration.

Series progress18 / 29
CrewAI knowledge tutorial — CrewAI Knowledge Sources: Grounded RAG for Agent Crews

Knowledge vs Memory vs Skills

  • Knowledge: external facts (documents) the agent retrieves at runtime.
  • Memory: what the agent learned during execution, persisted across runs.
  • Skills: instructions — how to do something (loaded from SKILL.md).

Built-in Knowledge Sources

Each is documented in detail in the reference:

Agent vs Crew Knowledge

Attach knowledge at the right scope:

  • Agent-level: Agent(knowledge_sources=[...]) — only that agent retrieves from it.
  • Crew-level: Crew(knowledge_sources=[...]) — every agent can retrieve.

Embedders

Configure once via the embedder dict on Agent or Crew. Supported providers: OpenAI, Azure OpenAI, Google AI, Google Vertex, Cohere, VoyageAI (recommended for Anthropic users), HuggingFace, Jina, Ollama (local), Bedrock, plus custom embedding_callable.

RAG Configuration

Switch the global vector backend with set_rag_config() and a QdrantConfig (or other backend); in tests call clear_rag_config() between cases so the singleton client resets cleanly.

python
from crewai.rag.config.utils import set_rag_config
from crewai.rag.qdrant.config import QdrantConfig

set_rag_config(QdrantConfig(
    qdrant_url="https://...",
    qdrant_api_key="...",
    collection_name="docs",
))

Advanced integrations can call get_rag_client() after startup configuration for direct vector-store access (bulk jobs, introspection) while keeping routine retrieval on knowledge sources.

Storage Transparency

Knowledge databases live under db_storage_path() (default ./.crewai/; override with CREWAI_STORAGE_DIR). Scoping uses hierarchical paths: /agent/researcher/, /project/alpha/self.recall() queries should stay within those prefixes.

Notes

Embedding model changes invalidate stored vectors

If you swap embedding endpoints, rebuild indexes instead of mixing vector spaces. Mixed spaces look like mysterious quality regressions.

Chunk boundaries affect citation fidelity

Tiny chunks improve precision but lose surrounding context. Tune overlap and chunk size with retrieval evals, not only cosine similarity scores.

Crew-wide versus agent-scoped knowledge has different blast radius

Shared corpora are convenient but can leak sensitive facts across roles. Scope knowledge to agents that truly need it.

Groundedness still needs output checks

RAG reduces hallucinations but does not eliminate them. Pair retrieval with guardrails that require citations or structured provenance fields.

CrewAI knowledge FAQ

What are CrewAI knowledge sources?

Knowledge sources are files, URLs, databases, or vector collections agents can retrieve from during tasks. They power grounded answers beyond model parametric memory.

Should knowledge attach to a crew or an agent?

Attach to the narrowest scope that needs it. Crew-level knowledge shares context across agents, while agent-level knowledge limits retrieval blast radius.

How do embedders work in CrewAI knowledge?

Embedders turn text chunks into vectors for similarity search. Pick models that match your languages and document types, and monitor embedding costs.

How can I reduce hallucinations with CrewAI RAG?

Use citations in task contracts, retrieve top-k with score thresholds, and add guardrails that reject answers lacking supporting chunks.

What breaks CrewAI knowledge pipelines?

Oversized chunks, stale corpora without refresh jobs, and missing ACLs on sensitive documents. Plan ingestion, access control, and re-embedding up front.

See also: DevShelfHub's CrewAI tool review for a product-level comparison, pricing notes, and links back into this tutorial series.

Quick jump: API Reference