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

  1. Write the role, constraints and output format in the system message
  2. Add few-shot examples if needed
  3. Search internal data with AI Search or similar and put it in the prompt as context (RAG)
  4. Use structured outputs with a JSON schema for output consumed downstream
  5. 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

Mini quiz

Q1. What is the main purpose of adopting RAG (retrieval-augmented generation)?

  1. Search internal documents and pass them as grounding so answers reflect current information without retraining
  2. Fine-tune the model on internal documents so it memorizes the latest internal information in its weights
  3. Put the full text of internal documents in the system message and pass the same information on every request
  4. 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?

  1. The model version used by the agent and its temperature and top_p values
  2. The metadata attached to tool results and the trace retention period
  3. The clarity of each tool’s name, description and parameter definitions (tool schema)
  4. 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

  1. Define the agent’s purpose and instructions (what it does and does not do)
  2. Add only the tools needed (File Search or AI Search for knowledge; functions, OpenAPI or MCP for external operations)
  3. Create a thread, add messages and execute a run
  4. Check tool call results and traces
  5. 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

Mini quiz

Q1. Over several exchanges with an employee, you want answers to take earlier questions into account. What is needed?

  1. A setting that lowers temperature to stabilize answers to the same question
  2. Management of conversation history (threads) and a policy on what to retain
  3. Overwriting only the previous question into the system message
  4. 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?

  1. Run the three steps in parallel on separate model deployments and concatenate the results
  2. Give a single agent all tools and leave the order of steps to the model
  3. Describe all steps in one prompt and process everything in a single call
  4. 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

  1. Set quality criteria with evaluation datasets and evaluators
  2. Compare whether a smaller model meets the criteria to lower cost
  3. Reduce cost and latency with prompt caching, output token limits and batch processing
  4. Implement retries and routing across multiple deployments to prepare for 429s
  5. 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

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?

  1. Groundedness evaluation
  2. Coherence evaluation
  3. Relevance evaluation
  4. 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?

  1. Define each step’s output format and validate before moving on
  2. Do not record intermediate results and evaluate only the final result
  3. Raise the temperature at each step to get diverse intermediate results
  4. 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)