AI-103 · LESSON 2
Implement generative AI and agentic solutions30–35% · 3 topics
Learn to build generative apps and agents in Foundry, and to optimize and operationalize generative AI systems.
2.1Build generative applications by using Foundry
Concept
A generative app combines the system message, user input and retrieved context (RAG), passes them to the model and returns a response. Use the Chat Completions / Responses API, structured outputs (JSON schema), function calling and streaming as appropriate.
How it works / steps
- Write the role, constraints and output format in the system message
- Add few-shot examples if needed
- Search internal data with AI Search or similar and put it in the prompt as context (RAG)
- Use structured outputs with a JSON schema for output consumed downstream
- Adjust temperature and maximum tokens to the use case
Workplace example
Classify and summarize an inquiry in one call, return it with a {category, summary, urgency} JSON schema and register it directly in the ticketing system.
Common confusions and exam tips
- JSON mode guarantees only that output is JSON; structured outputs guarantee it matches the schema
- Lowering temperature does not guarantee factual accuracy (grounding is needed)
- Long conversations raise token limits and cost unless history is summarized or trimmed
Mini quiz
Q1. What is the main purpose of adopting RAG (retrieval-augmented generation)?
- Search internal documents and pass them as grounding so answers reflect current information without retraining
- Fine-tune the model on internal documents so it memorizes the latest internal information in its weights
- Put the full text of internal documents in the system message and pass the same information on every request
- Extend the model’s context length to increase the tokens handled at once
Show answer and explanation
Answer: A Search internal documents and pass them as grounding so answers reflect current information without retraining
RAG grounds answers by including retrieved evidence in the prompt. [Other options] Fine-tuning has trouble keeping up with frequent updates and cannot show sources. Inserting full text has cost and limit problems. A longer context is not a substitute for retrieval.
Q2. After giving an agent several tools, unintended tools are sometimes called. What should you review first?
- The model version used by the agent and its temperature and top_p values
- The metadata attached to tool results and the trace retention period
- The clarity of each tool’s name, description and parameter definitions (tool schema)
- The role assignments of the managed identity used to call tools
Show answer and explanation
Answer: C The clarity of each tool’s name, description and parameter definitions (tool schema)
The model reads tool descriptions and schemas to choose among them; vague ones cause wrong choices. [Other options] Model and temperature can matter, but first look at the tool definitions. Metadata and roles are not inputs to the choice.
Reference links
2.2Build agents by using Foundry
Concept
Foundry Agent Service agents combine a model, instructions and tools (file search, Code Interpreter, AI Search, grounding with Bing, functions, OpenAPI, MCP and so on) to carry out multiple steps within a thread (conversation). You can also build configurations that coordinate multiple agents (connected agents, workflows).
How it works / steps
- Define the agent’s purpose and instructions (what it does and does not do)
- Add only the tools needed (File Search or AI Search for knowledge; functions, OpenAPI or MCP for external operations)
- Create a thread, add messages and execute a run
- Check tool call results and traces
- Put approvals or permission limits on high-impact tools
Workplace example
A travel request agent checks policies with AI Search, calls the internal request API through a function and asks the employee to confirm before submitting.
Common confusions and exam tips
- With function tools the model “proposes” the call; the app executes it
- Too many tools increase the model’s selection errors
- Evaluate agents with metrics such as tool call accuracy and task adherence
Mini quiz
Q1. Over several exchanges with an employee, you want answers to take earlier questions into account. What is needed?
- A setting that lowers temperature to stabilize answers to the same question
- Management of conversation history (threads) and a policy on what to retain
- Overwriting only the previous question into the system message
- Creating a new thread per request and caching the previous response
Show answer and explanation
Answer: B Management of conversation history (threads) and a policy on what to retain
Multi-turn support requires managing conversation state. Decide what to retain from a privacy standpoint too. [Other options] A new thread per request loses context. Temperature is unrelated to retaining context. Only the previous question cannot cover several exchanges.
Q2. You want to automate order processing split into “content extraction,” “inventory check” and “exception reporting.” Which design is appropriate?
- Run the three steps in parallel on separate model deployments and concatenate the results
- Give a single agent all tools and leave the order of steps to the model
- Describe all steps in one prompt and process everything in a single call
- A multi-agent configuration that coordinates an agent per role
Show answer and explanation
Answer: D A multi-agent configuration that coordinates an agent per role
Splitting roles clarifies each agent’s responsibility and makes evaluation and improvement easier. [Other options] A single call makes per-step verification and exception handling hard. Parallel runs do not fit order-dependent steps. Leaving the order to the model makes exception reporting unstable.
Reference links
2.3Optimize and operationalize generative AI systems
Concept
Production generative AI continuously optimizes quality (evaluation), cost (tokens, model choice), performance (latency, throughput) and reliability (retries, redundancy). Build evaluation into release gates and use traces to pinpoint problems.
How it works / steps
- Set quality criteria with evaluation datasets and evaluators
- Compare whether a smaller model meets the criteria to lower cost
- Reduce cost and latency with prompt caching, output token limits and batch processing
- Implement retries and routing across multiple deployments to prepare for 429s
- Monitor production quality with traces and continuous evaluation
Workplace example
Switch classification to a smaller model while keeping answer quality, cut costs by 70%, and confirm weekly that evaluation metrics have not dropped.
Common confusions and exam tips
- The largest model is not always optimal; compare with evaluation
- Batch is cheap but cannot respond immediately
- Quality improvement and cost reduction can trade off, so measure both
Mini quiz
Q1. When evaluating a generative app, you want to detect answers containing content not in the source documents (fabrication). Which evaluation is appropriate?
- Groundedness evaluation
- Coherence evaluation
- Relevance evaluation
- Fluency evaluation
Show answer and explanation
Answer: A Groundedness evaluation
Groundedness evaluation measures whether the answer is supported by the given grounding. [Other options] Fluency and coherence measure naturalness and logical flow, and relevance measures fit to the question; none detect fabrication of content absent from the sources.
Q2. In a multi-step reasoning pipeline, the results of intermediate steps are passed to the next step. Which design is most appropriate for maintaining quality?
- Define each step’s output format and validate before moving on
- Do not record intermediate results and evaluate only the final result
- Raise the temperature at each step to get diverse intermediate results
- Combine all steps into one long prompt and run it
Show answer and explanation
Answer: A Define each step’s output format and validate before moving on
Defining and validating the format per step makes it easier to locate errors and prevents them from propagating downstream. [Other options] One prompt cannot detect intermediate errors. Higher temperature makes intermediate results unstable. Without intermediate results, causes cannot be traced.
Reference links
Lessons are written by this site based on public information and do not guarantee exam content. Product specifications change, so check the latest information at the reference links.
Notes (unofficial, original questions, no pass guarantee)
- The questions on this site are original practice questions written by this site based on publicly available skills outlines and exam guides. They are not actual exam questions.
- Microsoft, Azure, Copilot, Microsoft 365, Dynamics 365 and Power Platform are trademarks of the Microsoft group of companies. This site is not affiliated with or endorsed by Microsoft.
- This content is a study aid and does not guarantee a pass. Exam content, format and prerequisites may change without notice; always check the latest information on the official page before taking the exam.
- Your accuracy on the mock exam cannot be converted to the official (scaled) score and does not predict a pass or fail.
- Progress is saved only in this browser (localStorage) unless you sign in with Google to sync it. You can delete it from the Cookie & storage settings page (Japanese).