🟡 Intermediate 10 min read RAG Training

RAG Training Best Practices: How to Feed Your Agents the Right Knowledge

RAG training is simple — upload files and your agent gets smarter. But the difference between an agent that's "okay" and one that's genuinely useful comes down to what you feed it, how you structure it, and how you maintain it over time.

Best for

Anyone managing AI agents on CEO.ai — CEOs, ops leads, or developers

Prerequisite

Basic familiarity with CEO.ai agents. New to RAG? Start with What Is RAG Training?

1

The Quality Hierarchy: Not All Documents Are Equal

The single most important principle in RAG training:

The quality of your agent's output will never exceed the quality of the knowledge you give it.

This sounds obvious. In practice, most people ignore it. They upload everything they have, assume the AI will "figure it out," and then wonder why the agent gives inconsistent or mediocre answers.

The truth is that RAG training has a quality hierarchy. Some documents produce dramatically better results than others — not because of their format, but because of their content characteristics.

Tier 1: High-Value Documents

Upload these first

These are the documents that have the biggest impact on agent output quality.

Characteristics:

  • Written clearly and specifically — not vague, not jargon-heavy
  • Factually current and accurate as of today
  • Authoritative — the definitive source of truth
  • Self-contained — doesn't require reading 5 other documents to make sense
  • Specific to what the agent does

Examples:

  • Your current pricing guide (with actual numbers, terms, and conditions)
  • Standard operating procedures that are actively followed
  • Product documentation reviewed in the last 6 months
  • The 3 best proposals your team has written in the past year
  • Your actual refund/return/SLA policy (the customer-facing one)
  • KPI definitions with specific formulas and data sources
Why they're high-value: These documents give the agent unambiguous, accurate source material. When retrieved, the content is clear enough that the agent can use it directly — without interpreting ambiguity.

Tier 2: Good Documents

Upload after Tier 1

Generally accurate but may have some sections that are dated. Well-structured but longer than necessary. Comprehensive reference material that the agent may only need parts of.

Examples:

  • Knowledge base articles (most are good, some may be outdated)
  • Past reports that show format and structure
  • Training materials for team members
  • Industry analysis documents
  • Competitor research within the past year
  • Meeting notes from strategic planning sessions
Why they're good (not great): These documents contain valuable information, but the agent has to work harder to extract the relevant parts. More noise in the input means slightly less precision in the output.

Tier 3: Low-Value Documents

Upload selectively or not at all

Outdated, contradicted by newer information, poorly written, ambiguous, or internally inconsistent. Extremely long with minimal information density. Raw data without context. Duplicates or near-duplicates.

Examples:

  • Draft documents that were never finalized
  • Policies from 2 years ago that have since been updated
  • Internal emails or chat logs (too informal, too context-dependent)
  • Massive spreadsheets with no column headers or context
  • Documents that say "TBD" or "placeholder" in key sections
  • Multiple versions of the same document (proposal_FINAL_FINAL)
Why they're low-value: These documents introduce noise, contradictions, and ambiguity. When the agent retrieves a chunk saying your refund window is 30 days — but your current policy says 60 days — the agent may give the wrong answer. Bad input creates bad output.

The Practical Implication

Before uploading anything, ask yourself:

"If a new hire found this document and treated it as the truth, would that be good or bad?"

