RAG Orchestration Architecture
This note set starts from a concrete failure pattern — messy user input destroying downstream RAG quality — and follows the control logic that fixes it all the way up to a general request orchestration architecture.
The central idea is:
messy request
-> intention recognition
-> capability selection and governed execution
-> RAG as one capability
The design follows one discipline throughout: place a deterministic boundary at each point where probabilistic behavior causes damage, instead of trying to make the model smarter.
How To Read This Set
- CH00 tells the origin story; read it first to see why the architecture looks the way it does.
- CH01–CH02 are the control path (intention → orchestration); CH03 is the largest capability behind it.
- Use the internal-layer and evaluation chapters as reference depth, not front-to-back reading.
The Control Path
CH00_Preface.mdThe origin story: a real dirty-input RAG problem, and why the fix had to move upstream of retrieval.CH01_Intention-Recognition-Layer.mdThe first deterministic boundary: routing contract, ambiguity handling, and worked cases showing clarify/reject/execute decisions before any expensive work runs.CH02_Request-Orchestration-Layer.mdThe shared runtime for a company-wide agent system: capabilities, tools, and why only the orchestration layer may sequence tool calls.CH02_01_Runtime-Objects.md— the typed objects (interpretations, decisions, records) that make every step replayable and testable.CH02_02_State-Machine-and-Control-Loop.md— request states, retries, budgets, fallback, and event flow through the loop.CH02_03_Confidence-Safety-and-Validation.md— stage-scoped confidence assessment and the execution/validation decision tables.
The RAG Subsystem
CH03_RAG-Layer.mdEntry overview for the knowledge pipeline, plus the named end-to-end reference stack (MinerU → Elasticsearch + Qdrant → BGE reranker → direct LLM API with Instructor/Guardrails helpers).CH03_01_Ingestion-Validation-Layer.mdOffline quality gate: parse / OCR, structure reconstruction, validation, and quarantine so bad documents never reach the index.CH03_02_Enrichment-Chunking-Indexing-Layer.mdTurning validated documents into retrievable units: enrichment with authoritative/inferred separation, structure-aware chunking, lexical plus vector indexing.CH03_03_Retrieval-Layer.mdThe online evidence-finding pipeline: query shaping, permission-aware filtering, hybrid candidate retrieval, fusion and reranking, context assembly.CH03_04_Grounded-Answering-Layer.mdThe final guard: thin grounded generation with citation integrity, five explicit outcomes including abstention, and known failure modes of this layer.
Evaluation
CH04_Testing-and-Evaluation.mdWhat makes the design reviewable rather than aspirational: minimum test matrix, golden-case structure, first-version acceptance thresholds, and regression strategy on top of the CH02_01 runtime objects.
Principles Behind The Design
The worldview is not re-derived here; it lives in standalone articles:
- AI Coding 的防御性进化:平台化、业务解耦与结构的自然生长 Why bounded sandboxes, rigid platform foundations, and late abstraction beat premature DRY when AI writes most of the code.
- 文艺复兴:从 Linux 老派教条看 AI 时代的函数开发 Why small pure modules with strong contracts and explicit boundaries hold up under an AI caller.
- A First-Principles Architecture for Agent Routing and Safety Harnesses The full derivation of model-proposes-harness-executes, orthogonal verification, and risk-proportional authorization.
- Harness Engineering 合集 The six-part series on harnesses as the deterministic runtime around a probabilistic engine — boundary placement, context discipline, comparator design, and governed execution.
How those principles show up in this set:
- intention recognition exists because input quality is the earliest useful control point
- the harness owns permissions and escalation because reasoning should not imply execution authority
- evaluator contracts sit outside generation because correctness needs an external comparator
- context discipline exists because state is costly, degradable, and attention-limited
- layers stay modular so failures remain local and ownership stays clear
- no platform was designed first; orchestration grew out of a concrete RAG fix (the origin story is
CH00_Preface.md) - RAG was split into internal layers only after each layer’s responsibility stabilized
- policy stays central in definition but local in enforcement
One guardrail that follows from this style: a new layer earns its existence only by defining a real responsibility boundary, hiding unstable details, creating a stable contract, or improving reuse and ownership. A wrapper that forwards the same parameters inward without changing responsibility or ownership is ceremony, not modularity.
What This Set Covers And What It Does Not
Covered:
- why bad input harms downstream RAG quality and cost
- why intention recognition should happen before expensive retrieval
- how that control pattern grows into broader request orchestration
- why the harness is the authority boundary for execution
- how RAG fits as one capability inside a governed system
- a named end-to-end reference stack, assembled in
CH03_RAG-Layer.md
Not yet defined:
- calibration of the first-version confidence thresholds against labeled data
- detailed per-domain golden sets for routing, permission, and retrieval
- full production alert thresholds for latency, failure, and escalation drift
Testing and Evaluation
Saturday, August 15, 2026 in RAG Orchestration Architecture
Categories:
Purpose This note defines the minimum testing and evaluation matrix for the orchestration and RAG architecture. Its job is to answer one question: What is the minimum set of tests, golden cases, and acceptance thresholds needed before this …
State Machine and Control Loop
Monday, July 20, 2026 in RAG Orchestration Architecture
Categories:
Purpose This note defines how the request orchestration runtime moves. It focuses on lifecycle control rather than object structure. The main questions are: what states can a request enter how control returns to routing how retries and loop caps are …
Runtime Objects
Monday, July 20, 2026 in RAG Orchestration Architecture
Categories:
Purpose This note defines the main runtime objects used by the request orchestration layer. Its job is to answer a simple question: What durable objects should exist if the orchestration runtime is to be executable, observable, and reviewable? This …
Confidence, Safety, and Validation
Monday, July 20, 2026 in RAG Orchestration Architecture
Categories:
Purpose This note defines how the request orchestration runtime stays safe and reliable. It focuses on three tightly related concerns: input safety and scope control confidence-aware decision making validation before a result is accepted Related …
Retrieval Layer
Wednesday, July 15, 2026 in RAG Orchestration Architecture
Categories:
Purpose The retrieval layer is the online evidence-finding subsystem of RAG. Its job is to turn a well-shaped user request into a grounded context set that downstream answering can trust. It does this by: representing the request in …
Request Orchestration Layer
Wednesday, July 15, 2026 in RAG Orchestration Architecture
Categories:
Purpose The request orchestration layer is the shared control layer for a company-wide agent system. It extends the intention recognition layer (CH01) into a broader runtime: the front half — request conditioning, interpretation, ambiguity …
RAG Layer
Wednesday, July 15, 2026 in RAG Orchestration Architecture
Categories:
Purpose The RAG layer is the knowledge access and grounding capability inside the orchestration runtime. Its job is not simply to “retrieve documents”. Its real job is to: transform source material into retrievable knowledge retrieve the …
Preface
Wednesday, July 15, 2026 in RAG Orchestration Architecture
Categories:
Why This Design Exists This design started from a concrete RAG problem. The initial issue was simple: RAG performs badly when the input request is dirty, ambiguous, underspecified, or expressed in a form that does not match the downstream knowledge …
Intention Recognition Layer
Wednesday, July 15, 2026 in RAG Orchestration Architecture
Categories:
Purpose The intention recognition layer is the control layer that sits between raw user input and retrieval/reasoning. Its job is not only to “understand the user”, but to reduce ambiguity, narrow search space, control cost, and decide …
Ingestion Validation Layer
Wednesday, July 15, 2026 in RAG Orchestration Architecture
Categories:
Purpose The ingestion validation layer is the upstream data production layer for the RAG system. Its job is to transform raw source artifacts into validated canonical documents that are safe enough to pass downstream into enrichment, chunking, and …