Architecture Design and Delivery Practices for Multi-Agent RAG Applications

    Multi-agent retrieval-augmented generation (RAG) splits planning, retrieval, evidence analysis, answer generation, and review across specialized execution units so complex knowledge tasks stay reliable and maintainable. This article explains when a fixed RAG pipeline is enough, how to set layer and role boundaries, and how ingestion, retrieval, controlled orchestration, shared state, security, evaluation, and a staged rollout determine whether extra agents actually improve outcomes.

    1. From Knowledge Q&A to Multi-Agent Collaboration

    Large language models can understand natural language and produce fluent answers, but the knowledge stored in their parameters is not the same as a current, complete, and authorized enterprise knowledge base. When users ask about the latest policies, internal procedures, or specific business rules, relying on the model alone often leads to outdated information, missing details, and unsupported inferences.

    Retrieval-augmented generation, or RAG, brings external knowledge retrieval into the answering process. The system first finds material related to the question, then provides that material as context so the model can organize an answer. This approach makes knowledge easier to update, preserves sources, and fits applications that must access private materials.

    RAG does not automatically eliminate hallucinations. Retrieved results may be irrelevant, documents may already be obsolete, and the generation model may misinterpret evidence. A production system therefore has to address three questions at once: what was found, how it should be understood, and whether the answer can be proven.

    Multi-agent RAG adds a division of responsibilities on top of that foundation. Separate execution units handle task planning, document retrieval, evidence organization, answer generation, and result review. An “agent” here does not have to be a separately deployed large model. It can be an execution module with a clear goal, tool permissions, state, and stopping conditions. Some responsibilities can also be implemented directly as deterministic programs.

    The engineering goal is not to maximize the number of agents. It is to make the handling of complex questions more reliable and easier to maintain.

    2. Decide Whether the Project Needs Multiple Agents

    2.1 Prefer a fixed flow for simple questions

    If users mainly look up facts in a single knowledge base—for example, the effective date of a policy—a fixed flow of question handling, retrieval, generation, and citation checking is usually enough.

    Adding multiple agents in this setting introduces extra model calls, context passing, and scheduling overhead without necessarily improving answer quality.

    2.2 Split responsibilities for complex questions

    A multi-agent design is a better fit when:

    • One question requires policies, operating manuals, and business records at the same time.
    • The user asks several sub-questions that must be retrieved separately and then synthesized.
    • Documents differ by version or conflict with each other, so applicability must be judged.
    • The answer involves calculation, conditional logic, or synthesis across documents.
    • The business requires traceable evidence for every key conclusion.

    For example, “Under what conditions can this type of project move to the next stage, and which approval materials are required?” may involve eligibility rules, exception clauses, an approval process, and a document checklist. A single retrieval pass can easily miss one of those parts, while task decomposition helps the system cover the different information needs.

    2.3 Do not treat fine-tuning and RAG as complete substitutes

    Fine-tuning is better suited to adjusting output style, task behavior, or specific capabilities. RAG is better suited to external knowledge that changes often and must be traced to a source. The two can be combined, but neither replaces access control, data governance, or result verification.

    3. Build a Layered Architecture and Clear Boundaries

    Split the application into five layers:

    1. User request
    2. ↓
    3. Access layer: authentication, input checks, request rate limiting
    4. ↓
    5. Orchestration layer: task planning, state management, budget control
    6. ↓
    7. Execution layer: retrieval, evidence analysis, generation, review
    8. ↓
    9. Knowledge layer: source documents, indexes, metadata, permission data
    10. Cross-cutting governance: audit, evaluation, monitoring, exception handling

    3.1 Planning agent

    This agent determines the question type, identifies information gaps, and splits the work into subtasks. Its output should be structured rather than free text that is hard to parse.

    A plan usually needs to include:

    • The question the user actually needs answered.
    • Sub-queries that can be executed independently.
    • The document scope and time conditions required for each query.
    • Which tasks need tools and which can be handled directly.
    • The conditions that mark a task as complete.

    The planning agent must not invent business facts, and it must not expand the user’s access rights on its own.

    3.2 Retrieval agent

    This agent chooses a retrieval method and assembles candidate evidence. It may use keyword search, vector search, or both, but it must always stay within the user’s authorized scope.

    Results are not just text. They should also include document identifiers, section locations, versions, effective times, and relevance information so later stages can judge them.

    3.3 Evidence-analysis agent

    This agent decides whether the material actually answers the question and identifies applicability conditions, exception clauses, and conflicting content.

    It should clearly separate three kinds of information: facts stated directly in documents, inferences drawn from those facts, and parts where evidence is insufficient. Repeated copies of the same conclusion across several documents are not independent sources and do not count as cross-validation.

    3.4 Generation and review agents

    The generation module forms an answer from the evidence. The review module checks whether key conclusions are supported, whether citations are valid, and whether limiting conditions were omitted.

    Review should not rely only on another model judgment. Whether a citation identifier exists, whether the user has permission, and whether a numeric calculation is correct should be verified by programmatic rules wherever possible.

    4. Ingestion Sets the Ceiling on Retrieval Quality

    4.1 Document parsing and cleaning

    Knowledge processing should preserve heading hierarchy, table relationships, list structure, and necessary context. Noise such as repeated headers, meaningless whitespace, and recognition errors should be cleaned, but notes, units, and conditional statements that affect business meaning must not be removed.

    For scanned documents, pay attention to text-recognition quality. For tables, avoid separating field names from their corresponding values. Parsed content should ideally be locatable back to the source so citations can be shown and errors investigated.

    4.2 Split along semantic boundaries

    Chunks that are too large reduce retrieval precision and consume generation context. Chunks that are too small lose semantic relationships.

    A more reliable approach is to split by sections, paragraphs, and semantic boundaries, keeping a small overlap when needed. Chunk size should be chosen from document structure, model context limits, and evaluation results rather than copied as a universal number.

    For content organized as “general provisions—scope of application—exceptions,” keep a parent-child structure: retrieve the fine-grained passage first, then add the necessary background from its parent section.

    4.3 Complete metadata and version management

    Each knowledge fragment should record:

    • Document and fragment identifiers.
    • Title, section, and source location.
    • Business type and scope of application.
    • Publication time, effective time, and expiration status.
    • Users or organizations allowed to access it.
    • Content version and integrity information.

    When a document is updated, the retrieval index and cache must be updated together. Material that is deleted or whose access is revoked must be removed from the searchable scope promptly. Changing only how a page is displayed is not enough.

    5. Design the Path from Query to Evidence

    5.1 Query understanding and rewriting

    Users may use abbreviations, colloquial language, or incomplete phrasing. The system can add synonyms, resolve time ranges, or split sub-questions, but it must not turn an originally ambiguous condition into a definite fact on its own.

    If a missing condition would change the answer—for example, the user did not specify a business type or policy version—ask for clarification first, or state how the answer differs under each condition.

    5.2 Hybrid retrieval and reranking

    Keyword retrieval fits exact terms, identifiers, and specialized fields. Vector retrieval fits expressions that are semantically close but worded differently. Combining them improves coverage of candidate material.

    Raw scores from different retrieval methods are usually not directly comparable, so merging should use an appropriate fusion strategy rather than simple addition. Reranking then selects the passages most relevant to the current question and filters duplicates, expired material, and out-of-scope documents.

    5.3 Assemble a verifiable evidence package

    What enters generation should be an organized evidence package, not an undifferentiated pile of long text. The package should keep source identifiers, applicability conditions, and necessary context, and it should mark unresolved questions.

    When evidence is insufficient, the system should choose a limited number of follow-up retrievals, ask the user for clarification, or state clearly that it cannot confirm the answer. Repeated searching should not be used to manufacture a false sense of certainty.

    6. Implement a Minimum Viable System with a Controlled Flow

    The following is language-neutral illustrative pseudocode. Every function represents a business module you must implement yourself and does not correspond to any specific product interface.

    1. function answer_question(request):
    2. identity = authenticate(request)
    3. budget = create_budget(request)
    4. state = create_state(request.question, identity)
    5. plan = create_plan(state.question, budget)
    6. validate_plan(plan)
    7. evidence = []
    8. for task in bounded_parallel(plan.tasks):
    9. results = retrieve(
    10. task.query,
    11. access_scope = identity.access_scope,
    12. filters = task.filters,
    13. budget = budget
    14. )
    15. evidence.extend(results)
    16. evidence = deduplicate_and_rank(evidence)
    17. assessment = assess_coverage(plan, evidence)
    18. if assessment.needs_clarification:
    19. return clarification_response(assessment)
    20. if assessment.has_gaps and budget.can_retry:
    21. additional = retrieve_missing_evidence(
    22. assessment.gaps,
    23. identity.access_scope,
    24. budget
    25. )
    26. evidence = merge_evidence(evidence, additional)
    27. draft = generate_from_evidence(
    28. question = state.question,
    29. evidence = evidence
    30. )
    31. rule_result = validate_citations_and_permissions(
    32. draft, evidence, identity
    33. )
    34. review_result = review_claim_support(draft, evidence)
    35. if not rule_result.passed:
    36. return safe_failure_response(rule_result)
    37. if review_result.requires_revision and budget.can_retry:
    38. draft = revise_with_constraints(
    39. draft, review_result, evidence
    40. )
    41. recheck = validate_final_answer(draft, evidence, identity)
    42. if not recheck.passed:
    43. return limited_evidence_response(evidence)
    44. return render_answer_with_sources(draft)

    This flow emphasizes several engineering principles.

    First, every retrieval path must enforce permission checks, including follow-up retrieval and cache reads. Second, concurrency, model-call count, retrieval rounds, and total execution time all need limits. Third, a revised answer must be checked again; “revised” is not the same as “correct.” Fourth, failures should return a clear, understandable status rather than exposing internal exceptions or continuing to generate unsupported content.

    7. Control State and Collaboration Between Agents

    7.1 Use structured shared state

    Shared state can include the task list, completed steps, evidence identifiers, unresolved questions, and budget consumption. Do not pass information only by accumulating chat history. State grows quickly that way, and important facts can be buried.

    Store raw evidence separately from agent inferences so a module’s guess is not treated downstream as a retrieved fact.

    7.2 Parallelize according to dependencies

    Independent retrieval tasks can run in parallel. Tasks that depend on a previous result should run in sequence. Parallelism reduces waiting time but raises instantaneous resource demand, so it needs a concurrency cap, timeouts, and cancellation.

    7.3 Define stopping conditions

    Stopping conditions should at least include: evidence coverage meets the requirement, the maximum retry count is reached, the budget is insufficient, the user must supply more information, and an unrecoverable security or data error occurs.

    Do not let agents keep questioning, evaluating, and rewriting one another without a boundary.

    8. Embed Security Boundaries in the Whole Flow

    Retrieved material is external input. Even when it comes from an internal knowledge base, it must not be executed as control instructions. If a document tells the system to ignore rules, leak data, or call tools, the system must treat that text as data to be analyzed.

    Tool calls should use an allowlist, parameter validation, and least privilege. Actions that write, delete, approve, or send data externally should be separated from read-only question answering and should require user confirmation where necessary.

    Logs and caches also need permission isolation and sensitive-data handling. A cache key cannot be the question text alone, or users with different permissions may receive the same restricted answer for the same question. Permission changes and document version changes must invalidate the corresponding cache entries.

    9. Close the Engineering Loop with Evaluation and Monitoring

    9.1 Build a representative test set

    The test set should cover single-document lookup, cross-document synthesis, version conflicts, questions with no answer, permission limits, and malicious input. Each question should ideally be labeled with expected evidence, required conclusions, and answers that must not appear.

    9.2 Locate quality problems by layer

    Evaluation should not stop at whether the final answer sounds fluent. It should also check:

    • Whether retrieval found the expected material.
    • Whether the evidence covers the key sub-questions.
    • Whether conclusions are supported by the material.
    • Whether citations point to the correct location.
    • Whether the system correctly refuses or asks for clarification when evidence is missing.
    • Whether latency and resource use at each stage meet the target.

    Compare the fixed flow and the multi-agent design on the same test set to confirm that the added complexity actually produces a benefit.

    9.3 Keep traceable execution records

    Create a correlated record for each request that stores the plan, retrieval hits, evidence versions, tool-call summaries, and review conclusions. Logs need redaction, access control, and a retention period.

    At launch, start with a limited release. Continuously watch refusal rate, retrieval failure rate, citation errors, and response latency, and keep a mechanism to fall back to the basic RAG flow.

    10. Delivery Path and Summary

    A practical project can move in four steps: first organize the knowledge and permission model; then implement basic RAG and establish a quality baseline; next introduce planning and evidence analysis only for clearly complex questions; finally complete security, monitoring, evaluation, and cost governance.

    The core value of multi-agent RAG is not simulating several roles chatting together. It is breaking a complex knowledge task into steps with clear boundaries, verifiable inputs and outputs, and a traceable execution path.

    Multi-agent collaboration can steadily improve system capability only when knowledge governance, retrieval quality, access control, and evaluation form a closed loop. For enterprise applications, reliable evidence and a controlled process always matter more than a larger number of agents.