If it would be good — upload it. If it would be bad (because it's outdated, wrong, or confusing) — fix it first or skip it.

2

How to Structure and Prepare Documents Before Uploading

You don't need to rewrite all your documents before uploading. But 10–15 minutes of preparation per document can significantly improve how well the agent uses the knowledge.

R1 One Topic Per Document Produces Better Results

RAG works by retrieving the most relevant chunks from your uploaded documents. When a document covers many topics, the chunking process may split related information across different chunks — or place the information you need next to unrelated content.

Less effective

A single 40-page "Company Handbook" that covers pricing, policies, procedures, team structure, values, benefits, and office rules.

More effective

  • pricing-guide.md — just pricing
  • refund-policy.md — just the refund policy
  • support-procedures.md — just support SOPs
  • onboarding-checklist.md — just the new hire process
The time investment: If you have large omnibus documents, spend 15–20 minutes splitting them into focused, topic-specific files. This one-time investment permanently improves agent performance.

R2 Use Clear Headers and Structure

RAG chunking systems (including CEO.ai's) use document structure — headers, sections, paragraphs — to make intelligent decisions about where to split content. Well-structured documents chunk more cleanly.

Less effective

Our pricing works as follows. For small companies we charge $297 per month which includes the CEO Agent and standard templates and integrations plus 10000 credits. For medium companies we offer the SMB plan at $1499 per month which includes everything in startup plus custom workflows...

More effective

# Pricing Guide

## Startup Plan — $297/month
- CEO Agent (one-shot projects)
- Standard integrations
- 10,000 credits/month

## SMB Plan — $1,499/month
- Everything in Startup
- Custom workflows
- 50,000 credits/month

The structured version has clear headers and each plan in its own section. When chunked, each plan's information stays together. When the agent searches for "SMB plan pricing," it retrieves a clean, complete chunk — not a fragment of a wall of text.

R3 Include Context, Not Just Data

Raw data without context is almost useless for RAG training. The agent doesn't know what the numbers mean.

Less effective

Q1,4200000,Q2,4800000,
Q3,5100000,Q4,5900000

More effective

# Quarterly Revenue — 2025

Q1: $4.2M (+8%)
Q2: $4.8M (+14%)
Q3: $5.1M (+6%)
Q4: $5.9M (+16%)

Full-year: $20.0M (up 22% YoY)
Strongest: Q4 (enterprise deals)

R4 Markdown and Plain Text Outperform Complex Formats

The best file formats for RAG training, ranked:

Format RAG Quality Notes
Markdown (.md) ⭐⭐⭐⭐⭐ Best. Clean structure, headers parsed correctly.
Plain Text (.txt) ⭐⭐⭐⭐ Great. No formatting issues. Less structured.
Code (.js, .py, etc.) ⭐⭐⭐⭐ Great for architect agents. Comments are valuable.
PDF (.pdf) ⭐⭐⭐ Good. Complex layouts may cause chunking issues.
Word (.docx) ⭐⭐⭐ Good. Complex templates may not parse cleanly.
CSV / TSV ⭐⭐ Acceptable if columns are labeled. Add context.
Practical advice: If you have important documents in complex PDF or Word format, consider creating a Markdown version of the key content. It takes 10 minutes and produces meaningfully better results.

R5 Name Your Files Descriptively

File names become metadata in the RAG system. Descriptive names help during management and debugging.

Less effective

doc1.pdf, final_v3.docx, notes.txt

More effective

pricing-guide-2026.md, customer-refund-policy.md, q4-2025-revenue-report.md

3

The Domain Isolation Principle

One of the most common mistakes in RAG training is giving every agent access to every document. It feels comprehensive. In practice, it hurts performance.

Why Domain Isolation Matters

When an agent searches its knowledge base, it returns the top-N most relevant results. If the knowledge base is huge and covers many unrelated topics, irrelevant results push the actually relevant chunks out of the context window.

Example: Sales agent with 200 documents (50 relevant, 150 unrelated)

Agent searches for info on a manufacturing client proposal. Top 5 results:

  • Your manufacturing case study (relevant)
  • Engineering team's code review SOP (irrelevant)
  • Your pricing guide (relevant)
  • HR policy about manufacturing-sector background checks (irrelevant)
  • A past manufacturing proposal (relevant)

40% of the context window is wasted on noise. Proposal quality suffers.

The Fix: Domain-Specific Training

Train each agent only on the knowledge relevant to its role.

Agent Gets These Documents Does NOT Get
Sales Proposal Writer Pricing, case studies, past proposals, competitor analysis Engineering SOPs, HR policies, support procedures
Customer Support Knowledge base, product docs, policies, troubleshooting Sales proposals, engineering standards, marketing
Operations Reporter KPI definitions, report templates, data source docs Sales materials, support procedures, code standards
Architect (Code) API docs, coding standards, infrastructure configs, past specs Sales materials, HR policies, marketing guidelines
Content Writer Brand guidelines, past content, personas, editorial standards Engineering docs, support procedures, financial reports

Where Overlap Is Appropriate

Some documents are legitimately relevant to multiple agents. Upload the document to each relevant agent individually — there's no conflict. 2–3 agents per document is normal; 5+ agents is a red flag that the document might be too broad.

A Practical Workflow for Domain Assignment:

  1. 1Ask: "Which agent role would benefit from knowing this?"
  2. 2Upload to that agent only
  3. 3If multiple agents need it: upload to each one
4

Web Form vs. CLI: When to Use Each

CEO.ai offers two ways to add RAG knowledge. They produce identical results — the choice is purely about convenience for your situation.

Use the Web Form When

  • You're uploading 1–5 files
  • You're not technical
  • You want to visually confirm the target agent
  • You're doing a one-time upload
  • You want a team member to do it (zero onboarding)
How it works: Navigate to Add Memories → Type agent name → Select from dropdown → Upload file(s) → Save

Use the CLI When

  • You're uploading 10+ files
  • You need recursive directory ingestion
  • You want to automate knowledge updates
  • You're ingesting a codebase
  • You're a developer who lives in the terminal

CLI Examples

# Single file

ceo addRag ./docs/pricing-guide.md

# Entire directory

ceo addRagDir ./docs --recursive

# Filtered by file type

ceo addRagDir ./knowledge-base --recursive --extensions md,txt,pdf

# Custom chunk size

ceo addRag ./large-document.md --chunk-size 4000

The hybrid approach (what most teams do): Web form for ad-hoc uploads ("I just updated the pricing guide") and CLI for bulk operations (initial ingestion, periodic refreshes, developer training). There's no penalty for mixing approaches — both feed the same knowledge store.
5

The Testing Protocol: Verifying Your Training Worked

Uploading documents is step one. Verifying the agent actually uses them correctly is step two — and it's the step most people skip.

The 5-Question Test

After any significant RAG update (adding 3+ documents or replacing/updating existing knowledge), run these five tests:

1

The Factual Recall Test

Ask for a specific fact that exists only in your uploaded documents.

Example: "What's the exact price of our SMB plan?"

Pass: Agent states the correct number from your pricing document

Fail: Agent guesses, gives a range, or says it doesn't know

Diagnoses: Whether the document was processed and is retrievable.

2

The Cross-Document Synthesis Test

Ask a question that requires combining information from two different documents.

Example: "Which of our case studies would be most relevant for a healthcare client interested in workflow automation?"

Pass: References a specific case study by name and connects it to the client's needs

Fail: Gives generic advice without referencing your specific materials

Diagnoses: Whether the agent can navigate across multiple documents and synthesize relevantly.

3

The Specificity Test

Ask for something where your company's answer differs from the generic/common answer.

Example: If your SLA guarantees 99.9% uptime (industry standard is 99.5%): "What uptime do we guarantee?"

Pass: Agent says 99.9% (your specific guarantee)

Fail: Agent says 99.5% or gives a vague "high availability" answer

Diagnoses: Whether the agent prioritizes YOUR knowledge over its general training data.

4

The Recency Test

If you've updated a document, test whether the agent uses the new version.

Example: "What's the starting price for our Enterprise plan?" (after updating from $5,000 to $5,500)

Pass: Agent says $5,500 (the updated price)

Fail: Agent says $5,000 (old document still in memory)

Diagnoses: Whether old, contradictory knowledge is interfering. Fix: remove the outdated document.

5

The Application Test

Give the agent a realistic task — the kind it'll actually handle in production.

Example (for a proposal agent): "Write a proposal for Acme Manufacturing. They want to automate lead capture from WhatsApp to HubSpot. Budget ~$2,000/month."

Pass: Uses your pricing, references a relevant case study, follows your proposal format

Fail: Generic proposal that doesn't reference your materials or uses incorrect pricing

Diagnoses: Whether the agent can apply knowledge to a real task — not just recall facts.

What to Do When Tests Fail

Test Failed Most Likely Cause Fix
Factual Recall Document not uploaded or processed Re-upload; check it's assigned to the right agent
Cross-Document Synthesis Relevant docs in separate chunks Add a summary document that connects the dots
Specificity General training overriding your knowledge Add explicit system prompt instruction to prioritize knowledge base
Recency Old document version still in memory Remove outdated doc, re-upload current version
Application System prompt doesn't instruct knowledge use Update system prompt: "Reference your knowledge base for company-specific information"
6

Signs Your Agent's Knowledge Needs Updating

RAG knowledge doesn't expire on a schedule. It expires when your business changes. Here are the signals to watch for:

Signal 1: The Agent Gives an Answer You've Corrected Before

If you find yourself editing the same error repeatedly — the same wrong price, the same old team member name, the same discontinued product — the knowledge base has stale information.

Fix: Find the document containing the outdated info. Update it and re-upload.

Signal 2: A New Product or Policy Exists That the Agent Doesn't Know About

You launched a new service last month. A customer asks the support agent about it. The agent says it doesn't have information — or worse, guesses incorrectly.

Fix: Create or update documentation and upload to all relevant agents (sales, support, content).

Signal 3: Output Quality Gradually Declines

When agents are first trained, outputs feel sharp. Over months, as your business evolves and knowledge stays static, a drift develops. Outputs start feeling slightly generic — not wrong enough to flag, but not as sharp as they were.

Fix: Schedule a quarterly knowledge review. Compare knowledge base against current reality.

Signal 4: New Team Members Report Different Answers Than Expected

Fresh eyes are the best RAG auditors. When someone says "this doesn't match how we actually do things," that's a signal institutional knowledge has changed since the last training update.

Fix: Ask what the correct information is. Find the source document, update it, re-upload.

Signal 5: You've Made 3+ Edits This Week for the Same Reason

If you're consistently correcting the same category of error — pricing, formatting, terminology — that's a systematic knowledge gap, not a random error.

Fix: Identify the root document and fix the source. One knowledge update fixes all future outputs.

7

Advanced: Recursive Ingestion, Chunking Strategy, and CI/CD Training

This section is for developers and technical operators who want to optimize their RAG training workflow.

Recursive Folder Ingestion

The CLI's addRagDir command with the --recursive flag is the fastest way to ingest large knowledge bases.

Training an architect agent on your full stack

# Application code

ceo addRagDir ./src --recursive --extensions js,ts,jsx,tsx --category code

# Infrastructure

ceo addRag ./terraform/main.tf --category code

ceo addRag ./docker-compose.yml --category code

ceo addRag ./Dockerfile --category code

# Documentation

ceo addRagDir ./docs --recursive --extensions md,txt --category documentation

# API specs

ceo addRag ./openapi.yaml --category code

Auto-excluded:

.git .env node_modules Empty files Files > 4MB

Chunk Size Strategy

The default chunk size is 2,000 characters. This works well for most content. Adjust only if you're seeing specific retrieval quality issues.

Increase chunk size (--chunk-size 4000)

  • Long continuous narratives
  • Legal/policy documents with cross-references
  • Technical specs spanning multiple paragraphs

Decrease chunk size (--chunk-size 1000)

  • FAQ-style docs (independent Q&A pairs)
  • Reference material with standalone facts
  • Glossary or definition documents

Automated Training in CI/CD

For teams that maintain documentation alongside code, you can automate RAG training as part of your deployment process.

GitHub Actions — .github/workflows/retrain-agents.yml

name: Retrain AI Agents  
on:  
  push:  
    paths:  
      - 'docs/**'  
      - 'api-reference/**'  
  
jobs:  
  retrain:  
    runs-on: ubuntu-latest  
    steps:  
      - uses: actions/checkout@v4  
  
      - uses: actions/setup-node@v4  
        with:  
          node-version: '18'  
  
      - name: Install CEO.ai CLI  
        run: npm install -g @ceo-ai/cli  
  
      - name: Configure CLI  
        run: ceo configure --key ${{ secrets.CEO_API_KEY }}  
  
      - name: Retrain on documentation  
        run: ceo addRagDir ./docs --recursive --extensions md,txt  
  
      - name: Retrain on API reference  
        run: ceo addRagDir ./api-reference --recursive --extensions md,yaml,json
Result: Every time your documentation is updated and pushed, your agents automatically learn the latest information. Zero manual intervention. Knowledge stays current by design.

Category Overrides

The CLI auto-detects file categories based on extension. Override when the auto-detection doesn't match your intent:

# This .txt file is actually documentation, not data

ceo addRag ./api-notes.txt --category documentation

# These YAML files are config docs, not code

ceo addRagDir ./config-docs --recursive --category documentation

8

The Maintenance Rhythm: Keeping Knowledge Current

RAG training isn't a project with an end date. It's an ongoing practice — like keeping your team's knowledge current. Here's a sustainable rhythm that keeps your agents sharp without consuming significant time.

Weekly

~5 minutes

As-needed updates. When something changes — pricing, policy, process — update the relevant agent's knowledge immediately. Don't batch these.

Trigger: Any time you'd send a memo or update a wiki page, also update the relevant agent.

Monthly

~30 minutes

Agent output review. Pick 5–10 recent outputs from each active agent. Review for accuracy, tone, and recurring edits.

Knowledge gap log review. Throughout the month, note moments where an agent didn't know something it should have. Batch-upload documents to fill those gaps.

SMB & Enterprise plans: This aligns with your monthly check-in with the CEO.ai team.

Quarterly

~1 hour

Full knowledge audit. For each agent, review the complete list of uploaded documents:

  • Is anything outdated? (Remove or replace it)
  • Is anything contradicted by a newer document?
  • Are there new business areas the agent should know about?
  • Has the agent's role expanded?

System prompt review. Are instructions still aligned with how you want agents to behave?

Event-Driven

Immediately

Event Update Required
Pricing changeSales and support agents
New product/service launchSales, support, content, customer-facing agents
Policy changeSupport + any agent referencing that policy
New case study publishedSales agents
Team/org restructuringAgents referencing team structure or escalation
Rebranding/messaging updateContent and sales agents
New integration or featureSupport and technical agents

The One Rule That Prevents Most Problems

If you change a document that an agent has been trained on, update the agent's copy too.

Set a habit: every time you update a source document, add "update the agent" as the last step.

The RAG Training Checklist

Use this for every new agent or significant knowledge update.

1 Before Uploading

2 During Uploading

3 After Uploading

4 Ongoing

We Help You Set Up RAG Training — On Every Plan

On every CEO.ai plan, guided setup includes RAG training configuration. We don't just point you at a file upload form — we help you identify the right documents, organize them by agent role, upload and verify them, and set up a maintenance rhythm that keeps your agents current.

Most customers complete initial RAG training in their first week.

No contracts · Guided setup included · Most customers live within one week