Save the Grounded Playground as an Agent

Lab overview

Make the grounded playground permanent. In this lab, you re-attach the contoso-policies index you built in the last lab, add the help desk instructions, and save the result as contoso-helpdesk-agent. Then you test the agent against the same questions as before, confirm it appears in the project's agent list, and see that its instructions and knowledge are now stored with it.

Why you'd do this

Everything you've built so far lives in a playground session, and a playground session is scratch paper. Close the tab and the instructions, the attached index, and the tool configuration are gone; the next person has to reassemble them by hand. An agent is the saved, named version of that assembly: one object that bundles the model deployment, the instructions, and the knowledge sources, with a version number so you can change it later without losing what worked. Saving is what turns an experiment into something a team can share, evaluate, and ship.

The first step in this lab is the most useful habit it teaches: re-attaching an existing index instead of uploading the documents again. The contoso-policies index from lab 5 already holds the embedded chunks; pointing a new session (or a new agent) at it costs nothing and keeps every agent in the project reading from one source of truth. Upload the same files twice and you have two indexes to keep in sync.

The instructions you paste this time are different from lab 3's. They tell the model not only who it is but to answer from the attached documents and to defer when the documents are silent. Watch how the three test prompts exercise that: the password question gets a cited answer, the chili recipe gets refused as out of scope, and the vacation question, which the documents don't cover, gets routed to HR instead of guessed at. That combination of grounding plus scope-aware instructions is what makes a help desk assistant trustworthy.

For certification prep, creating a prompt agent in Foundry Agent Service and understanding agent instructions, tools, and versions are named AI-103 objectives, and the agent components material appears in AI-901.

Lab details

  • Deployment: contoso-chat
  • Vector Index: contoso-policies (re-attached, no upload)
  • Instructions: Contoso IT help desk prompt, grounded in the attached documents
  • Agent: contoso-helpdesk-agent, version 1
  • Test Prompts: password expiration, chili recipe, vacation days

Learning objectives

  1. Re-attach an existing vector index to a model without uploading again.
  2. Write instructions that tie a model's answers to its attached documents.
  3. Save a playground configuration as a prompt agent.
  4. Explain what carries over into an agent and how agent versioning works.

Exam relevance

  • AI-901 — Microsoft Azure AI Fundamentals — AI agents and their components, grounding with your own data.
  • AI-103 — Developing AI Apps and Agents on Azure — create a prompt agent in Foundry Agent Service, agent instructions, tools, and versions.

How this lab fits into the project

This is lab 6 of 12 in the Contoso Knowledge Assistant project. Contoso's IT help desk fields the same policy questions all day, so over this series you'll build an AI agent that answers them from the company's own documents, then ground it, secure it, evaluate it, monitor it, and publish it to Teams. This lab is where the assistant becomes an agent: a saved, named, versioned package of model, instructions, and knowledge that the remaining labs build on.

Step-by-step instructions

  1. Open the playground and remove Web search:
    • In the Foundry portal, click Build, then Models.
    • Click contoso-chat to open its playground.
    • In the Tools section, click the ⋮ next to Web search and click Remove.
  2. Re-attach the existing policy index:
    • Click Upload files.
    • Click the Index option dropdown and select the contoso-policies index you created earlier.
    • Click Attach.
    • Note that File search now appears in the Tools section.
  3. Add the help desk instructions:
    • Click the Online Notepad browser tab, press Ctrl+A to select the instructions, and press Ctrl+C to copy them.
    • Click the Microsoft Foundry browser tab.
    • Double-click the default text in the Instructions box and press Ctrl+V to paste the new instructions.
  4. Save as an agent:
    • Click Save as agent.
    • Type contoso-helpdesk-agent as the agent name and click Create.
    • Note that you're now in the agent playground, and that the instructions, the contoso-chat model, and File search with contoso-policies all carried over.
  5. Test the agent:
    • In the chat box, type What is Contoso's password expiration policy? and click send.
    • Note the grounded answer of 120 days and the citation.
    • Click the new chat icon, type What's a good chili recipe?, and click send.
    • Note that the agent declines because the question is outside IT support.
    • Click the new chat icon, type How many vacation days do Contoso employees get?, and click send.
    • Note that the agent stays in scope and points the user to HR.
  6. Confirm the agent was saved:
    • Click Agents in the left pane.
    • Note contoso-helpdesk-agent in the list, and its version.
    • Click contoso-helpdesk-agent and note that the instructions and File search are still in place.
    • Click Microsoft Foundry to return to the home page.

An Introduction to Microsoft Entra ID

Learn what you need to know to get started with Microsoft Entra ID with this easily-digestible 5-hour bootcamp from best-selling instructor, Thomas Mitchell.

Disable these ads by becoming a labITpro Supporter!

Azure vNets Explained

Want to learn about Azure virtual networks? In this quick-hitting explanation, you’ll learn what they are, what they do, and you’ll learn about key Azure vNet features.

Disable these ads by becoming a labITpro Supporter!