Overview
AutoRAG is Cloudflare’s fully managed RAG service - the easiest way to do retrieval-augmented generation. Just point it to an R2 bucket and it handles everything automatically:- ✅ Automatic document ingestion from R2 buckets
- ✅ Automatic chunking with smart splitting
- ✅ Automatic embedding via Workers AI
- ✅ Automatic indexing in Vectorize
- ✅ Continuous monitoring and updates
- ✅ Supports PDFs, images, text, HTML, CSV, and more
Quick Example
Setup
1. Configure in wrangler.toml
2. Upload Documents to R2
- Detects new files in R2
- Extracts text content
- Chunks documents
- Generates embeddings
- Indexes in Vectorize
Configuration
Modes
Answer Mode (Recommended)
Returns an AI-generated answer grounded in retrieved documents:Results Mode
Returns raw search results without generation:Supported File Types
AutoRAG automatically handles:- Text:
.txt,.md,.csv - Documents:
.pdf,.docx - Code:
.js,.ts,.py,.go, etc. - Web:
.html,.xml - Images:
.jpg,.png(with OCR)
Complete Example
Advantages
vs. Manual Vectorize-RAG:- ✅ No manual chunking code
- ✅ No embedding generation code
- ✅ No indexing logic
- ✅ Automatic updates when R2 files change
- ✅ Built-in monitoring
- ✅ No data egress - stays in Cloudflare
- ✅ Lower latency - edge-native
- ✅ No extra costs - bundled pricing
- ✅ Integrated with Workers
Best Practices
- Organize R2 bucket - Use folders for categories
- Descriptive filenames - Used in metadata
- Monitor bucket size - AutoRAG has limits
- Use answer mode - Better UX than raw results
- Set appropriate topK - Balance speed vs. completeness
- Test queries - Verify retrieval quality
Limitations
- Bucket size: Check AutoRAG pricing for limits
- File size: Individual files have size limits
- Update latency: New files indexed within minutes
- Query rate: Standard Workers rate limits apply

