Azure Architecture Guide

CH14-03: Retrieval, Data Grounding, and Tool Integration

Goal

Explain how AI applications connect models to enterprise data and approved actions through retrieval and tools.

The previous section placed Azure OpenAI and Foundry in the platform model. This section adds the part that usually makes an AI application useful in a real organization: connecting the model to trusted information and controlled actions.

The Short Version

Retrieval and tools make AI useful in enterprise systems only when access, grounding, validation, and ownership are controlled.

Retrieval helps the application bring relevant enterprise content into the model's context. Tool integration lets the application or agent call approved functions, APIs, or workflows. Both are powerful. Both are risky if they ignore authorization, freshness, validation, and auditability.

The durable idea is simple:

Ground the model with authorized data, and expose actions through narrow, auditable tools.

Why Retrieval Exists

Large language models are not a live copy of your organization's data. They do not automatically know the latest policy, the newest support article, the current customer contract, or the content a specific employee is allowed to view.

Retrieval-augmented generation, often shortened to RAG, addresses that gap. The application searches approved content, selects relevant pieces, and includes them as context for the model. The model then uses that context to generate a more grounded answer.

flowchart LR
    Request["User Request"]
    Search["Retrieval<br/><small>Find relevant authorized content</small>"]
    Context["Grounded Context<br/><small>Sources, snippets, metadata</small>"]
    Model["Model Call<br/><small>Answer using provided context</small>"]
    Response["Response<br/><small>Answer, citations, limits</small>"]

    Request --> Search --> Context --> Model --> Response

In Azure, Azure AI Search is a common service for retrieval because it supports search indexes, vector search, hybrid search, semantic ranking, content preparation, and patterns for RAG. Current Azure AI Search guidance also describes agentic retrieval, where the retrieval layer can plan subqueries, use multiple knowledge sources, return structured grounding data, and support agent workflows.

Do not reduce retrieval to "put documents in a vector database." Retrieval quality depends on content preparation, chunking, metadata, relevance ranking, permission filters, freshness, source visibility, and how much context the application sends to the model.

What Grounding Means

Grounding means the model's response is connected to a trusted source or controlled context instead of relying only on general model behavior.

For example, if an employee asks about the parental leave policy, the assistant should not answer from a vague memory of common HR practices. It should retrieve the organization's policy, use the relevant sections, show or record the source, and explain any uncertainty.

Good grounding has several qualities:

QualityPractical Meaning
AuthorizedThe user or workflow is allowed to access the retrieved content.
RelevantThe retrieved content actually helps answer the question.
CurrentThe content reflects the latest approved policy or data state.
TraceableThe system can show or log which sources influenced the answer.
BoundedThe model receives enough context to answer, not every document the system can find.
TestedThe team evaluates whether retrieval improves answer quality and does not leak data.

Grounding reduces risk, but it does not eliminate risk. Retrieved text can be outdated, incomplete, misleading, or maliciously crafted. The application still needs validation, source ranking, prompt-injection awareness, and evaluation.

Tool Calling and Enterprise APIs

Tool calling lets an AI workflow request an approved action through a defined interface. A tool might search documents, create a support ticket, update a CRM record, check inventory, schedule a meeting, or call a workflow system.

The important architecture point is that the model should not receive broad access to enterprise systems. The application exposes a small set of controlled tools. Each tool has a name, purpose, input schema, validation rules, authorization checks, and logging.

Agent request
  -> choose approved tool
  -> validate parameters
  -> check authorization
  -> call enterprise API with controlled identity
  -> log result and return safe output

Tool design is API design with additional AI-specific caution. Natural language input can be ambiguous. Retrieved content can influence the model. Users may ask the agent to bypass rules. A strong tool layer treats model output as a request to validate, not as an instruction to trust blindly.

Model Context Protocol

Model Context Protocol, or MCP, is a protocol for connecting AI systems to tools and context sources in a more standardized way. It can help teams avoid bespoke integration patterns for every tool connection.

MCP does not remove the need for architecture decisions. A standard connector still needs ownership, authentication, authorization, network access, validation, logging, versioning, and incident response. The protocol can help with integration shape; it does not decide which data and actions are safe for a specific organization.

Use MCP as a connection pattern, not as a security boundary by itself.

Example: Policy Assistant with Ticket Creation

An internal assistant answers employee policy questions and can create support tickets.

The design uses retrieval for answers:

Employee asks a policy question
  -> assistant confirms employee identity
  -> retrieval query includes permission filters
  -> Azure AI Search returns relevant policy chunks and source metadata
  -> model summarizes the answer with source references

The design uses a tool for action:

Employee asks to create a ticket
  -> assistant collects required fields
  -> tool validates category, urgency, and description
  -> authorization check confirms the employee can open this request
  -> ticketing API creates the ticket with a managed workload identity
  -> action is logged with user, tool, inputs, and result

This pattern keeps the system useful without making the model an unrestricted operator. The assistant can answer and act, but only through approved retrieval and tool paths.

Design Trade-Offs

Retrieval and tools introduce choices:

ChoiceSimpler OptionMore Controlled OptionTrade-Off
Retrieval scopeOne broad indexSeparate sources with permission filtersBroad search is easier, but controlled sources reduce leakage risk.
Content freshnessPeriodic indexingEvent-driven or frequent updatesFreshness improves trust, but adds cost and operational complexity.
Answer styleModel answers freelyRequire citations and uncertainty handlingCitations add discipline, but require good source metadata and UX.
Tool accessOne powerful backend credentialNarrow tools with delegated or scoped accessNarrow tools are safer, but require more design work.
Agent autonomyLet the agent act automaticallyRequire approval for risky toolsApproval slows some workflows, but protects high-impact actions.

The right balance depends on data sensitivity, action risk, user expectations, and operational maturity.

Common Mistakes

  • Letting retrieval ignore user permissions. A good answer is still a data leak if the user was not allowed to see the source.

  • Treating retrieved text as automatically correct. Retrieval finds content; it does not prove the content is current, authoritative, or safe.

  • Sending too much context to the model. Large context can increase cost, slow responses, and confuse the answer.

  • Giving tools broad credentials. Tools should expose specific approved actions with validation and audit, not general access to internal systems.

  • Skipping source visibility. Teams need to know which content influenced important answers.

If Someone Asks You

Retrieval grounds an AI response in approved enterprise content, while tools let an AI workflow request approved actions through controlled interfaces. Both need authorization, validation, source visibility, logging, and ownership because they connect model behavior to real data and systems.

What to Remember

Ground the model with authorized data, and expose tools through controlled, auditable interfaces.

Questions to Check Understanding

  1. What problem does retrieval help solve in an enterprise AI application?

  2. Why must retrieval respect authorization rather than only search relevance?

  3. What controls should surround tool calling before an enterprise API is invoked?