Writing
2026-09-19 · 14 min

A best-practice infrastructure for Azure agentic RAG systems

An agentic RAG system is not a bigger chatbot. It is a distributed system whose inputs include probabilistic components, and whose outputs will be audited. This is a reference-shaped account of how I compose one on Azure so it survives that audit — and so it can be rolled back on a Wednesday afternoon without a war room.

The composition, in one paragraph

Governed source data lives in Azure Data Lake Storage and Databricks (Unity Catalog). Ingestion and indexing run as Databricks jobs that write to Azure AI Search, which serves both dense and sparse retrieval. Azure OpenAI provides the generation models, with model versions pinned per environment. An orchestrator — built in Azure AI Foundry or in code — coordinates specialist agents that each own a bounded task and call typed tools. Every consequential action goes through a deterministic validation layer before it reaches a system of record. Evaluation runs as a Databricks job on a curated question set on every release candidate. Observability is per-request tracing plus aggregate dashboards. Deployment is Azure DevOps, gated by evaluation results.

Layers, in the order I build them

1. Data foundation

  • ADLS + Unity Catalog as the governed source. Access boundaries defined here, not downstream.
  • Bronze / silver / gold for the source documents so re-indexing is a replay, not a rebuild from scratch.
  • Deletion propagation is a first-class flow. If a document is redacted upstream, the index must know within the SLA the business agreed to.

2. Retrieval index

  • Azure AI Search for hybrid retrieval. Vector for meaning, BM25 for identifiers and rare tokens.
  • Per-tenant / per-domain indexes where authorisation boundaries differ. One index per policy boundary keeps access control auditable.
  • Index lifecycle — creation, re-embedding, blue-green swap — expressed as pipeline stages, not runbooks.

3. Generation

  • Azure OpenAI with deployment names pinned per environment. Model version drift is a governance event, not a background config change.
  • Content filtering configured at the resource, and its behaviour asserted in evaluation.
  • Prompts as versioned artefacts. A prompt change is a code change.

4. Orchestration

  • Azure AI Foundry (or code) as the orchestrator. Choice depends on how much of the flow needs to be visible to non-engineers.
  • Specialist agents with bounded responsibilities. A retrieval agent, a reasoning agent, a validation agent, a tool-caller. Each with a typed contract.
  • Typed tool contracts. JSON schemas for every tool call, validated on both sides. Errors are structured, not stringly-typed.
  • Deterministic validation around anything that touches a system of record. The LLM proposes, the validator disposes.

5. Human-in-the-loop

  • Confidence thresholds route to human review for anything below the bar the business has agreed to.
  • Escalation surfaces designed for the operator, not the model. The human sees the trace, not just the answer.
  • Feedback capture flows back to the evaluation set so decisions the humans make become the next release's ground truth.

6. Evaluation

  • Retriever eval on golden question-passage pairs. Runs on every PR that touches ingestion, chunking or embedding.
  • Answer eval — faithfulness, groundedness, answer relevance — on a representative journey set. Runs on every release candidate.
  • Safety / red-team eval for known failure modes. Runs on every model or prompt change.
  • Release gates in Azure DevOps that read the eval results and block if a threshold regresses.

7. Delivery

  • Azure DevOps pipelines with an environment-per-branch model. Nothing reaches production without passing through staging with real evaluation.
  • Terraform for the resource graph so the environment is a version, not a state.
  • Blue-green at the deployment name / traffic-split layer of Azure OpenAI so a bad model version can be reversed in minutes.

8. Observability

  • Per-request traces preserving the full chain: query, retrieved passage IDs, prompt version, tool calls, validator decisions, model version, output.
  • Aggregate dashboards for latency, cost, retrieval recall proxies and safety-filter hit rate.
  • Cost attribution per feature and per tenant. Otherwise, cost surprises arrive as invoices, not alerts.

Anti-patterns I actively avoid

  • One giant prompt that tries to do routing, retrieval reasoning and tool-calling in a single call. It cannot be evaluated in parts.
  • Unbounded autonomy. Agents that decide when to stop. They don't.
  • Access control in the generator. If the retriever returned it, the generator has seen it.
  • Evaluation only at go-live. A one-off eval is not an eval; it is a gate. The eval must run whenever the thing under it changes.
  • Silent model upgrades. Any behaviour change from a model version bump must be visible in eval results.

How I know it's working

The tell that this architecture is doing its job is boring: releases go out with evaluation deltas attached, rollbacks are single-command, and postmortems point at specific traces rather than adjectives. A working agentic RAG system on Azure looks a lot like a working software system — because that is exactly what it is.