What is PDFKnowledgeSource?
PDFKnowledgeSource is the fast path for text-heavy PDFs that do not need layout reconstruction. CrewAI extracts text, splits it into embedding-sized chunks, and stores vectors alongside metadata so agents can retrieve passages during kickoff. The happy path is policies, runbooks, and whitepapers where reading order mostly matches a single column of prose.
Because extraction is lighter than Docling, tables and sidebars may interleave oddly in the chunk stream. When retrieval quality drops on financial filings or academic PDFs, switch to CrewDoclingSource so structure survives chunking. You should also align embedder choice with the rest of your knowledge stack — mixing embedding models across sources in the same agent hurts ranking consistency.
Operational costs concentrate in first-ingestion CPU and embedding calls. Lazy-load large corpora or precompute offline when cold-start latency matters for serverless crews.
When to Use
Standard PDF documents.
Use Cases
- • Policies
- • Whitepapers
- • Manuals
- • Internal runbooks under fifty pages
- • Sales one-pagers with simple layouts
Key Features
- ✓ Built-in chunking
- ✓ Default embedder
- ✓ Optional multi-file file_path lists
When NOT to Use
OCR-needed scans — use a Vision/OCR tool.
Notes
Chunk quality vs file complexity
If answers cite wrong sections, inspect retrieved chunks in verbose mode. Layout-heavy PDFs often need Docling or a pre-clean Markdown export rather than more aggressive top_k tuning.
Embeddings and costs
Every page contributes tokens to embedding bills. Deduplicate overlapping documents and strip appendices you do not want agents to quote.
Stale knowledge
Version filenames or bump a collection alias when legal text changes. Agents happily quote outdated chunks if vectors still look relevant semantically.
Import
from crewai.knowledge.source.pdf_knowledge_source import PDFKnowledgeSource
Key Parameters
| Parameter | Type | Default | Purpose |
|---|---|---|---|
| file_path | str | — | Path or list of paths to PDFs. |
Code Examples
Single policy PDF on an agent
from crewai import Agent
from crewai.knowledge.source.pdf_knowledge_source import PDFKnowledgeSource
policy = PDFKnowledgeSource(file_path='legal/refund_policy.pdf')
analyst = Agent(
role='Policy analyst',
goal='Answer refund questions with citations',
backstory='You cite only the uploaded PDF.',
knowledge_sources=[policy],
)
Batch multiple paths
src = PDFKnowledgeSource(file_path=['docs/a.pdf', 'docs/b.pdf'])
When to prefer CrewDoclingSource
# from crewai.knowledge.source.crew_docling_source import CrewDoclingSource
# src = CrewDoclingSource(file_path=['10-K.pdf']) # tables + multi-column layouts
Common Mistakes
❌ Loading huge PDFs at startup
✅ Split into smaller files or use Docling for layout-aware chunking.
PDFKnowledgeSource FAQ
What is PDFKnowledgeSource in CrewAI?
Loads, chunks, and embeds PDF documents for retrieval by agents — the default PDF RAG path before Docling. PDFKnowledgeSource is the fast path for text-heavy PDFs that do not need layout reconstruction. CrewAI extracts text, splits it into embedding-sized chunks, and stores vectors alongside metadata so agents can retrieve passages during kickoff. The happy path is policies, runbooks, and whitepapers where reading order mostly matches a single column of prose. Because extraction is lighter than Docling, tables and sidebars may interleave oddly in the chunk stream. When retrieval …
Which package defines the CrewAI class PDFKnowledgeSource?
DevShelfHub maps PDFKnowledgeSource to Python module crewai.knowledge.source (package path crewai.knowledge.source in this reference). Pin your installed crewai version and match imports to the snippet on this page.
When should I use PDFKnowledgeSource?
Standard PDF documents.
When should I avoid using PDFKnowledgeSource?
OCR-needed scans — use a Vision/OCR tool.
How do I import PDFKnowledgeSource in Python?
from crewai.knowledge.source.pdf_knowledge_source import PDFKnowledgeSource
Where can I explore more CrewAI API reference pages?
Open the CrewAI API reference index on DevShelfHub to search 58 classes, 30 methods, and 16 decorators, each with runnable examples, parameters, common mistakes, and cross-links.