Why enterprise RAG systems require more than AI models, embeddings, and vector databases.
Introduction: From Experimental RAG to Enterprise Architecture
Building a Retrieval-Augmented Generation (RAG) application has become increasingly accessible. With modern large language models, embedding services, vector databases, and AI-assisted development tools, engineers can create a functional document-question-answering system in a relatively short time.
However, a working prototype is not necessarily a production-ready application.
An experimental RAG pipeline may successfully retrieve relevant documents and generate useful answers. Yet deploying that same application in an enterprise environment introduces additional challenges involving security, integration, scalability, reliability, data management, observability, and operational costs.
These challenges are not unique to artificial intelligence. They are familiar problems in software engineering and enterprise architecture.
This article is the third installment in our exploration of RAG engineering.
In The RAG Engineering Journey: Architecture, Evaluation, Performance, and Lessons from an Experimental Laboratory, we examined the development of an experimental RAG application, including document processing, retrieval evaluation, performance measurements, and engineering lessons.
In Why RAG Proofs of Concept Succeed but Production Deployments Struggle, we investigated the technical and organizational difficulties that separate successful demonstrations from reliable enterprise applications.
In this third article, we explore how software architecture and AI-assisted engineering practices can help bridge that gap.
We will examine the evolution of an experimental RAG system through code quality improvements, database architecture, provider abstraction, observability, evaluation, containerization, and cloud infrastructure design.
The objective is not to present a universal reference implementation. Instead, it is to explain the engineering decisions involved in transforming an AI prototype into a system designed for enterprise requirements.
Table of Contents
- The Enterprise RAG Market and Production Challenges
- Introducing Our RAG Laboratory: From Experimentation to Enterprise Architecture
- A RAG System Is Still a Software System
- Understanding the Architecture of a RAG System
- AI-Assisted Engineering: Improving the Initial Implementation
- Architectural Evolution: From Prototype to Production-Oriented Components
- Designing an Azure Deployment with Bicep
- The Engineering Journey: What Changed and Why
- Lessons Learned: What We Would Do Differently
- From Production-Oriented Design to Operational Readiness
- Conclusion: AI Engineering Meets Software Architecture
- References and Further Reading
The Enterprise RAG Market and Production Challenges
A Growing Market with Significant Engineering Challenges
Enterprise interest in RAG is driven by the need to connect generative AI systems with organizational knowledge, proprietary documents, technical repositories, and operational information.
According to Grand View Research, the global RAG market was valued at approximately $1.2 billion in 2024, with an estimated value of $2.0 billion in 2026 and a projected value of $11.0 billion by 2030.
| Market Indicator | Value | Period |
|---|---|---|
| Global RAG market | $1.2 billion | 2024 estimate |
| Global RAG market | $2.0 billion | 2026 estimate |
| Projected global RAG market | $11.0 billion | 2030 forecast |
| Projected compound annual growth rate | 49.1% | 2025–2030 |
Source: Grand View Research, Retrieval Augmented Generation Market Report, updated July 2026. These are market estimates and forecasts, not guaranteed future outcomes.
The broader AI market is expanding as well. In September 2026, Gartner forecast worldwide AI spending of approximately $2.7 trillion in 2026, representing 49.5% year-over-year growth.
Importantly, Gartner's figure represents spending across the broader AI ecosystem. It should not be confused with the much narrower market for RAG products and services.
The Production Adoption Gap
Strong market growth does not mean that enterprise implementation is straightforward.
In its January 2026 analysis, Why 50% of GenAI Projects Fail, Gartner reported that at least 50% of generative AI projects had been abandoned after the proof-of-concept stage by the end of 2025.
The analysis identified several recurring causes: unclear business value, insufficient data quality, escalating costs, inadequate risk controls, and organizational change-management problems.
This statistic applies to generative AI projects broadly, not specifically to RAG implementations.
Nevertheless, Gartner explicitly discusses challenges involving RAG data pipelines and enterprise knowledge management.
Other technology organizations have identified similar engineering concerns.
| Organization | Documented Challenge | Engineering Implication |
|---|---|---|
| Gartner | Data readiness, costs, governance, business value | Architecture must support business and operational requirements. |
| Google Cloud | Silent retrieval failures and insufficient evaluation | Quality must be measured systematically. |
| NVIDIA | Security, portability, data governance, framework maturity | Enterprise RAG requires modular, observable infrastructure. |
| Microsoft | Enterprise context, trust, integration, feedback | AI applications must integrate with organizational systems. |
| IBM | Provider dependencies and operational control | Portability and resilience require deliberate design. |
Google Cloud's Optimizing RAG Retrieval: Test, Tune, Succeed warns that inadequate evaluation can produce failures that remain difficult to detect through ordinary user interaction.
NVIDIA's How to Take a RAG Application from Pilot to Production in Four Steps identifies security, portability, governance, accuracy, and operational complexity as important enterprise concerns.
These publications suggest that the transition from prototype to production is not simply a matter of selecting a more powerful LLM.
It requires engineering the complete system.
Introducing Our RAG Laboratory: From Experimentation to Enterprise Architecture
To explore the engineering challenges involved in building Retrieval-Augmented Generation systems, we developed our own RAG Laboratory, an experimental software engineering initiative designed to investigate how a RAG application evolves from an initial proof of concept toward an enterprise-oriented software architecture.
Rather than focusing exclusively on language models, embeddings, or retrieval algorithms, our objective was to understand the complete engineering lifecycle of a RAG system: from document ingestion and semantic search to software design, testing, observability, security, maintainability, and cloud infrastructure.
The Purpose of the Laboratory
The laboratory was conceived as a practical environment for experimentation, architectural validation, and continuous engineering improvement.
Its development was guided by several fundamental questions:
- How can we build a RAG system that retrieves relevant technical information and generates useful, context-aware answers?
- How can we evaluate retrieval quality, response quality, and system performance independently?
- How can we integrate different language models and embedding providers without introducing unnecessary architectural coupling?
- What software engineering practices are required to transform an experimental RAG application into a maintainable, reliable, and scalable system?
- How can we design a cloud architecture that preserves the application's capabilities while addressing enterprise operational and security requirements?
A Real-World Technical Documentation Corpus
For our experiments, we selected the publicly available technical documentation of Apache NiFi, an open-source platform for data integration and dataflow automation.
Apache NiFi provides a particularly interesting knowledge domain because its documentation covers software architecture, component configuration, data processing, security, administration, and troubleshooting.
Our initial experimental corpus included 11 technical manuals, 785 document sections, 1,155 text chunks, and 288 associated images. This provided a practical environment for testing document ingestion, semantic retrieval, source attribution, and the generation of technical answers.
The laboratory was designed to answer practical questions that a software engineer, system administrator, or data engineer might encounter when working with Apache NiFi.
For example:
- How do I add and configure a processor in Apache NiFi?
- How do Controller Services work?
- How can I configure processor scheduling?
- How does NiFi manage FlowFiles and data provenance?
- How can I troubleshoot dataflow execution problems?
Technology Stack and Architectural Components
The laboratory combines traditional software engineering technologies with modern AI capabilities. Its architecture evolved incrementally as new requirements, experimental findings, and operational considerations emerged.
| Architectural Component | Technology | Responsibility |
|---|---|---|
| Application Backend | Python / FastAPI | API services and RAG orchestration |
| Document Processing | Python | Document ingestion, chunking, and metadata extraction |
| Data Persistence | PostgreSQL | Documents, metadata, and experimental telemetry |
| Vector Retrieval | PostgreSQL + pgvector | Embedding storage and semantic similarity search |
| Embedding Generation | Nomic Embed Text and experimental providers | Document and query vector representations |
| Local LLM Inference | Ollama | Local language model execution |
| Remote LLM Inference | OpenRouter | Access to remotely hosted language models |
| User Interaction | Web Interface / CLI | Questions, answers, experiments, and diagnostics |
| Testing and Evaluation | pytest / Evaluation Modules | Automated tests, retrieval metrics, and LLM evaluation |
| Observability | Structured Logging / PostgreSQL | Execution metrics, errors, and performance analysis |
| Containerization | Podman | Reproducible application environments |
| Cloud Infrastructure Design | Microsoft Azure / Bicep | Cloud deployment architecture and Infrastructure as Code |
Table: Technology stack and architectural responsibilities across the RAG Laboratory engineering journey.
An AI-Assisted Software Engineering Approach
An important characteristic of this laboratory is that its development incorporates AI-assisted software engineering practices.
We used AI coding assistants to support implementation, refactoring, automated test generation, documentation, architectural reviews, and experimental analysis. However, the architectural direction, engineering decisions, quality requirements, and validation criteria remained explicit responsibilities of the software engineering process.
This approach allowed us to investigate not only how to build a RAG system, but also how artificial intelligence can support the engineering lifecycle of the system itself.
The laboratory therefore operates at two complementary levels:
- AI Engineering: Building and evaluating retrieval pipelines, embeddings, language model integrations, and answer generation.
- Software Engineering: Designing the architecture, managing dependencies, improving maintainability, implementing tests, establishing observability, and preparing the system for cloud deployment.
Beyond the Initial Proof of Concept
The first objective was to demonstrate that a RAG application could retrieve relevant information from technical documentation and generate useful answers.
However, as the laboratory evolved, new engineering concerns became increasingly important. Database persistence, provider abstraction, embedding compatibility, configuration management, error handling, performance measurement, automated testing, and deployment architecture all became part of the system's development journey.
What initially appeared to be an artificial intelligence experiment gradually became a broader software architecture and engineering challenge.
The purpose of our RAG Laboratory was not simply to demonstrate that a language model could answer questions about technical documentation. It was to investigate what it takes to engineer a complete RAG system that can evolve from an experimental prototype toward an enterprise-oriented architecture.
This engineering journey leads us to one of the central observations of this article:
A RAG system does not stop being a software system simply because it incorporates artificial intelligence.
What Is Apache NiFi?
Apache NiFi is an open-source data integration and dataflow automation platform developed by the Apache Software Foundation. It enables organizations to collect, transform, route, and distribute data between different systems through a visual, web-based interface.
Based on flow-based programming principles, Apache NiFi allows engineers to design data pipelines using configurable components called Processors. These components perform tasks such as retrieving information from APIs, processing files, transforming data formats, interacting with databases, and delivering information to downstream systems.
Its architecture provides capabilities for data provenance, flow monitoring, backpressure management, secure communication, and scalable data processing, making it particularly useful for enterprise data integration and automation.
Key Applications and Potential Use Cases
- Enterprise Data Integration: Connecting ERP, CRM, financial, logistics, and other business systems through automated data exchange.
- ETL and ELT Pipelines: Extracting, transforming, and transferring data between operational databases, data warehouses, and data lakes.
- Real-Time Data Processing: Collecting and routing event streams, application logs, and operational data for near-real-time processing.
- IoT and Edge Computing: Collecting information from sensors, connected devices, and industrial systems for centralized processing.
- Cloud and Hybrid Integration: Automating data movement between on-premises systems and cloud environments such as Azure, AWS, and Google Cloud.
- Cybersecurity and Observability: Collecting, filtering, and distributing security events, system logs, and operational telemetry.
- AI and RAG Data Pipelines: Automating document ingestion, metadata extraction, data preparation, and integration with embedding services and vector databases to support AI-powered applications.
Why Apache NiFi Was Selected for Our RAG Laboratory
Apache NiFi provides a rich and technically diverse documentation corpus covering software architecture, component configuration, data processing, security, system administration, and troubleshooting.
These characteristics make its documentation a valuable case study for evaluating a Retrieval-Augmented Generation system. The RAG application must retrieve relevant technical information, understand relationships between software components, and generate accurate, context-aware answers to practical engineering questions.
Apache NiFi represents an interesting example of how traditional data engineering and modern AI architectures can complement each other. While NiFi can automate the collection and preparation of enterprise data, RAG systems can transform that information into accessible, context-aware knowledge.
Official References: Apache NiFi Official Website | Apache NiFi Overview | Apache NiFi Component Documentation
A RAG System Is Still a Software System
A professional with a strong background in artificial intelligence may possess extensive knowledge of machine learning, natural language processing, transformers, embeddings, information retrieval, and model evaluation. These competencies are essential for building high-quality RAG capabilities.
However, enterprise deployment introduces additional responsibilities that extend beyond model behavior.
A production-oriented RAG application must interact with users, databases, APIs, authentication services, document repositories, infrastructure platforms, and external providers.
It must also satisfy business requirements involving availability, security, performance, cost, maintainability, and operational continuity.
These responsibilities belong to the broader discipline of software architecture.
The Role of the Software Architect
A software architect contributes by understanding the business domain, identifying technical constraints, evaluating alternatives, and designing how system components interact.
This does not mean that AI specialists cannot possess architectural expertise, or that software architects automatically understand machine learning.
The disciplines are complementary, and experienced professionals may develop capabilities in both.
The essential point is that enterprise RAG systems require both AI-specific knowledge and traditional software engineering competencies.
| AI Engineering Responsibilities | Software Architecture Responsibilities |
|---|---|
| Embedding model selection | Data architecture and lifecycle management |
| Document chunking strategies | Integration with enterprise repositories |
| Semantic retrieval | API contracts and service boundaries |
| LLM evaluation | Reliability, scalability, and observability |
| Prompt and context optimization | Security, authentication, and authorization |
| Model quality and inference behavior | Deployment, maintenance, and cost governance |
Why Architecture Matters in the AI Coding Era
In October 2026, Jacques Cornwell argued in a Nature Careers column that AI-assisted programming increasingly requires developers and researchers to think like systems architects.
His discussion emphasizes modularity, reproducibility, standardized project structures, and the ability to critically evaluate AI-generated code.
Similarly, software architect Brian Childress discusses the importance of architectural thinking in the age of AI-assisted coding in an interview with Scrum Master Toolbox .
These professional perspectives reinforce an important distinction: generating code and engineering a sustainable system are related but different activities.
Neither publication is a controlled study of enterprise RAG deployments. Their value here is conceptual rather than statistical.
Understanding the Architecture of a RAG System
A basic RAG application combines document ingestion, embedding generation, retrieval, and language-model inference.
A simplified conceptual architecture looks like this:
This architecture can be sufficient for learning, experimentation, and validating a use case.
However, an enterprise system typically needs additional capabilities.
The second diagram illustrates a central architectural principle. The retrieval and generation components are only part of the application. The surrounding infrastructure and engineering capabilities determine whether the system can operate reliably within an organization.
AI-Assisted Engineering: Improving the Initial Implementation
During the evolution of our experimental RAG Laboratory, AI-assisted development tools were used to support several software engineering activities.
The objective was not merely to generate additional functionality. It was to improve the structure, maintainability, testability, and observability of the application.
Documentation and Evaluation Guides
One of the first improvements involved creating clearer documentation for the application and its evaluation procedures.
AI assistance helped structure user guides, explain application workflows, and organize repeatable evaluation steps.
Documentation is particularly important in AI systems because application behavior depends on multiple interacting elements: source documents, embedding models, retrieval configuration, prompts, and LLM providers.
Without documentation, it becomes difficult to explain why a particular result was produced or how to reproduce an experiment.
Refactoring and Modularization
The initial implementation evolved through refactoring activities focused on separating responsibilities and improving readability.
These activities included reorganizing modules, clarifying function and variable names, reviewing dependencies, and separating configuration from application logic.
A monolithic implementation may be convenient during experimentation, but it becomes increasingly difficult to maintain as the application grows.
Modularization helps isolate changes and establish clearer boundaries between ingestion, retrieval, generation, evaluation, and infrastructure concerns.
Configuration Management
Another important improvement involved consolidating configuration parameters.
Model identifiers, service endpoints, timeouts, retrieval settings, and operational constants should not be scattered throughout the source code.
A production-oriented configuration strategy should distinguish application defaults, environment-specific settings, and sensitive credentials.
Secrets must be managed securely rather than embedded in source files.
Automated Testing and Code Coverage
As the laboratory evolved, automated tests became increasingly important.
The test suite was expanded to detect regressions during refactoring and architectural changes.
However, code coverage should not be confused with system reliability.
A high coverage percentage indicates that tests execute a substantial portion of the code. It does not automatically demonstrate that the tests validate the correct behavior, handle important failure scenarios, or reflect production conditions.
For RAG systems, traditional software tests must be complemented by retrieval evaluation, generation-quality assessment, and integration testing.
Persistent Evaluation Data
A particularly useful engineering decision was to treat evaluation results as persistent data rather than temporary console output.
The laboratory incorporated storage for evaluation runs, metadata, and telemetry.
Persisting this information makes it possible to compare experiments, investigate regressions, and preserve evidence about system behavior.
This leads to a broader principle: Evaluation results are engineering assets. They should be stored, versioned, and associated with the configuration that produced them.
User Interface Improvements
The application interface also evolved through usability improvements, clearer components, and better interaction flows.
Although interface design may appear secondary in an AI laboratory, it becomes important when users need to understand system responses, reset interactions, inspect errors, or interpret retrieved evidence.
A technically sophisticated retrieval engine is of limited value if users cannot interact with it effectively.
What AI-Assisted Coding Actually Contributed
AI-assisted tools accelerated tasks such as documentation, code restructuring, test generation, and implementation refinement.
However, these tools did not eliminate the need for architectural decisions, review, or verification.
The most important lesson was that AI-generated changes must be evaluated against engineering requirements.
Faster code generation is useful only when the resulting system remains understandable, maintainable, and correct.
Architectural Evolution: From Prototype to Production-Oriented Components
The laboratory's architectural evolution illustrates how new requirements introduce engineering concerns beyond the original RAG pipeline.
Migrating to PostgreSQL and pgvector
The initial experimental architecture used separate components for vector retrieval and application metadata.
As requirements evolved, PostgreSQL with pgvector became an attractive alternative for consolidating relational data and vector search.
PostgreSQL provides mature capabilities for transactions, integrity constraints, indexing, backup, and database administration.
The pgvector extension adds vector similarity operations within the PostgreSQL ecosystem.
This architectural decision illustrates the importance of considering the entire data lifecycle, not only retrieval performance.
Database selection should account for operational requirements, data consistency, scalability, administration, and the experience of the engineering team.
PostgreSQL is not necessarily the best choice for every RAG application, but it can be an effective foundation when relational data and vector retrieval must coexist.
Provider Abstraction: Reducing Technological Coupling
An experimental RAG system may begin with a single local model or provider.
As requirements evolve, organizations may need to evaluate multiple LLMs, change providers, control costs, or satisfy data-residency restrictions.
Provider abstraction introduces an architectural boundary between application logic and external model services.
This approach can reduce application-level coupling, but it does not guarantee that models are interchangeable.
Different providers may expose different capabilities, response formats, context limits, error behaviors, and pricing structures.
The abstraction layer must therefore define contracts while preserving the ability to handle provider-specific characteristics.
Embedding Compatibility and Data Migration
Embedding models introduce an additional architectural challenge.
Vector representations generated by different models should not be assumed to be compatible merely because they have similar dimensions or produce apparently similar results.
Changing an embedding model may require reindexing documents, regenerating query vectors, and reevaluating retrieval quality.
Our laboratory investigated these concerns through experiments involving local and remote embedding providers.
The broader lesson is that embedding selection affects data architecture and migration planning.
An embedding model is not simply a replaceable configuration parameter when its outputs have already been persisted across a large document collection.
Structured Exception Handling and Observability
RAG applications depend on multiple services, including databases, model providers, document-processing components, and network connections.
A failure may originate in any of these dependencies.
For example, an external LLM provider may reject a request because of rate limits, while the application itself remains operational.
Without structured error handling, these failures can be difficult to distinguish.
The laboratory therefore incorporated additional work around error classification, telemetry, and operational visibility.
A production-oriented observability strategy should help engineers answer questions such as:
- Which request failed?
- Which component generated the error?
- Which provider or model was involved?
- How much time was spent in each processing stage?
- Was the failure transient or persistent?
- Can the request be retried safely?
Distributed tracing, correlation identifiers, structured logs, and metrics are important tools for answering these questions.
Observability is not merely a dashboard feature. It is an architectural capability that supports diagnosis and operational decision-making.
LLM Evaluation as a Separate Engineering Concern
A RAG application combines at least two distinct quality problems.
The retrieval component must locate relevant information.
The generation component must use that information appropriately.
A strong retrieval score does not guarantee a correct answer.
Similarly, a fluent answer does not demonstrate that it is supported by retrieved evidence.
For this reason, our laboratory evolved toward more explicit evaluation of model behavior and experimental configurations.
This approach is consistent with OpenAI's guidance on enterprise evaluations, which emphasizes defining expected behavior, measuring outcomes, and improving systems using evidence from real workflows.
Comparative LLM Evaluation: Local vs. Remote Inference
As part of our RAG Laboratory experiments, we evaluated multiple large language models using local inference through Ollama and remote inference through OpenRouter.
The objective was to explore differences in response quality, execution time, response completeness, and provider behavior within the same RAG application.
Reference question: How do I add and configure a processor in Apache NiFi?
| LLM Model | Provider | Total Time (s) | Response Obtained | Estimated Quality Score |
|---|---|---|---|---|
| Qwen3 8B | Ollama | 35.18 | Yes | 92/100 |
| Qwen3 4B | Ollama | 14.20 | Yes | 90/100 |
| NVIDIA Nemotron 3 Ultra 550B A55B | OpenRouter | 4.29 | Yes* | 90/100 |
| Llama 3.1 | Ollama | 12.98 | Yes | 87/100 |
| Gemma 3 4B | Ollama | 11.81 | Yes | 85/100 |
| DeepSeek-R1 | Ollama | 31.88 | Yes | Not standardized |
| NVIDIA Nemotron 3.5 Lightning | OpenRouter | 6.79 | No** | N/E |
| Cohere North Mini Code | OpenRouter | 4.42 | No** | N/E |
Table: Comparative experimental results for local and remote LLM inference. Results recorded in November 2026.
- * NVIDIA Nemotron 3 Ultra produced a visible response, with possible output truncation.
- ** No visible response was obtained in the last documented execution.
- N/E: Not Evaluated.
- DeepSeek-R1 was not assigned a standardized quality score because previous qualitative assessments were inconsistent.
- Execution times represent individual experimental runs, not average latency across repeated measurements.
- Quality scores are preliminary qualitative estimates, not results from a standardized evaluation rubric or an independently validated benchmark.
Key Experimental Findings
The results illustrate several important engineering trade-offs when integrating language models into a RAG application.
- Local inference quality: Qwen3 8B achieved the highest estimated quality score in this experiment, demonstrating the potential of locally executed models for document-based question answering.
- Quality and performance balance: Qwen3 4B achieved an estimated score of 90/100 with a total execution time of 14.20 seconds, suggesting that smaller models may offer a useful balance between response quality and computational requirements.
- Remote inference performance: NVIDIA Nemotron 3 Ultra produced a visible response in 4.29 seconds. However, possible output truncation highlights the importance of evaluating response completeness alongside latency.
- Provider reliability: Two remote model executions did not produce visible responses. These observations highlight the need for structured error handling, response validation, observability, and appropriate fallback strategies.
These observations should not be interpreted as a definitive ranking of language models. Local and remote inference operate under different hardware, networking, provider, and resource conditions. Repeated experiments and standardized evaluation criteria would be required to establish stronger comparative conclusions.
Architectural Conclusion
Selecting an LLM for an enterprise RAG system requires more than comparing model capabilities. It requires evaluating answer quality, latency, response completeness, provider reliability, and operational constraints.
These experiments also reinforce the importance of provider abstraction as an architectural decision.
By separating the RAG application from its underlying LLM providers, engineers can evaluate different models, compare local and remote inference, and introduce new generation capabilities without redesigning the entire application.
This architectural flexibility supports continuous evaluation, reduces technological coupling, and enables model selection based on measurable engineering and business requirements rather than on model popularity alone.
The objective is not simply to identify the most powerful language model. It is to identify the most appropriate model and execution strategy for the requirements of the system.
Containerization and Environment Consistency
Containers provide a practical mechanism for packaging applications and their dependencies.
For RAG systems, containerization can help standardize execution environments for APIs, supporting services, and infrastructure components.
However, containers do not automatically solve problems involving persistent storage, security, networking, resource allocation, or operational resilience.
Those concerns still require architectural decisions.
The role of containerization is to support repeatable deployment and environment consistency within a broader engineering strategy.
Designing an Azure Deployment with Bicep
Cloud deployment introduces another level of architectural responsibility.
A RAG application designed for enterprise operation must consider infrastructure provisioning, networking, access control, persistence, monitoring, and cost management. Microsoft Azure provides multiple services that can support these requirements.
Infrastructure as Code (IaC) allows engineers to describe cloud resources declaratively, making infrastructure definitions reviewable, version-controlled, and repeatable. For Azure environments, Bicep provides a declarative language for defining Azure resources or Terraform also could be used instead of Bicep.
Conceptual Azure Architecture
A cloud-oriented RAG architecture may include the following components:
Why Infrastructure as Code Matters
Infrastructure definitions maintained as code can improve consistency between environments and reduce reliance on undocumented manual configuration.
They also support code review, change tracking, and repeatable provisioning.
However, declarative infrastructure does not replace architecture validation.
Engineers must still consider network exposure, identity permissions, secrets, service dependencies, backup policies, and resource lifecycle management.
Security by Design
Security must be considered from the beginning of the architecture process.
Enterprise RAG systems may process proprietary documents, operational records, or information subject to access restrictions.
The fact that a document is semantically relevant to a query does not mean the requesting user is authorized to access it.
Authorization must be enforced by trusted application and data-access mechanisms rather than delegated to the language model.
Other security considerations include secrets management, encryption, least-privilege access, network restrictions, auditability, and protection against malicious instructions embedded in retrieved content.
Operational and Economic Design
Cloud architecture must also account for capacity, concurrency, availability, and total cost of ownership.
The cost of a RAG system may include database resources, storage, networking, inference, monitoring, backups, and supporting infrastructure.
A model with a low per-request price may still generate significant operational costs under sustained workloads.
Consequently, capacity planning and cost monitoring should be treated as architectural requirements rather than post-deployment optimizations.
Mapping RAG Laboratory Components to Azure Services
Moving a RAG application toward enterprise production requires mapping its existing components to appropriate cloud services while preserving architectural boundaries, maintainability, security, and operational requirements.
| RAG Component | Laboratory Technology | Azure Architecture |
|---|---|---|
| Application API | Python / FastAPI | Azure Container Apps |
| Application Runtime | Uvicorn / Containers | Azure Container Apps |
| Relational Database | PostgreSQL | Azure Database for PostgreSQL |
| Vector Database | PostgreSQL + pgvector | PostgreSQL Flexible Server + pgvector |
| LLM Generation | Ollama / OpenRouter | Remote LLM Provider |
| Embedding Generation | Local / Remote Models | Remote Embedding Provider |
| Container Images | Local Container Images | Azure Container Registry |
| Observability | Application Telemetry | Azure Log Analytics |
| Identity | Local Configuration | Azure Managed Identity |
| Secrets Management | Environment Variables | Container Apps Secrets |
| Infrastructure Automation | Local Scripts | Azure Bicep |
| Application Access | Local HTTP | Azure Container Apps HTTPS Ingress |
Table: Architectural mapping between RAG Laboratory components and the corresponding Azure services in the proposed cloud architecture.
Cloud migration does not necessarily require replacing application technologies. It requires mapping existing software components to infrastructure services while preserving architectural boundaries, security, and operational requirements.
The Engineering Journey: What Changed and Why
The evolution of our RAG Laboratory can be understood as a sequence of engineering questions.
We began by exploring how retrieval-augmented generation works. Then we investigated retrieval quality, model behavior, code maintainability, persistence, provider dependencies, and infrastructure design.
Each stage introduced requirements that were not necessarily visible during the initial prototype.
| Engineering Stage | Main Focus | Key Lesson |
|---|---|---|
| RAG fundamentals | Document ingestion, embeddings, retrieval, generation | A working pipeline establishes feasibility, not operational readiness. |
| Experimental evaluation | Retrieval metrics and model behavior | Quality must be measured rather than assumed. |
| Code engineering | Refactoring, documentation, testing | Maintainability requires explicit engineering effort. |
| Data architecture | PostgreSQL and pgvector | Persistence and retrieval are architectural decisions. |
| Provider integration | Local and remote model services | Abstraction reduces coupling but does not eliminate compatibility risks. |
| Operational visibility | Errors, telemetry, evaluation persistence | Engineers need evidence to diagnose system behavior. |
| Cloud architecture | Infrastructure as Code and Azure design | Infrastructure must reflect security, reliability, and cost requirements. |
This progression illustrates an important distinction. The initial challenge was to make retrieval and generation work together. The broader engineering challenge was to design a system whose behavior, dependencies, and evolution could be understood and controlled.
Lessons Learned: What We Would Do Differently
Define an Embedding Strategy Early
Embedding models influence retrieval behavior, vector storage, indexing, and migration procedures.
Rather than treating embedding selection as a temporary implementation detail, teams should establish evaluation criteria, versioning rules, and a reindexing strategy early in the project.
Establish an LLM Selection Strategy
Model selection should consider answer quality, latency, cost, privacy, availability, and provider constraints.
The objective is not necessarily to choose a single model permanently.
It is to define how models will be evaluated, selected, and changed without destabilizing the application.
Apply Security by Design
Authentication, authorization, data protection, secrets management, and auditability should be architectural concerns from the beginning.
Adding security after an application has already accumulated integrations and data dependencies can introduce unnecessary complexity and risk.
Design for Observability
A system that cannot explain its failures is difficult to operate.
Structured logging, metrics, correlation identifiers, and tracing help engineers understand failures across application and provider boundaries.
Evaluate Before Optimizing
Architectural complexity should be justified by measurable improvements.
Adding components, abstractions, or optimization techniques without evaluation may increase maintenance costs without improving user outcomes.
Preserve Experimental Evidence
Evaluation datasets, configurations, metrics, and test results should be treated as persistent engineering artifacts.
They support reproducibility, regression analysis, and evidence-based architectural decisions.
Design for Change
The AI ecosystem evolves rapidly.
Models, providers, embedding strategies, infrastructure services, and evaluation methods can change over the lifetime of an application.
A maintainable architecture should make those changes manageable rather than assuming that the initial technology stack will remain unchanged.
From Production-Oriented Design to Operational Readiness
A production-oriented architecture is an important step, but operational readiness requires explicit acceptance criteria.
An organization should define what the system must demonstrate before it is entrusted with critical business workflows.
| Dimension | Engineering Question | Evidence to Seek |
|---|---|---|
| Functional correctness | Does the application satisfy its requirements? | Automated tests and acceptance criteria |
| RAG quality | Are retrieved sources and generated answers appropriate? | Retrieval and answer-quality evaluations |
| Security | Are data and access boundaries enforced? | Authorization and security testing |
| Performance | Can the system handle expected workloads? | Latency percentiles, throughput, concurrency tests |
| Reliability | How does the system behave during failures? | Failure-injection and recovery tests |
| Observability | Can operators diagnose failures? | Logs, metrics, traces, and alerts |
| Economics | Is operation financially sustainable? | Cost forecasts and measured usage |
| Maintainability | Can the system evolve safely? | Regression tests, modularity, documentation |
This evidence-oriented approach aligns with recommendations from AWS, which emphasizes quality, cost, latency, evaluation, security, and infrastructure considerations when moving RAG applications toward production.
It also reflects a broader principle of software architecture: Architecture is not only about selecting components. It is about defining the properties a system must exhibit and establishing how those properties will be verified.
Conclusion: AI Engineering Meets Software Architecture
Retrieval-Augmented Generation has created new opportunities for organizations to use their knowledge more effectively.
Modern AI tools make it easier to construct prototypes, connect models to documents, and experiment with retrieval strategies.
However, enterprise applications require more than successful demonstrations.
They require reliable data management, clear component boundaries, security controls, automated testing, observability, operational resilience, and sustainable infrastructure.
Our RAG Laboratory illustrates how these concerns emerge as an experimental application evolves.
What began as an exploration of embeddings, vector retrieval, and language-model generation expanded into questions involving databases, software quality, provider abstraction, telemetry, and cloud architecture.
The experience reinforces an important conclusion:
AI specialists contribute essential knowledge about models, retrieval, and evaluation. Software architects contribute the systems perspective needed to integrate those capabilities into maintainable enterprise applications.
The strongest engineering approach combines these competencies rather than treating them as competing disciplines.
Ultimately, the introduction of artificial intelligence does not eliminate the principles of software engineering.
It creates new situations in which those principles must be applied.
A RAG system is still a software system. And software systems must be engineered.
References and Further Reading
The following references include institutional research, technical publications, professional perspectives, and market forecasts. They are not all equivalent forms of evidence: market projections are estimates, vendor publications provide technical guidance, and professional columns offer experience-based perspectives.
-
Grand View Research.
Retrieval Augmented Generation Market Report, 2025–2030.
Updated July 2026.
https://www.grandviewresearch.com/industry-analysis/retrieval-augmented-generation-rag-market-report -
Gartner.
Gartner Forecasts Worldwide AI Spending to Grow 49.5% in 2026.
September 16, 2026.
https://www.gartner.com/en/newsroom/press-releases/2026-09-16-gartner-forecasts-worldwide-ai-spending-to-grow-49-point-5-percent-in-2026 -
Gartner.
Why 50% of GenAI Projects Fail — And How to Beat the Odds.
January 26, 2026.
https://www.gartner.com/en/articles/genai-project-failure -
Microsoft.
RAG and the Future of Intelligent Enterprise Applications.
March 2025.
Microsoft research and enterprise analysis (PDF) -
Google Cloud.
Optimizing RAG Retrieval: Test, Tune, Succeed.
December 18, 2024.
https://cloud.google.com/blog/products/ai-machine-learning/optimizing-rag-retrieval -
NVIDIA.
How to Take a RAG Application from Pilot to Production in Four Steps.
March 18, 2024.
https://developer.nvidia.com/blog/how-to-take-a-rag-application-from-pilot-to-production-in-four-steps/ -
Amazon Web Services.
From Concept to Reality: Navigating the Journey of RAG from Proof of Concept to Production.
February 12, 2025.
AWS technical publication -
OpenAI.
How Evals Drive the Next Chapter in AI for Businesses.
https://openai.com/index/evals-drive-next-chapter-of-ai/ -
OpenAI.
Evaluation Best Practices.
Technical documentation.
https://platform.openai.com/docs/guides/evaluation-best-practices -
Anthropic.
Introducing Contextual Retrieval.
September 19, 2024.
https://www.anthropic.com/engineering/contextual-retrieval -
IBM.
Limited Control and Rising Dependencies Leave Enterprises Exposed in the Age of AI.
June 17, 2026.
IBM Institute for Business Value study -
Jacques Cornwell, Nature Careers.
In the AI Era, Coding Means Thinking Like a Systems Architect.
October 13, 2026.
https://www.nature.com/articles/d41586-026-02715-x -
Scrum Master Toolbox Podcast.
Thinking Like an Architect in the Age of AI-Assisted Coding, with Brian Childress.
2026.
Original podcast episode -
Microsoft Research.
Retrieval Augmented Generation and Beyond: A Comprehensive Survey.
2024.
Microsoft Research publication -
Productive Engineer.
The RAG Engineering Journey: Architecture, Evaluation, Performance, and Lessons from an Experimental Laboratory.
November 2026.
Read Part I -
Productive Engineer.
Why RAG Proofs of Concept Succeed but Production Deployments Struggle.
November 2026.
Read Part II
Trademark and Licensing Notice: Apache NiFi and NiFi are trademarks of The Apache Software Foundation. Apache NiFi is licensed under the Apache License, Version 2.0. This article describes an independent experimental RAG laboratory using publicly available Apache NiFi documentation . No affiliation with or endorsement by The Apache Software Foundation is implied.
Continue Building Your Productivity System
Understanding RAG architecture is only one part of engineering reliable AI applications. The next step is not simply building more sophisticated AI pipelines. It is developing the engineering practices needed to make those pipelines reliable, maintainable, and valuable within real organizations.
Explore our previous articles to learn how experimental evaluation, retrieval quality, performance analysis, and production challenges influence architectural decisions.