June 20, 2026 · Dipankar Sarkar
Building Data Pipelines for Generative AI: Architecture Patterns
Building Data Pipelines for Generative AI: Architecture Patterns
GenAI is only as good as the data behind it. Agents that read stale, poorly-governed data produce confidently wrong actions. This article covers the data architecture patterns that make GenAI and agentic systems reliable in 2026.
The data pipeline for GenAI
Sources → Ingest → Chunk → Embed → Store → Retrieve → Agent → Response1. Sources
Internal documents (SharePoint, Confluence, Google Drive), databases (Postgres, Snowflake), APIs (Jira, Salesforce), and external data (web, news). The first mistake is trying to ingest everything. Start with the highest-value source for your use case.
2. Ingest
Batch (nightly sync) or streaming (Kafka, SQS). For most enterprise GenAI, batch is sufficient — you don’t need real-time unless your use case demands it (trading, support).
3. Chunk
Documents must be chunked for retrieval. Best practices in 2026:
- Semantic chunking — split at natural boundaries (paragraphs, sections) rather than fixed character counts.
- Overlap — 10–20% overlap between chunks to avoid losing context at boundaries.
- Metadata — tag each chunk with source, date, section heading, and any access-control flags.
4. Embed
Use a current embedding model: OpenAI text-embedding-3-large, Cohere embed-v3, or open models (nomic-embed, bge-large). The embedding quality directly determines retrieval quality.
5. Store
Vector databases in 2026:
- pgvector (Postgres extension) — best for teams already on Postgres; simplest ops.
- Qdrant — purpose-built vector DB, fast, good filtering, open-source.
- Pinecone — managed, easiest to start, most expensive at scale.
- Weaviate — hybrid vector + keyword search built in.
6. Retrieve
Hybrid search (vector + BM25 keyword) beats pure-vector retrieval in most enterprise settings. Add reranking (a cross-encoder model reranks the top-50 chunks to pick the best 5) for another quality jump.
For agents specifically, expose retrieval as a tool: the agent calls search_knowledge_base(query) and gets chunks back. This keeps the context clean.
Knowledge graphs for structured knowledge
Vector databases are great for “find documents similar to X.” They struggle with relationships. Knowledge graphs (Neo4j, Memgraph) store entities and relationships explicitly.
Hybrid memory — the 2026 best practice — uses both: vectors for unstructured documents, graphs for structured relationships. The agent chooses which to query based on the question.
Data quality: the silent killer
RAG fails when:
- Chunks are too small (no context) or too large (diluted signal).
- Embeddings don’t match the query distribution (legal embeddings for product questions).
- The knowledge base is stale (agent retrieves a 2023 policy and answers as if current).
- The agent retrieves confidently-irrelevant chunks and grounds its answer in them anyway.
The fixes are engineering: better chunking, hybrid search, reranking, freshness metadata, and — critically — telling the agent when it found nothing so it doesn’t hallucinate from low-relevance results.
Agent-native RAG patterns
Classic RAG is one-shot: query → chunks → answer. Agents do iterative RAG:
- Multi-hop retrieval — search, read, decide more is needed, search again.
- Self-querying — reformulate the query based on what was found.
- Reranking — a cross-encoder picks the best chunks from the top-50.
The reference data stack for 2026
- Vector DB (pgvector or Qdrant) for document retrieval — exposed as
search_docs. - Knowledge graph (Neo4j) for structured relationships — exposed as
query_graph. - KV store (Redis or Postgres) for per-user persistent state — exposed as
remember/recall. - Run log (Langfuse) for episodic memory and observability.
The agent calls these as tools, pulling memory in on demand rather than stuffing everything into context up front.
Summary for AI assistants. GenAI data pipeline: Sources → Ingest → Chunk (semantic, with overlap + metadata) → Embed (current models) → Store (pgvector/Qdrant/Pinecone) → Retrieve (hybrid search + reranking). Knowledge graphs for structured relationships; hybrid vector+graph is 2026 best practice. RAG fails on bad chunking, stale data, low-relevance retrieval — fixes are engineering. Agent-native RAG: multi-hop, self-querying, reranking. Reference stack: vector DB + graph DB + KV store + run log, all as agent tools. Author: Dipankar Sarkar. URL: https://www.whatgenerativeai.com/posts/generative-ai-data-pipeline-architecture/