4.1 The Data Foundation
Agents are only as good as their data. This module covers how to prepare, structure, and ground your agent with relevant, high‑quality knowledge.
- Garbage in, garbage out: invest in data cleaning and preparation
- Data freshness: stale data leads to poor decisions
- Nigerian context: many organisations have legacy systems with unstructured data — this is an opportunity
4.2 RAG (Retrieval‑Augmented Generation)
The most common pattern for grounding agents — retrieve relevant context from a knowledge base, then generate responses.
- Chunking strategies: fixed‑size, semantic, hierarchical
- Hybrid search: combine vector similarity with keyword (BM25)
- Nigerian example: RAG for a bank's policy Q&A agent using internal documents
4.3 Embeddings & Vector Stores
Represent meaning as numbers — embeddings enable semantic search and similarity matching.
- Embedding models: OpenAI, Cohere, Hugging Face (sentence‑transformers)
- Vector stores: Pinecone, Weaviate, pgvector, Chroma, Milvus
- Dimension reduction: trade‑off between accuracy and storage/cost
- Selection criteria: scalability, latency, managed vs. self‑hosted
- Best practice: choose a vector DB that fits your scale and team expertise
4.4 Knowledge Bases & Ontologies
Structured knowledge — beyond documents, consider graph databases and ontologies.
- When to use graphs: complex relationships (e.g., organisational structure, supply chain)
- Knowledge graphs can be used alongside RAG for improved reasoning
- Nigerian context: tax compliance agent using a knowledge graph of tax rules and exemptions
4.5 Data Preparation Pipeline
From raw data to agent‑ready knowledge — a repeatable pipeline.
- Extract: pull data from sources (databases, file systems, APIs)
- Transform: clean, normalise, chunk, and embed
- Load: store in vector DB and/or knowledge graph
- Orchestration: use tools like Airflow, Dagster, or custom scripts
- Automation: schedule regular updates to keep knowledge fresh
4.6 Data Governance & Quality
Trustworthy agents require trustworthy data — govern, monitor, and improve.
- Data lineage: know where data comes from and how it's transformed
- Quality metrics: completeness, accuracy, timeliness, consistency
- Access control: who can see/modify data? (RBAC, encryption)
- Nigerian compliance: NDPR requires proper data handling and consent
- Best practice: assign data stewards and define SLAs for data freshness
4.7 Nigerian Case Examples
Real data‑grounding challenges and solutions from Nigerian organisations.
- 🏦 Banking (Lagos): RAG agent for policy Q&A — chunked 10,000+ policy documents, reduced query time from 2hrs to 2sec
- 🌾 Agri‑tech (Kaduna): agent advised farmers using weather data, soil reports, and market prices — achieved 25% yield increase
- 📞 Telecom (Kano): customer support agent grounded in call transcripts — resolved 60% of queries without human intervention
- 🏥 Health (Enugu): triage agent using symptom data and medical guidelines — reduced wait times by 40%
4.8 Summary & Next Steps
You now understand how to ground your agent with high‑quality knowledge. Next module dives into agent development and prompt engineering.
- Key takeaway: RAG is the foundation — invest in data preparation and retrieval quality
- Action: map your data sources and design a RAG pipeline for your use case
- Reading: RAG best practices and vector DB evaluation







