AI Agents with Knowledge Bases: RAG, Data Sources, and Reliable Answers
- AI Agents with Knowledge Bases: The Decision Problem Before the Technology
- Evaluating and Safely Connecting Data Sources for RAG Agents
- From Source to Searchable Context: Ingestion, Chunking, and Index Design
- Which Vector Database Is Suitable for AI Agents? Selecting by Requirements Rather Than Brand List
- Enforcing Reliable Answers: Evidence, Freshness, and Controlled Abstention
- Turning the Selection Framework into a Robust Pilot
1. AI Agents with Knowledge Bases: The Decision Problem Before the Technology
AI agents with knowledge bases are often reduced to RAG: A request is understood, suitable content is retrieved, and a language model formulates an answer from it. However, this brief description is not sufficient for a robust solution. What matters is which knowledge is available, how quickly it changes, who is allowed to access it, how high the risk of error is, and what evidence is required.
RAG Is Not Training: How the Agent Retrieves Knowledge at Runtime
Retrieval-Augmented Generation (RAG) does not change the model whenever a new document is added. The agent accesses sources or indexes at runtime. The typical process is:
- The request is understood and assigned to a data area or question type.
- The agent selects a suitable index, database query, or live tool.
- Retrieval searches for relevant and authorized documents or records.
- The retrieved evidence is passed to the model together with the question.
- The agent generates an answer supported by evidence – or asks a follow-up question, refers to a live system, or deliberately abstains.
A vector database is only one retrieval component and is not an automatic source of truth. For inventory, price, status, or appointments, an authoritative API or leading transactional system is more suitable. Document-based RAG, on the other hand, is a good fit for policies, manuals, and explanatory content.
The recurring selection framework evaluates six dimensions for each knowledge area: rate of change, data structure, permissions, citation requirements, risk of error, and response latency. These determine decisions about the data source, ingestion, chunking, metadata filters, search mode, source evidence, expiration rules, and operating model.
The Selection Framework and Four Knowledge Classes
For stable, low-risk content, scheduled synchronization is often sufficient. Frequently changing data requires incremental updates or direct retrieval. Highly structured information should remain accessible through fields and filters. Strict permissions must already be enforced during retrieval. The higher the risk and citation requirement, the more consistently minimum-hit thresholds, source hierarchies, and controlled abstention must be applied.
Four typical knowledge classes illustrate the consequences:
- Stable policies: Approved manuals and guides are suitable for RAG with versions and validity dates.
- Frequently changing product data: Catalogs, prices, and availability require short synchronization intervals or API queries.
- Case-specific information: Tickets and CRM records require case IDs, strict ACL filters, and traceable references.
- Live data: Inventory, status, and appointments should generally come from the leading system.
For the preliminary assessment of which tasks and autonomy levels are suitable at all, see Process Selection and Suitable Autonomy Levels.
2. Evaluating and Safely Connecting Data Sources for RAG Agents
Which Data Sources Are Suitable for a RAG Agent?
Not every accessible source belongs in a shared index. Before importing it, the source needs a business owner, an update process, clear approvals, and a reliable deletion rule.
Documents, wikis, and tickets are useful when explanatory context is needed. Tables, product data, and CRM information, by contrast, usually remain retrievable as structured records. The question “Is item X in stock?” should not be answered from vectorized text chunks, but through a current API or database query.
Assessing Source Suitability: Ownership, Freshness, Permissions, Duplicates, and Citatability
A practical mandatory schema includes source_id, source_url or record ID, title, owner, version, valid_from, valid_until, updated_at, access_scope, language, product, and confidence or approval status. Depending on the use case, region, document type, and retention period are added.
Permissions must be enforced during retrieval, not only during import. The user, role, tenant, and case context must be checked against the ACL metadata. Drafts, archived versions, and deleted records do not belong in active results.
3. From Source to Searchable Context: Ingestion, Chunking, and Index Design
Ingestion as a Controlled Pipeline Rather Than a One-Time Document Upload
A robust ingestion pipeline consists of these stages:
- Capture: Register the source, change event, and owner.
- Extract: Extract text, tables, page structure, and, where necessary, OCR.
- Normalize: Standardize language, date formats, punctuation, and structure.
- Validate: Check approval, duplicates, readability, and empty content.
- Chunk: Create meaningful units with the parent document and location.
- Generate embeddings: Vectorize suitable text segments.
- Index: Store vector, keyword, and metadata fields.
- Log: Record versions, errors, deletions, and job status.
When content changes, the affected segments must be updated. Deleted content requires a tombstone or must be reliably removed from the retrieval inventory. Failed jobs must not be treated like successful synchronizations. Incremental synchronization and re-ingestion when content or metadata changes are therefore essential operational functions.
Chunking by Meaningful Units
A fixed chunk size alone is rarely sufficient. Segments that are too large mix topics; segments that are too small lose conditions and definitions. Headings, sections, lists, and semantic boundaries are preferable. Tables should be retained as a coherent structure or as clearly labeled rows. Each chunk refers to the parent document, page, or section.
This allows the search to return a precise location while the agent can include the higher-level context when necessary. Structured data should not be artificially split into text chunks when questions depend on IDs, time periods, numbers, or fields. It remains available as filterable records or tool results.
Vector, Keyword, or Hybrid Search
Vector search is suitable for semantically phrased questions. Keyword search remains important for technical terms, item numbers, names, abbreviations, and exact values. Hybrid search combines both signals and can then reorder the results through reranking.
Hybrid Search is therefore a good standard candidate for enterprise knowledge: It combines meaning and exact terms with metadata filters. Reranking improves the order, but it does not replace good sources, correct chunking, or permission filters.
4. Which Vector Database Is Suitable for AI Agents? Selecting by Requirements Rather Than Brand List
The Minimum Profile
Which vector database is suitable for AI agents? There is no universally best choice. The decision follows the data and operating profile. Required features include metadata filters, ACL and tenant separation, keyword and vector search, upsert and delete, incremental synchronization, and source fields. Reranking, latency, scalability, data residency, backups, observability, cost, and SDK or tool integration also matter.
The system must be able to filter validity dates, product, language, and permissions before retrieval. It must process changes and deletions and trace results back to the original source. In regulated environments, audit logs, retention rules, and recovery are just as important as search speed.
Three Operating Models
- Extend existing enterprise search: Suitable when full-text search, filters, ACLs, and governance are already established.
- Managed vector store: Useful for rapid pilots and teams with limited infrastructure capacity. Data residency, export, backups, costs, and lock-in must be assessed.
- Self-managed vector store: Appropriate when full infrastructure control or special security requirements apply, but with greater operational effort.
In a proof of concept, measurable questions matter more than brand names: Are deleted sources reliably removed? Can permissions and validity dates be filtered before search? Can evidence be traced back to the original source? How do latency and costs behave with real updates and concurrent requests?
The answer policy should additionally be secured through precise system instructions for agents.
5. Enforcing Reliable Answers: Evidence, Freshness, and Controlled Abstention
Source Evidence, Expiration Logic, and Conflicts
Verifiable evidence contains a title, link or record reference, version or update date, and preferably a page, section, table row, or field. A mere document name is not sufficient.
Each knowledge class needs its own expiration rule. Policies can have longer TTLs or valid_until values, while product data requires short synchronization intervals. Live data is read from the leading system for every request. In addition, event-driven reindexing, regular synchronization, deletion and tombstone processes, and checks after failed jobs are required.
Source hierarchies and version priority help with contradictory documents. A current, approved policy takes precedence over an old draft. If the hierarchy does not permit a clear decision, the agent must make the conflict visible instead of inventing an apparently certain answer.
Answer Lifecycle: Valid, Warn, Abstain, Escalate
The agent should distinguish four states:
- Valid: The evidence is current, authorized, sufficiently complete, and consistent. The answer is provided with evidence.
- Warn: The evidence is usable but older or limited. The freshness risk is explicitly stated.
- Abstain: Suitable, authorized, or sufficient evidence is missing. The agent asks a follow-up question, refers to a live system, or declines to make the statement.
- Escalate: Sources conflict, the risk of error is high, or a specialist decision is required. The case is passed to a human.
Retrieval thresholds, a minimum number of relevant pieces of evidence, and a check for context completeness prevent a single random hit from becoming certainty. Answers beyond the retrieved evidence must be excluded.
Imported content may contain indirect prompt injection. Instructions in PDFs, wikis, or tickets are data, not system rules. They may neither override higher-level instructions nor independently trigger tool calls. Controlled tool use in automated workflows therefore requires reliably retrieved and evaluated knowledge.
6. Turning the Selection Framework into a Robust Pilot
Reference Process from User Question to Source Evidence
The compact process is: classify the question, determine the data area, filter permissions and freshness window, search hybridity, rerank the results, check evidence for completeness and contradictions, generate an answer with evidence, or abstain in a controlled manner. For live facts, an API or database tool is used instead of document search.
Test Corpus, Metrics, and Rollout
The pilot needs simple, ambiguous, time-critical, impermissible, and unanswerable questions. The test set should also include old versions, conflicting sources, missing permissions, table values, and deleted documents. Each question receives an expected source, an acceptable answer, and, where applicable, an expected refusal.
At a minimum, measure source retrieval quality, evidence coverage, the proportion of outdated hits, permission violations, refusals when evidence is missing, latency, and cost. This makes it possible to determine whether a weakness originates in the source, filter, chunking, retrieval, reranking, or model.
The practical sequence is to start with a narrowly defined knowledge area with a responsible owner and a fixed update process. Only once source quality, permissions, expiration rules, and evidence work should additional sources and agent capabilities follow. As the next step, connecting websites, CMSs, and tools extends knowledge access to websites, CMSs, tools, and people.
Short Decision Checklist
- Is the source authoritative and assigned to an owner?
- Does the knowledge change rarely, regularly, or in real time?
- Are document search, structured queries, or APIs appropriate?
- Which permission, product, and validity filters apply before retrieval?
- Does the source require keyword, vector, or hybrid search with reranking?
- How are versions, deletions, and failed jobs handled?
- Does every result lead to the specific original location?
- When does the agent warn, abstain, or escalate?
- Does the selected search or vector database pass the real-world POC?
This creates not an agent that merely answers as often as possible, but one that uses the right source, checks its evidence, and deliberately abstains when the basis is weak, contradictory, or outdated.
Written by
Daniel Böhmel has been developing software for over 20 years and has been self-employed since 2007. He started out with interactive web design back in the Flash era; later, he built his own online projects, such as a fitness forum and a supplement store, including the editorial content. Today, his…
View the profile of Daniel BöhmelParticipate now!
Don’t have an account yet? Register yourself now and be a part of our community!