Your profile

One profile for every MSDEVBUILD site. Only you can see it, and the site owner if you write in.

Lesson 2 of 39
❮Prev Next❯

Retrieval, Indexing and Agent Memory Choices

Module 1: Plan & Manage ⏱ 11 min read Updated

Your note

My notes for this lesson

Select any text in the lesson to highlight it or add a note. Saved in this browser.

    No highlights yet. Select a sentence in the lesson, then pick a colour or add a note.

    All my bookmarks and notes

    Reading settings

    For every lesson, saved in this browser.

    Text size
    Line spacing
    Font

    With IaaS you rent the virtual machine. Microsoft looks after the building, power and hardware; you patch the operating system.

    30-second answer

    Put curated company content in a Foundry IQ knowledge base on Azure AI Search, which can use keyword, vector, hybrid (best default) and semantic ranking, and agentic retrieval to plan sub-queries. Use file search for files a user uploads in a conversation. Use memory for what the agent learns about a person across sessions: user profile memory and chat summary memory, scoped per user. Plan indexing with indexers (pull) or the push API, chunking and integrated vectorization. Connect other tools with MCP, OpenAPI or functions. Knowledge answers "what's true here", memory answers "what do we know about this person".

    Simulate it » No Azure account needed

    Exam objective: 1.1.3 Choose an appropriate method for retrieval and indexing. 1.1.4 Choose appropriate memory, tool and knowledge integration services for agent solutions. (Skills measured as of April 16, 2026)

    Simulations

    Feel it before you read it. No account needed, nothing leaves this page.

    Azure portal: Give an agent knowledge, file search and memory Add a knowledge base, file search and memory to an agent.
    </> Embed

    Embed this simulation

    Free for trainers, teachers and bloggers. Paste this into your page:

    Loading the portal…

    Open <strong>Build ➜ Knowledge</strong> and create a knowledge base for the company policies.

    👆 Click the glowing item in the portal to continue

    Read the steps as text
    1. Open Build ➜ Knowledge and create a knowledge base for the company policies.
    2. Pick the knowledge sources (an existing search index, blob storage, SharePoint or the web) and the search service. Reasoning effort trades speed for better query planning.
    3. On the agent: attach kb-policies for curated company content, turn on file search for files users bring, and turn on memory for what it should remember about each user.
    4. Memory is long-term: it extracts facts, consolidates them and recalls them in later sessions. Scope it per user and set a retention so it forgets on schedule.
    5. Test it. The second week, the agent still knows the user is vegetarian, and it cites the policy for the refund answer.

    🧪 Simulation for learning. Screens are simplified versions of the Azure portal; names, prices and IDs are examples. Nothing here touches real Azure.

    😟 THE PROBLEM

    The agent forgets customers between chats and makes up policy details.

    😊 THE SOLUTION

    Ground it on a knowledge base, let it search uploaded files, and give it long-term memory.

    • Invented policy answers✓ A Foundry IQ knowledge base on Azure AI Search
    • A user’s own contract✓ File search over that upload
    • “I told you last week”✓ User profile memory
    🛠️ Solved with: Foundry IQ, file search and memory

    Start with a question

    Should the shop assistant remember your name, or read the refund rules from the wall?

    A good assistant does both, and keeps them apart. The refund rules are on the wall for everyone. Your name and your dislike of coriander are in the assistant’s head, for you alone.

    An AI agent needs the same split. The wall is a knowledge base that anyone can read and the company controls. The assistant’s head is memory, filled in as it talks to each person. Mix them up and you get an agent that invents policy or forgets the customer.

    Explain it like I’m 10

    The technical explanation

    MethodWhat it matchesUse it for
    Keyword (full text)Exact words with BM25 rankingCodes, names, part numbers
    VectorMeaning, using embeddingsQuestions worded differently from the document
    HybridKeyword and vector, mergedThe usual default for RAG
    Semantic rankerRe-orders the top results by meaningBetter order, captions, answers
    Agentic retrievalA model plans sub-queries and runs them in parallelMulti-part questions over several sources

    A Foundry IQ knowledge base wraps agentic retrieval. You add knowledge sources (an existing search index, Blob Storage, SharePoint or the web), choose how much reasoning effort the query planner uses, and agents call the knowledge base as a tool. The agent gets grounded passages with citations.

    Plan the indexing

    1. Source: Blob Storage, Azure SQL, Cosmos DB, SharePoint, or your own app.
    2. Ingest: an indexer pulls on a schedule and tracks changes, or you push documents through the API.
    3. Chunk the text so a piece is small enough to retrieve and to fit in the prompt. Overlap chunks a little so sentences aren’t cut off.
    4. Vectorize with an embedding model. Integrated vectorization does chunking and embedding for you during indexing and at query time.
    5. Enrich with metadata (department, effective date, language) so you can filter, and so retrieval can skip retired content.
    6. Refresh on a schedule, and deal with deletions, or the agent quotes yesterday’s policy.

    Other ways an agent gets information

    • File search: a vector store built from files a user uploads in a conversation (or you attach to the agent). Good for one person’s contract, not for company-wide content.
    • Azure AI Search tool: point the agent straight at an index you already built.
    • Web search (grounding with Bing): fresh public information.
    • MCP servers, OpenAPI tools and functions: live data and actions from other systems.

    Memory

    Memory typeHoldsExample
    User profileStable facts and preferences“Vegetarian”, “prefers email”
    Chat summaryA summary of each past conversation“Asked about a refund on order 48213”

    Scope memory to a user (for example {user_id}), set a retention time, and let the user see and delete it. Memory is in preview in Foundry as of 25 November 2026, so check Microsoft Learn before you rely on the details.

    Architect level Why pure vector search isn't enough

    Embeddings capture meaning, so “can I get my money back” finds the refund page. They’re weak at exact strings. Search for “PCI-07” and a vector index may return other compliance pages that feel similar. Keyword search nails the exact code. Running both and merging is cheap insurance, and the semantic ranker then puts the best passage first.

    Real-world business scenario

    Food delivery

    Fabrikam Foods (fictional)

    The problem
    The support agent quoted a refund policy that ended last quarter and asked returning customers about dietary needs they'd already given.
    What they used
    A Foundry IQ knowledge base over the policy library in Blob Storage with a nightly indexer and an effective-date filter, file search for order receipts, and user profile memory scoped to each signed-in customer.
    Why that choice
    The indexer removed retired policies and kept the library current. Memory carried preferences across sessions, and the two stores stayed separate, so policy never ended up in a customer's profile.
    The result
    Wrong-policy complaints fell sharply, and customers stopped repeating their dietary needs in every chat.

    When to use it and when not to

    ✓ Use it when…

    • Answers must come from company documents, with citations.
    • Users ask a mix of exact-term and plain-language questions (hybrid).
    • The agent serves returning users whose preferences matter.

    ✕ Think twice when…

    • You store personal preferences in the shared knowledge base.
    • You index once and never refresh or delete.
    • You turn on memory without a user scope, retention time or a way to delete.

    ↔ Alternatives to consider

    • File search when the content belongs to one conversation.
    • Web search grounding for public, fresh facts.
    • A database tool or MCP server when the answer is a live record, not a document.
    Ready for more?The full lesson adds the technical explanation, when to use it, interview questions and revision notes.

    Test yourself with exercises

    5 original practice questions in the AI-103 style. Pick your answers, then check them. You will see why each option is right or wrong. Score 75% or more and this topic is marked complete.

    Question 1

    Question 1 of 5

    Users search a policy index for exact control codes such as PCI-07 and also ask questions in plain language. Which retrieval approach should you use?

    Question 2

    Question 2 of 5

    A customer uploads their own contract to a chat and asks the agent questions about clause 7. The contract must not become part of the shared knowledge.

    Which capability should the agent use?

    Question 3

    Question 3 of 5

    An agent should remember that a signed-in customer is vegetarian in later sessions. What should you configure?

    Question 4

    Question 4 of 5

    An Azure AI Search index feeds an agent from a Blob Storage container that receives new files daily. Retired files must disappear from answers. Which approach should you plan?

    Question 5

    Question 5 of 5

    What is the main purpose of chunking documents before indexing them for retrieval?

    Interview preparation

    Say your answer out loud first, then open the model answer. Interviewers care more about your reasoning than the exact words.

    Beginner What's the difference between knowledge and memory for an agent?

    Model answer

    Knowledge is what's true for everyone, like the refund policy, and it comes from a knowledge base or search index. Memory is what the agent learned about one person, like "she's vegetarian". Knowledge is curated by the company. Memory is built from conversations and scoped to the user.

    Intermediate Why hybrid search for a policy assistant?

    Model answer

    Keyword search is great for exact terms like "PCI-07" or a part number, and vector search is great when the user words it differently from the document. Hybrid runs both and merges the lists, so I get both kinds of hit. Adding the semantic ranker then orders the top results by meaning.

    Experienced developer How do you decide between an indexer and pushing documents yourself?

    Model answer

    If the data lives in a supported source such as Blob Storage, SQL or Cosmos DB, an indexer handles scheduling, change tracking and skills for me. I'd push through the API when the data comes from my own app and needs near real-time updates, or the source isn't supported.

    Scenario Users complain the agent forgets their allergies, and sometimes quotes a retired policy. What do you change?

    Model answer

    Two separate fixes. For allergies, I'd turn on user profile memory scoped to the signed-in user. For the retired policy, I'd fix the index: a scheduled indexer that notices deletions, and metadata such as effective date so retrieval can filter. Memory can't fix stale knowledge, and a fresh index can't remember a person.

    Quick revision

    Key points

    • Knowledge bases (Foundry IQ on Azure AI Search) hold curated company content and return cited passages.
    • Hybrid search with semantic ranking is the usual strong default. Pure vector misses exact terms.
    • File search covers files a user uploads in a conversation, without a separate index build.
    • Memory is per user (user profile and chat summary). Knowledge is shared and curated.
    • Index with an indexer for supported sources, or push through the API. Chunk, and enrich with metadata.

    Important terminology

    Hybrid search
    A query that runs keyword and vector search together and merges the results. Usually the best starting point for retrieval-augmented generation.
    Semantic ranker
    An Azure AI Search feature that re-ranks the top results by meaning and can return captions and answers.
    Agentic retrieval
    A retrieval mode where a model plans sub-queries from a conversation, runs them in parallel and returns grounded passages. It powers Foundry IQ knowledge bases.
    Chunking
    Splitting documents into pieces before indexing so each piece is small enough to retrieve and fits the model's context.
    Integrated vectorization
    An Azure AI Search feature that chunks content and calls an embedding model during indexing and at query time, so you don't write that code.
    Agent memory
    A store of information the agent learned about a user across sessions, such as preferences. Separate from knowledge, and scoped to one user.

    Common mistakes

    • Using memory to store company policy, or a knowledge base to store personal preferences.
    • Pure vector search for part numbers and codes.
    • Building a one-off index and never scheduling refreshes, so answers go stale.

    Exam tips

    • "Exact codes and meaning-based matches" = hybrid search.
    • "User uploads a file in chat" = file search.
    • "Remember preferences across sessions" = memory, scoped per user.
    • "Plans sub-queries over several sources" = agentic retrieval / a Foundry IQ knowledge base.

    Five quick revision questions

    1. 1.Which search mode combines keyword and vector results?Show

      Hybrid search.

    2. 2.Where do company policies belong for an agent?Show

      In a knowledge base on Azure AI Search (Foundry IQ).

    3. 3.Which agent feature handles a user's own uploaded file?Show

      File search.

    4. 4.What are the two kinds of memory most agents need?Show

      User profile memory and chat summary memory.

    5. 5.What does chunking do?Show

      Splits documents into small pieces for indexing and retrieval.

    Official references

    Finished this lesson? Tick it off. Your progress is saved in this browser.

    Next up: Foundry Infrastructure and Deployment Options

    Studying with a friend? Send them this lesson

    It's free and needs no sign-up. Their progress saves in their own browser.

    Lesson done? Make it stick with a quick gameSort It, Match the Pairs, Lightning Round and Who Am I? Earn XP and badges. Play ❯

    Install MSDEVBUILD Azure

    Free · no account · works offline

    Save the whole course for offline ›

    Hi, I’m your Nimbus

    Your study buddy. Pick what we do next.

    MSDEVBUILD · Multi-Stack Dev Build

    Sign in to MSDEVBUILD

    One account for Azure certifications and the blog: sign in here and you are signed in on both. Your XP, streak, practice deck and certificate stay in sync on every device. Optional: everything works without an account.