Building a Real-World AI-Powered .NET Application

Building a Real-World AI-Powered .NET Application

GenAI-Powered .NET Β· double-click any text to add a note Β· hover dotted terms for definitions
Tutorial 27 of 27 Advanced C#

1 Overview: Everything, Assembled

This is the capstone. Every tutorial from Azure OpenAI deployment through response-quality evaluation taught one piece — embeddings, RAG, agents, MCP, security, deployment, LLMOps, evaluation. This tutorial is not a new piece; it is the discipline of building one complete, real-world .NET application using all of them together, in the order and combination a real project actually demands: plan the scope, design the system, integrate the model, write and refine prompts, abstract the AI logic behind a clean service boundary, handle errors and secrets properly, build a usable UI, add guardrails and fallbacks, test and tune quality, deploy it safely, and govern it responsibly — while knowing, throughout, when AI is even the right tool for the job.

This is an advanced, comprehensive tutorial. Its thirteen subtopics are not a checklist of separate features; they are the phases a real GenAI .NET project moves through, each one a direct application of a specific earlier tutorial's teaching to the concrete decisions a real build requires. Four reference project ideas — an FAQ assistant, a resume analyzer, an internal knowledge bot, and a code-review assistant — anchor the discussion in concrete, buildable scopes rather than abstract principle, and the step-by-step section builds one of them end to end.

Nothing in this tutorial is new mechanism. Every technique has a home earlier in this course. This tutorial's value is entirely in the ordering, the integration, and the judgment calls a real project forces that a single-topic tutorial never has to make.

2 Learning Objectives

  • Scope an AI feature through sprint planning and use-case definition before writing any code.
  • Design a complete system — UI, API, AI service, configuration — for a real GenAI .NET application.
  • Integrate Azure OpenAI in .NET behind a service abstraction, with refined prompts, proper error handling, and secure configuration.
  • Build usable UI/UX with input handling, validation, guardrails, and fallback logic for AI-driven features.
  • Test end to end and tune response quality before deploying, applying deployment best practices and enterprise governance.
  • Judge when AI is the right tool versus traditional code, and apply this whole discipline to one of four reference project types.

3 Prerequisites

  • Every prior tutorial in this course, at least at a conceptual level — this tutorial assumes familiarity with tutorials 10 through 26 and cites the specific tutorial behind each technique it uses.
  • Working .NET and Azure OpenAI setup (tutorial 10) and comfort with the chat completion API (tutorial 11).
  • A specific project idea in mind, ideally one of this tutorial's four reference projects, to ground the walkthrough in something concrete rather than abstract.
  • Time and willingness to actually build something — this tutorial is best absorbed by doing the step-by-step walkthrough, not just reading it.
If you've been building along with this course, you likely already have working pieces — a RAG pipeline, a service layer, a deployed and monitored app. This capstone is about assembling and completing those pieces into one coherent project, not starting from zero.

4 Key Concepts: A Real Project Has Phases, Not Just Topics

A real GenAI .NET project moves through recognizable phases, and this tutorial's thirteen subtopics map onto four of them. Phase one is deciding what to build and how it fits together: sprint planning and use-case scoping, system design, and the judgment of when to use AI versus traditional code. Phase two is building the AI capability itself: Azure OpenAI integration, prompt refinement, and service abstraction. Phase three is making it robust and safe: error handling and logging, secure configuration, and validation/guardrails/fallback logic. Phase four is making it usable and shippable: UI/UX and input handling, end-to-end testing and quality tuning, deployment best practices, and enterprise governance.

Phase Subtopics Earlier tutorials it draws on
Plan & Design Sprint planning/scoping, system design, AI-vs-traditional-code judgment Tutorials 10, 16, 20 (architecture judgment)
Build the AI Service Azure OpenAI integration, prompt refinement, service abstraction Tutorials 11, 13, 15, 17, 26
Robustness & Safety Error handling/logging, secure configuration, validation/guardrails/fallback Tutorials 13, 20, 24
Ship & Govern UI/UX, end-to-end testing, deployment, enterprise governance Tutorials 14, 22, 23, 24, 25

The fourteenth item — reference project ideas — is not a fifth phase; it's the concrete scope every other subtopic gets applied to. This tutorial builds one of the four (an internal knowledge bot) end to end in the step-by-step section, and discusses how the same four phases apply, with different emphasis, to the other three.

Treat this tutorial as a project retrospective written in advance: the mistakes and decisions a real team encounters, organized so you can make better ones the first time.

5 Deep Dive 1: Plan and Design — Scoping, System Design, and the AI-vs-Code Judgment

Sprint planning and use-case scoping for an AI feature starts with defining, precisely, what the feature will and won't do — use-case scoping — before any code exists. Unlike deterministic features, an AI feature's uncertainty isn't just 'will we finish the code in time' but 'will the model actually perform well enough on this task,' which argues for scoping down to an MVP (minimum viable product) that validates the core hypothesis (can the model answer these questions well?) before investing in the full feature surface (streaming, multi-turn memory, tool integration). Sprint planning for AI work should budget explicit time for prompt iteration and evaluation (tutorial 26), which a purely code-focused estimate omits.

System design lays out the application's layers before implementation: a UI (tutorial 14) that a user interacts with; an API layer exposing the feature over REST or streaming endpoints; an AI service (deep-dive 2) that owns all model interaction behind a clean boundary; and configuration (deep-dive 3) supplying credentials, prompts, and tunable parameters to that service. Drawing this out — even as a simple box diagram — before writing code prevents the common mistake of AI logic leaking directly into a controller or a view.

🎬 The four-layer system design
Every reference project in this tutorial shares this shape.
UI user interaction
➜
API REST / streaming endpoints
➜
AI service owns all model calls
➜
Configuration credentials, prompts, params

The judgment of when to use AI versus traditional code belongs in this planning phase, not after the feature is built. AI is the right tool when a task requires interpreting unstructured natural language, handling open-ended variation a fixed rule set can't enumerate, or synthesizing across sources in a way that resists a deterministic algorithm. Traditional code is the right tool when the logic is fully specifiable in advance, needs perfect reliability, or where a simple lookup or rule already solves the problem — adding a model call to a task a dictionary lookup already handles adds cost, latency, and non-determinism for no benefit. A resume analyzer's field extraction from free-text resumes is a good AI fit; validating that a required field is non-empty afterward is not — that's a one-line traditional check.

Scope creep is especially dangerous on AI features because 'just add one more capability' often means 'add one more tool the model can misuse' or 'add one more edge case the prompt now has to handle correctly.' Scope discipline in planning pays off disproportionately later.

6 Deep Dive 2: Build the AI Service — Integration, Prompt Refinement, Service Abstraction

Azure OpenAI integration in .NET (tutorial 11) is the mechanical foundation: an AzureOpenAIClient, a chat deployment, and the chat completion call. In a real project, this integration never stands alone — it is built once, inside the AI service, and never called directly from anywhere else in the application. Prompt refinement and optimization (tutorial 26) is not a one-time step during initial build; it's the ongoing practice of observing real outputs, identifying a specific failure pattern, and making one targeted change at a time, validated against a golden dataset before it ships.

The AI service: integration and prompt behind one boundary
public interface IKnowledgeBotService
{
    Task<BotAnswer> AskAsync(string question, CancellationToken ct = default);
}

public sealed record BotAnswer(string Text, IReadOnlyList<string> Sources, bool Truncated);

public sealed class KnowledgeBotService : IKnowledgeBotService
{
    private readonly ChatClient _chat;
    private readonly ISearchService _search;              // tutorial 15 retrieval
    private readonly ILogger<KnowledgeBotService> _logger;
    private readonly BotOptions _options;                  // deep-dive 3: bound configuration

    // Constructor takes everything via DI (tutorial 13) -- nothing constructed inline.
    public KnowledgeBotService(AzureOpenAIClient client, ISearchService search,
                               IOptions<BotOptions> options, ILogger<KnowledgeBotService> logger)
    {
        _chat = client.GetChatClient(options.Value.DeploymentName);
        _search = search;
        _options = options.Value;
        _logger = logger;
    }

    public async Task<BotAnswer> AskAsync(string question, CancellationToken ct = default)
    {
        var passages = await _search.RetrieveAsync(question, k: 5, ct);
        var messages = BuildGroundedPrompt(question, passages);   // refined prompt (deep-dive 2)
        var completion = await _chat.CompleteChatAsync(messages,
            new ChatCompletionOptions { Temperature = _options.Temperature }, ct);

        return new BotAnswer(
            completion.Value.Content[0].Text,
            passages.Select(p => p.Title).ToList(),
            completion.Value.FinishReason == ChatFinishReason.Length);
    }
}

Service abstraction for AI logic (tutorial 13) is what makes every downstream subtopic manageable: the interface (IKnowledgeBotService) is what the API layer, tests, and any future refactor depend on, while the concrete class is the only thing that knows Azure OpenAI exists. Swapping the SDK, moving to Semantic Kernel (tutorial 17), or adding a second model provider later touches this one class, not the rest of the application — the exact payoff the whole course has built toward since tutorial 13 first introduced it.

Write the interface first, based on what the API layer actually needs to call ('ask a question, get an answer with sources'), not based on what the SDK offers. An interface shaped like the SDK is the abstraction leaking.

7 Deep Dive 3: Robustness and Safety — Errors, Secrets, Validation, and Guardrails

Error handling and logging (tutorial 13) inside the AI service means every call is wrapped in resilience (timeout, retry with backoff for 429s) and structured logging (latency, token counts, finish reason — never prompt bodies by default, per tutorial 24). Secure configuration management (tutorial 13) follows the same hierarchy every project in this course has used: Managed Identity first, Key Vault for what can't be eliminated, user secrets strictly for local development, and never a key in source control or appsettings.json.

Validation, guardrails, and fallback logic wrapping the AI call
public async Task<BotAnswer> AskSafelyAsync(string question, CancellationToken ct)
{
    // Input validation (tutorial 24): bound length, reject empty input.
    if (string.IsNullOrWhiteSpace(question) || question.Length > 1000)
        return new BotAnswer("Please ask a shorter, specific question.", [], false);

    try
    {
        var answer = await AskAsync(question, ct);

        // Guardrail: refuse to return an answer with zero supporting sources for a factual bot.
        if (answer.Sources.Count == 0)
            return new BotAnswer("I couldn't find anything relevant to answer that.", [], false);

        return answer;
    }
    catch (ClientResultException ex) when (ex.Status == 429 || ex.Status >= 500)
    {
        _logger.LogWarning("AI call failed after retries: {Status}", ex.Status);
        // Fallback logic: a safe, honest degraded response instead of an error page.
        return new BotAnswer("The assistant is temporarily busy. Please try again shortly.", [], false);
    }
}
🎬 Every request passes through validation, the AI call, and a guardrail before reaching the user
Robustness is layered, not a single try/catch.
Input validation length, emptiness
➜
AI call with retry/backoff
➜
Guardrail check e.g. sources required
➜
Fallback on failure or refusal
➜
User sees answer or safe message
Fallback logic must be honest, not just present. A fallback that silently returns a generic 'here's some info' when the real answer was unavailable is worse than clearly telling the user the system couldn't help this time.

8 Deep Dive 4: Ship and Govern — UI/UX, Testing, Deployment, Governance

UI/UX and input handling (tutorial 14) for an AI feature needs the five states tutorial 14 established — idle, loading, success, error, cancelled — plus, for streaming, visible progress rather than a silent wait. End-to-end testing and response-quality tuning combines tutorial 22's golden-dataset regression testing with tutorial 26's relevance/groundedness/consistency checks, run before every release, not just once at launch. Deployment best practices (tutorial 23) mean infrastructure as code, Managed-Identity-based model access, canary rollout for prompt changes, and the monitoring dashboards (tutorial 25) that make the deployed system's health visible.

Enterprise governance for GenAI ties every prior subtopic into an organizational practice: a production readiness checklist (secrets secured, guardrails tested, evaluation passing, dashboard owned) that a feature must satisfy before shipping; a defined review process for new AI features, especially ones touching sensitive data or consequential actions; and a recurring cadence (tutorial 25's monthly review pattern) revisiting cost, quality, and security as the system and its usage evolve. Governance is what makes 'we followed every tutorial's best practice on this one feature' scale into 'our organization reliably builds safe AI features.'

Production readiness item Verified by From tutorial
No secrets in source; Managed Identity or Key Vault in use Configuration review 13
Input validated, output guardrails in place, fallback tested Code review + manual test 24, this tutorial
Golden dataset passing; relevance/groundedness checked Evaluation run 22, 26
Deployed via infrastructure as code; canary rollout available Deployment review 23
Dashboard live with an assigned owner; alerts routed Operational review 25
Security review complete (injection, data privacy) Security review 24
Enterprise governance is not a gate that slows a small, low-stakes project to the pace of a regulated financial system. Scale the checklist's rigor to the feature's actual stakes — the discipline is having a checklist at all, not applying maximum weight uniformly.

9 Ecosystem and Tools

Tool / tutorial reference Role in a real-world build
Azure OpenAI + Azure AI Foundry (tutorials 10, 16) Model deployment and platform-managed access
Azure AI Search (tutorial 15) Retrieval backend for RAG-shaped reference projects (FAQ assistant, knowledge bot)
Semantic Kernel / AutoGen (tutorials 17-19) Orchestration framework option for agentic reference projects (code-review assistant)
Azure Key Vault + Managed Identity (tutorial 13) Secure configuration management
Application Insights + Azure Monitor (tutorials 23, 25) Logging, telemetry, and operational dashboards
A golden dataset + evaluation harness (tutorials 22, 26) End-to-end testing and response-quality tuning
Azure App Service / Container Apps (tutorial 23) Deployment target
Azure AI Content Safety (tutorial 24) Guardrail layer for content moderation

Every row here is a specific tutorial's tool, reused rather than reintroduced. This tutorial's contribution is the integration: choosing which of these a specific reference project actually needs, and in what order to build them.

10 Use Cases: The Four Reference Projects

Four reference project ideas anchor this course's techniques in concrete, buildable scopes. Each applies the same four-phase discipline from this tutorial's deep dives, with different emphasis.

  • FAQ assistant: the simplest RAG-shaped project (tutorial 15) — a knowledge base of Q&A pairs or short documents, retrieval, and a grounded, cited answer. Best first project; minimal tool use, straightforward evaluation (does it answer known FAQs correctly).
  • Resume analyzer: extracts structured fields (skills, experience, education) from unstructured resume text and optionally scores fit against a job description. Emphasizes prompt design for structured extraction, output validation (does the extracted JSON parse correctly), and a clear AI-vs-code line (extraction is AI; downstream business rules on the extracted fields are traditional code).
  • Internal knowledge bot: a RAG system (tutorial 15) over internal documentation, often extended with tools (tutorial 12/17) to check live systems (ticket status, policy lookups). This tutorial's step-by-step builds this one. Emphasizes retrieval quality, tool governance (tutorial 20), and enterprise rollout (tutorial 23).
  • Code-review assistant: analyzes a code diff and generates review comments, often combining traditional static analysis (a linter, a security scanner) with AI-generated commentary on style, clarity, or design — a clean example of AI augmenting rather than replacing deterministic tooling. Emphasizes the build-vs-buy-vs-augment decision and careful prompt design to avoid noisy, low-value comments.

All four share the system design from deep-dive 1 (UI, API, AI service, configuration) and the robustness practices from deep-dive 3. What differs is scope (deep-dive 1's judgment call), the specific tools and data sources integrated (deep-dive 2), and the evaluation criteria that matter most (deep-dive 4) — a resume analyzer cares most about extraction accuracy, a code-review assistant cares most about comment usefulness and low false-positive rate.

11 Code Examples: Assembling the Layers

These examples show the API layer and DI registration tying together everything from deep-dives 1-3 into one runnable composition.

Example 1 — Program.cs: the full composition (system design made real)
var builder = WebApplication.CreateBuilder(args);

// Secure configuration (deep-dive 3 / tutorial 13): bind and validate at startup.
builder.Services.AddOptions<BotOptions>()
    .Bind(builder.Configuration.GetSection("KnowledgeBot"))
    .ValidateDataAnnotations().ValidateOnStart();

// AI service registration: singleton client, Managed Identity in production.
builder.Services.AddSingleton(sp =>
{
    var opts = sp.GetRequiredService<IOptions<BotOptions>>().Value;
    return new AzureOpenAIClient(new Uri(opts.Endpoint), new DefaultAzureCredential());
});
builder.Services.AddSingleton<ISearchService, AzureSearchService>();   // tutorial 15
builder.Services.AddSingleton<IKnowledgeBotService, KnowledgeBotService>();  // deep-dive 2

// Observability (tutorial 23/25).
builder.Services.AddApplicationInsightsTelemetry();
builder.Services.AddHealthChecks().AddCheck<AzureOpenAIHealthCheck>("azure-openai");

var app = builder.Build();
Example 2 — The API endpoint: UI/UX support via streaming plus error handling
app.MapPost("/api/ask", async (AskRequest req, IKnowledgeBotService bot, CancellationToken ct) =>
{
    // Guardrail + validation live inside the service (deep-dive 3); the endpoint stays thin.
    var answer = await bot.AskSafelyAsync(req.Question, ct);
    return Results.Ok(new AskResponse(answer.Text, answer.Sources, answer.Truncated));
});

public record AskRequest(string Question);
public record AskResponse(string Answer, IReadOnlyList<string> Sources, bool Truncated);
Example 3 — A minimal end-to-end evaluation run before deployment
// tutorial 22/26 evaluation, run in CI before a canary rollout (tutorial 23).
var goldenSet = LoadGoldenDataset("knowledge-bot-golden.json");
var results = await RunQualityEvaluationAsync(goldenSet, botService, ct);

double avgGroundedness = results.Average(r => r.Groundedness);
if (avgGroundedness < 4.0)
    throw new InvalidOperationException("Groundedness regression detected; blocking deployment.");

12 Step by Step: Building the Internal Knowledge Bot End to End

This walkthrough builds the internal knowledge bot reference project from scratch, applying all thirteen subtopics in the order a real project would.

  1. Sprint planning and scoping: define the MVP — answer questions from a fixed set of 20-30 internal policy documents, no tools yet, no multi-turn memory. Write down explicitly what's out of scope for v1 (live ticket lookups, multi-turn conversation) to prevent scope creep.
  2. System design: sketch the four layers (deep-dive 1) — a minimal web UI, a single /api/ask endpoint, a KnowledgeBotService, and configuration for the Azure OpenAI and Azure AI Search connections.
  3. Decide AI vs. traditional code: confirm the core Q&A task genuinely needs a model (open-ended natural-language questions over unstructured documents) while noting that document ingestion/chunking (tutorial 15) is traditional deterministic code, not an AI call.
  4. Build Azure OpenAI integration and the service abstraction together (deep-dive 2): implement IKnowledgeBotService and KnowledgeBotService with the RAG retrieval and grounded prompt from tutorial 15.
  5. Refine the prompt: run 10 real questions, evaluate relevance and groundedness (tutorial 26), and make one targeted refinement to the grounding instruction based on the most common failure observed.
  6. Add error handling, logging, and secure configuration (deep-dive 3): wrap the service call with tutorial 13's resilience, structured logging, and bind configuration via Managed Identity, never a hardcoded key.
  7. Add validation, guardrails, and fallback logic: bound input length, add the 'no sources found' guardrail from Example in deep-dive 3, and confirm the fallback message is honest and clear.
  8. Build the UI: a simple page with the five states from tutorial 14 (idle, loading, success, error, cancelled), streaming the answer if time allows.
  9. Run end-to-end testing: build a 15-20 question golden dataset, run the full relevance/groundedness/consistency evaluation from tutorial 26, and fix any failures found before proceeding.
  10. Deploy following tutorial 23's practices: infrastructure as code, a health check, and a dashboard (tutorial 25) with token spend and latency visible from day one.
  11. Apply enterprise governance: run through the production readiness checklist from deep-dive 4, and document the project's scope, evaluation results, and known limitations for whoever operates it next.
  12. Reflect and plan the next iteration: identify the single most valuable next capability (perhaps a tool for live ticket status) and repeat this same thirteen-subtopic cycle for that increment, rather than building everything in one pass.
Step 12 is the point of the whole tutorial: a real AI feature is never 'done' after one pass through these thirteen subtopics. It's a cycle, and knowing that from the start is what separates a sustainable AI feature from an unmaintainable one-off.

13 Limitations and Caveats

  • This tutorial's code is illustrative of shape and integration, not a complete, production-ready codebase — every SDK signature caveat from tutorials 11-21 still applies to the specific pieces shown here.
  • The four reference projects are starting scopes, not fixed specifications; real requirements will push each in directions this tutorial doesn't anticipate.
  • Applying all thirteen subtopics fully to a genuinely trivial internal tool may be disproportionate; scale rigor to actual stakes, as tutorial 20 and this tutorial's governance section both note.
  • The step-by-step walkthrough compresses what a real team might spend weeks on into a linear list; real projects iterate, backtrack, and revisit earlier phases as later phases reveal new information.
  • This tutorial cannot substitute for the depth of its 26 predecessors; where a technique feels underexplained here, that's intentional — the full treatment is in the tutorial cited alongside it.
  • Enterprise governance requirements vary enormously by organization and industry; this tutorial's checklist is a reasonable baseline, not a substitute for organization-specific policy or legal/compliance review.
  • Reference project choice should reflect genuine organizational need, not novelty; building a code-review assistant when no one asked for one wastes the scoping discipline deep-dive 1 argues for.
  • Skipping evaluation, leaving tool access unscoped, or shipping an unrefined prompt to save time creates technical debt that costs more to fix once real users depend on the feature than it would have cost to do right initially.
  • AI capability and model behavior continue to evolve; specific prompt patterns and workarounds in this tutorial (and its predecessors) may need revisiting as models improve or change.

14 Best Practices

  • Scope to an MVP that validates the core AI hypothesis before building the full feature surface — sprint planning should budget explicit time for prompt iteration and evaluation.
  • Design the four-layer system (UI, API, AI service, configuration) before writing implementation code, so AI logic never leaks into a controller or view.
  • Build the service abstraction from day one, even for a small project — retrofitting it later is real work every subsequent subtopic makes harder to skip.
  • Treat prompt refinement as ongoing practice tied to evaluation evidence, never a one-time step completed at launch.
  • Apply tutorial 13's error handling/logging and secrets discipline and tutorial 24's validation/guardrail discipline together — robustness and safety are one integrated practice, not two separate checklists.
  • Design all five UI states and test the fallback path deliberately, not just the happy path.
  • Run end-to-end evaluation before every release, gating deployment on it, exactly as tutorial 22's regression testing and tutorial 23's canary rollout intend.
  • Revisit the AI-vs-traditional-code judgment at every iteration — a capability that seemed to need a model may prove to have a simpler, more reliable non-AI solution once real usage patterns are understood.
Common mistake Do this instead
Building the full feature before validating the core AI hypothesis Scope an MVP that tests the riskiest assumption first
AI SDK calls scattered across controllers and views One AI service behind an interface, called from one place
Treating prompt design as done after the first working version Ongoing refinement tied to evaluation evidence
Shipping without a golden-dataset evaluation pass Gate every release on relevance/groundedness/consistency checks
A production readiness checklist applied nowhere or everywhere uniformly Scale governance rigor to the feature's actual stakes
Assuming a task needs AI because it's an 'AI project' Re-evaluate AI vs. traditional code at every iteration

20 Summary

  • A real GenAI .NET project moves through four phases — Plan & Design, Build the AI Service, Robustness & Safety, Ship & Govern — each a direct application of specific earlier tutorials, not a new technique.
  • System design (UI, API, AI service, configuration) and the AI-vs-traditional-code judgment belong in the planning phase, before implementation begins.
  • Azure OpenAI integration, prompt refinement, and service abstraction are built together, since the abstraction is what all downstream error handling, testing, and deployment attach to.
  • Robustness and safety layer input validation, resilient error handling, secure configuration, guardrails, and honest fallback logic together — none sufficient alone.
  • Shipping responsibly means UI/UX with real state handling, evaluation before every release, deployment best practices, and enterprise governance scaled to actual stakes.
  • The four reference projects — FAQ assistant, resume analyzer, internal knowledge bot, code-review assistant — share this same discipline, differing in scope, integrations, and evaluation focus; and the whole thirteen-subtopic cycle repeats for every future increment, never finishing after one pass.

You have now completed the full arc of this course: from a single Azure OpenAI chat completion call in tutorial 11 to a complete, planned, built, hardened, tested, deployed, and governed real-world application in this tutorial. Every technique — embeddings, RAG, agents, MCP, security, deployment, LLMOps, evaluation — has a place in the discipline this final tutorial assembled. What you carry forward is not a list of APIs, but the judgment to scope well, design cleanly, build safely, ship responsibly, and keep improving — the actual, durable skill of building AI-powered .NET applications that work in the real world, not just in a demo.

21 Next Steps

This is the final tutorial in the GenAI-Powered .NET course. There is no next tutorial in this series — the path forward is applying this course's discipline to a real project of your own, using this tutorial's four reference project ideas as concrete starting points if you don't already have one in mind.

  • Practice: pick one of the four reference projects and complete the full step-by-step walkthrough from this tutorial end to end, building a genuinely deployed, evaluated, monitored application.
  • Practice: apply the production readiness checklist from deep-dive 4 to a project you've built earlier in this course, and close any gaps it reveals.
  • Practice: run the AI-vs-traditional-code judgment (deep-dive 1) against a real backlog item at your organization, and document the reasoning either way.
  • Practice: after your first version ships, deliberately run the 'reflect and plan the next iteration' step and complete one more full cycle, experiencing the repeating discipline this tutorial insists on.
  • Revisit: any earlier tutorial (10 through 26) whose techniques you haven't yet applied hands-on — this capstone assumes familiarity, but real fluency comes from building, and every earlier tutorial's step-by-step walkthrough is still there to practice with.
The course is complete, but the discipline it taught is not a one-time achievement — it's a practice. The best next step is building something real, applying this tutorial's thirteen concerns to it, and then, per this tutorial's own final lesson, doing it again for the next increment.

15 Quiz: Building a Real-World AI-Powered .NET Application

Pick an answer for each question, then press Check answer. (Notes are disabled in this tab.)

1. Why should sprint planning for an AI feature budget explicit time for prompt iteration and evaluation?

βœ… Correct!
❌ Not quite β€” the correct answer is .
Unlike deterministic code where correctness is mostly a function of writing the logic correctly, an AI feature's success depends on whether the model actually performs well on the task — validated through prompt iteration and evaluation, which needs its own scheduled time distinct from implementation coding time.

2. What are the four layers in this tutorial's system design for a GenAI application?

βœ… Correct!
❌ Not quite β€” the correct answer is .
The UI collects input and displays results; the API exposes endpoints; the AI service is the single place that owns model interaction; configuration supplies credentials and tunable parameters — this four-layer shape recurs across all four reference projects in this tutorial.

3. According to this tutorial, when is traditional code the better choice over an AI call?

βœ… Correct!
❌ Not quite β€” the correct answer is .
AI fits open-ended, unstructured-language tasks; traditional code fits fully specifiable, deterministic logic. Adding a model call to a task a dictionary lookup or a simple validation rule already handles adds cost, latency, and non-determinism for no benefit.

4. In the knowledge bot example, why does the AI service (not the API endpoint) own validation and guardrail logic?

βœ… Correct!
❌ Not quite β€” the correct answer is .
The service abstraction (tutorial 13) centralizes everything related to the AI interaction — including validation and guardrails — behind one interface, keeping the API layer thin and ensuring the safety logic applies consistently regardless of what calls the service.

5. What must fallback logic provide when the primary AI call fails or is refused by a guardrail?

βœ… Correct!
❌ Not quite β€” the correct answer is .
Fallback logic must be honest, not just present — a fallback that silently returns generic content when the real answer was unavailable is worse than clearly telling the user the system couldn't help, per this tutorial's explicit warning.

6. What does end-to-end testing and response-quality tuning for a real AI application combine?

βœ… Correct!
❌ Not quite β€” the correct answer is .
Real end-to-end testing for a GenAI application combines the repeatable evaluation infrastructure from tutorial 22 with the specific response-quality judgment techniques (relevance, groundedness, consistency) from tutorial 26, run as an ongoing practice before every release, not once at launch.

7. What does the production readiness checklist in this tutorial verify before a feature ships?

βœ… Correct!
❌ Not quite β€” the correct answer is .
The checklist ties together secrets/configuration (tutorial 13), validation/guardrails (tutorial 24), evaluation (tutorials 22/26), deployment practices (tutorial 23), and monitoring ownership (tutorial 25) into one set of concrete conditions a feature must meet before being considered production-ready.

8. Why does this tutorial recommend scaling enterprise governance rigor to a feature's actual stakes, rather than applying maximum rigor uniformly?

βœ… Correct!
❌ Not quite β€” the correct answer is .
The tutorial explicitly warns against treating governance as a uniform gate — the discipline is having a checklist and review process at all, scaled to the feature's actual risk and consequence, not applying the heaviest possible process to every feature regardless of stakes.

9. Which of the four reference projects is described as the simplest, best-first-project choice?

βœ… Correct!
❌ Not quite β€” the correct answer is .
The FAQ assistant is the simplest RAG-shaped project — a knowledge base, retrieval, and a grounded cited answer — with minimal tool use and straightforward evaluation (checking whether known FAQs are answered correctly), making it the recommended starting point.

10. In the resume analyzer reference project, what is AI used for and what is traditional code used for?

βœ… Correct!
❌ Not quite β€” the correct answer is .
Extracting structured data (skills, experience) from unstructured resume text is the open-ended, language-understanding task suited to AI; applying deterministic business rules to those extracted fields (e.g., a scoring formula) is fully specifiable logic better done as traditional code — a clear example of this tutorial's AI-vs-code judgment.

11. What does the code-review assistant reference project illustrate about combining AI with existing tools?

βœ… Correct!
❌ Not quite β€” the correct answer is .
The code-review assistant is described as a clean example of augmentation: deterministic tools (linters, security scanners) still do what they do well, while AI adds value on dimensions like style and design clarity that are harder to fully automate with fixed rules.

12. Why does this tutorial insist prompt refinement is 'ongoing practice,' not a one-time step?

βœ… Correct!
❌ Not quite β€” the correct answer is .
Consistent with tutorial 26's teaching, prompt refinement is a continuous loop of observing real outputs, identifying failure patterns, and making targeted changes validated by evaluation — treating it as 'done' after the first working version misses regressions and improvement opportunities that only surface over time.

13. What is the purpose of the step-by-step walkthrough's final step, reflecting on the next iteration?

βœ… Correct!
❌ Not quite β€” the correct answer is .
The final step explicitly frames the whole thirteen-subtopic process as a repeating cycle — identify the next valuable capability and apply the same discipline again — which the tutorial calls the point of the whole exercise, distinguishing a sustainable AI feature from an unmaintainable one-off.

14. Why does this tutorial describe itself as introducing 'no new mechanism'?

βœ… Correct!
❌ Not quite β€” the correct answer is .
The tutorial explicitly states its role is synthesis: each subtopic is a direct application of a named earlier tutorial's teaching to the concrete decisions a real project requires, and its value comes from showing how all the pieces combine and in what order, not from introducing new techniques.

15. What is the relationship between the four reference projects and the four-phase discipline (plan/design, build the AI service, robustness/safety, ship/govern)?

βœ… Correct!
❌ Not quite β€” the correct answer is .
The tutorial explicitly states all four reference projects share the deep-dive 1 system design and deep-dive 3 robustness practices; what differs is scope (deep-dive 1), the specific integrations (deep-dive 2), and which evaluation criteria matter most for that project's purpose (deep-dive 4).

16 Exam: Written Questions

Try answering each question yourself before expanding the model answer.

1. Walk through the four phases this tutorial organizes a real GenAI .NET project into, naming the subtopics in each and explaining why this ordering makes sense for a real project.
Phase one, Plan and Design, covers sprint planning and use-case scoping, system design (UI/API/AI service/configuration), and the AI-vs-traditional-code judgment — these must come first because they determine what gets built and how, before any implementation decision can be made correctly. Phase two, Build the AI Service, covers Azure OpenAI integration, prompt refinement, and service abstraction — this follows planning because you need a defined scope and architecture before writing the core capability, and these three are naturally built together since the service abstraction is what integration and prompt logic live behind. Phase three, Robustness and Safety, covers error handling/logging, secure configuration, and validation/guardrails/fallback logic — this follows building the core capability because you can't add resilience and safety around a call that doesn't exist yet, but it must happen before shipping, not after. Phase four, Ship and Govern, covers UI/UX, end-to-end testing, deployment, and enterprise governance — necessarily last, since you test and deploy a system that's already built and hardened, and governance validates the whole preceding work before and after release. This ordering mirrors how a real team actually works: you can't design a robust, safe UI around an AI service that doesn't exist, and you can't deploy something that hasn't been built, hardened, and tested.
2. Explain the four-layer system design (UI, API, AI service, configuration) and identify, for each layer, one specific earlier tutorial whose teaching that layer directly applies.
The UI layer collects user input and displays results, implementing the five interaction states and streaming display from tutorial 14 — it never calls Azure OpenAI directly. The API layer exposes the feature as REST or streaming endpoints, applying tutorial 14's DTO and endpoint design so the wire contract stays decoupled from internal types. The AI service layer is the single place that constructs prompts and calls the model, directly implementing tutorial 13's service abstraction principle (an interface consumers depend on, one implementation that knows the SDK) plus tutorial 11's chat completion mechanics. The configuration layer supplies credentials, prompts, and tunable parameters, applying tutorial 13's options pattern and secrets hierarchy (Managed Identity, then Key Vault, never a hardcoded key). Drawing this diagram before implementation, as the tutorial recommends, prevents the common failure of AI logic leaking into a controller or view — each layer's boundary is what keeps the corresponding earlier tutorial's discipline actually enforced in the real codebase rather than just understood in principle.
3. Using the resume analyzer and code-review assistant reference projects, illustrate the AI-vs-traditional-code judgment with two concrete examples each, one AI-appropriate and one traditional-code-appropriate.
Resume analyzer, AI-appropriate: extracting a candidate's skills, years of experience, and education history from unstructured, freely-formatted resume text — this requires understanding natural language expressed in countless different formats and phrasings, which a fixed parsing rule set cannot enumerate in advance, making it a strong AI fit. Resume analyzer, traditional-code-appropriate: once fields are extracted, checking whether a required field (like 'years of experience') is present and numeric, or computing a deterministic match score using a fixed formula against a job description's stated requirements — this is fully specifiable logic with one correct answer per input, needing perfect reliability, which a simple validation function or arithmetic calculation handles better than a model call (faster, cheaper, and fully predictable). Code-review assistant, AI-appropriate: generating a natural-language explanation of why a piece of code might be hard to understand or suggesting a clearer naming convention — this requires judgment about readability and design that resists a fixed rule set. Code-review assistant, traditional-code-appropriate: detecting a specific known security vulnerability pattern (like SQL string concatenation) or enforcing a fixed style rule (line length, brace placement) — a static analyzer or linter already solves this deterministically and reliably, and routing it through a model call instead would add cost, latency, and the risk of missing the pattern that a rule-based tool catches with certainty.
4. Describe the layered robustness approach (error handling, secure configuration, validation, guardrails, fallback) shown in this tutorial's Example code for the AI service, explaining what each layer specifically protects against.
Input validation (bounding question length, rejecting empty input) protects against malformed or abusive requests reaching the model at all, following tutorial 24's input-handling discipline. Secure configuration (Managed Identity for the Azure OpenAI connection, options binding with validation) protects the credential itself from ever appearing in source control or being leaked, following tutorial 13's hierarchy. Error handling with retry/backoff (catching 429/5xx and retrying with tutorial 13's resilience pattern) protects against transient service failures becoming user-visible errors unnecessarily. The guardrail (refusing to return an answer with zero supporting sources) protects specifically against a confident-but-ungrounded response reaching the user, addressing the hallucination risk tutorial 26 teaches how to detect. Fallback logic (returning a clear, honest 'temporarily busy' or 'couldn't find anything relevant' message rather than an error page or a bad answer) protects the user experience itself, ensuring that whatever fails upstream, the user gets a coherent, honest response rather than confusion or silent bad information. Together, these layers protect against different failure classes — malicious/malformed input, credential compromise, transient infrastructure failure, hallucination, and poor user experience on failure — none of which any single layer alone would fully cover.
5. Explain why service abstraction for AI logic is described as making 'every downstream subtopic manageable,' tracing the specific benefit through error handling, testing, and deployment.
Because every other subtopic in this tutorial needs a single, well-defined place to attach its concerns, and the service abstraction is exactly that place. For error handling and logging: resilience patterns and structured logging wrap the service's one method that calls the model, rather than needing to be duplicated at every call site if the AI SDK were called directly from multiple places. For end-to-end testing: consumers (the API layer, integration tests) depend on the IKnowledgeBotService interface, so unit tests can substitute a mock implementation and run instantly without real model calls, while the golden-dataset evaluation runs specifically against the real implementation's behavior — neither would be possible if AI SDK calls were scattered through controllers with no consistent interface to mock or evaluate against. For deployment: swapping the underlying SDK, moving to a different framework (Semantic Kernel), or adding a second model provider touches only the one concrete class implementing the interface, not the API layer, the UI, or any tests written against the interface — meaning a significant architectural change during or after deployment is a contained, low-risk edit rather than a sprawling rewrite. The abstraction is the single point of leverage that makes every subsequent concern in this tutorial tractable rather than duplicated or entangled.
6. Design the production readiness checklist for one of the four reference projects of your choice, specifying at least five concrete items and the tutorial each draws from.
For the internal knowledge bot: (1) No API keys in source control or appsettings.json; the Azure OpenAI connection uses Managed Identity, verified by configuration review (tutorial 13). (2) Input length is bounded and validated before reaching the model, and the 'no sources found' guardrail is tested with a deliberately out-of-scope question to confirm it triggers correctly (tutorial 24, this tutorial's deep-dive 3). (3) A golden dataset of at least 15 representative questions passes evaluation with groundedness and relevance scores above a defined threshold, and this evaluation is wired to run automatically on every prompt or retrieval change (tutorials 22, 26). (4) The application is provisioned via infrastructure as code (Bicep/Terraform) and deployed with a health check that makes a real, minimal model call to verify connectivity, not just process liveness (tutorial 23). (5) An Application Insights dashboard is live showing token spend, p95 latency, and error rate, with an explicitly assigned owner who checks it on a defined schedule and alerts routed to that owner (tutorial 25). Each item is verifiable with a concrete check (a config scan, a test run, an evaluation score, a deployment artifact, a dashboard screenshot) rather than a vague 'looks good' judgment, which is what makes a production readiness checklist actually enforceable rather than aspirational.
7. A stakeholder asks why this tutorial insists on scoping an MVP before building the full feature, when the team already knows the full feature they eventually want. Respond with the reasoning from this tutorial.
The reasoning centers on where an AI feature's real risk lives: unlike deterministic code, where the main risk is whether the team can implement the known logic correctly and on time, an AI feature carries the additional, harder-to-predict risk of whether the model actually performs well enough on the task at all — a risk that can't be fully assessed by planning alone and only becomes clear once real prompts are tried against real inputs. Building the full feature surface (multi-turn memory, tool integration, streaming, advanced UI) before validating this core hypothesis means potentially investing significant effort into scaffolding around a core capability that turns out not to work well enough, discovered only after most of the effort is already spent. Scoping an MVP that isolates and tests the riskiest, most uncertain assumption first — 'can the model answer these specific questions well from this specific data' — means that uncertainty is resolved early and cheaply, while it's still easy to change course, adjust the prompt, improve the data, or even reconsider whether AI is the right approach at all (deep-dive 1's AI-vs-code judgment). Knowing the full eventual feature doesn't reduce this risk; it just means the team has a roadmap for what to add once the MVP proves the core hypothesis sound — the MVP-first approach doesn't abandon the full vision, it sequences validation before the more expensive, harder-to-unwind investment in full-feature scaffolding.
8. Explain the relationship between guardrails and fallback logic, and describe why this tutorial insists a fallback response must be 'honest,' using a concrete counter-example of a dishonest fallback.
A guardrail is a check that catches a bad or unacceptable outcome before it reaches the user — in the knowledge bot example, refusing to return an answer that has zero supporting sources, since an unsourced answer for a factual bot is a hallucination risk. Fallback logic is what happens next, once a guardrail (or an outright failure like a 429) has determined the primary path can't proceed safely: it's the alternative response the user actually sees instead of the blocked or failed result. The two work together — a guardrail without fallback logic would need to fail the request entirely with no graceful alternative, while fallback logic without guardrails would have nothing triggering it in the hallucination case specifically. The insistence on honesty matters because a dishonest fallback undermines the very reason guardrails exist: imagine a fallback that, when the guardrail triggers on zero sources, instead of admitting it couldn't find relevant information, generates a generic, plausible-sounding paragraph about the general topic area without disclosing that it isn't actually sourced from real internal documentation — this defeats the guardrail's entire purpose, since the user receives an unsourced, essentially fabricated answer dressed up to look like a normal response, exactly the outcome the guardrail was built to prevent, just relocated one step downstream into the fallback path instead of eliminated.
9. Compare how the FAQ assistant and the internal knowledge bot reference projects differ in scope and complexity, and explain why this tutorial recommends the FAQ assistant as a first project.
The FAQ assistant is scoped to a defined, typically smaller knowledge base of Q&A pairs or short documents, with retrieval and a grounded, cited answer as its entire capability — no tools, no live system integration, no multi-turn conversation memory required. Its evaluation is comparatively straightforward: does it correctly answer the set of known FAQs, a bounded and checkable success criterion. The internal knowledge bot, as built in this tutorial's step-by-step walkthrough, starts from the same RAG foundation but is explicitly extended (in later iterations, per the walkthrough's final step) with tools reaching live systems (ticket status, policy lookups) and potentially multi-turn memory, introducing tutorial 12/17's function-calling complexity, tutorial 20's governance concerns around tool capability scoping, and a broader, harder-to-fully-enumerate evaluation surface since 'internal knowledge' typically spans more varied and open-ended real employee questions than a fixed FAQ set. The FAQ assistant is recommended as a first project because it lets a team practice the full four-phase discipline — planning, building the AI service, robustness, and shipping — on the simplest possible scope, building genuine competence and working muscle memory with retrieval, grounding, and evaluation before taking on the added complexity (tool governance, broader scope, harder evaluation) the knowledge bot or other reference projects introduce.
10. Explain why enterprise governance is described as scaling 'a single feature's best practices into an organization's reliable practice,' and what specifically breaks without this scaling.
Following every best practice from tutorials 10 through 26 on one feature — secrets managed correctly, guardrails tested, evaluation passing, deployment automated, dashboard monitored — demonstrates that a team knows how to build a safe, high-quality AI feature once. Enterprise governance is what ensures this happens reliably across every feature and every team building AI capability in an organization, not just the one project where a particularly diligent engineer happened to apply every lesson from this course. Without this scaling, several things break: a second team building a similar feature might skip secrets management because no organizational policy or review process required it, reintroducing a risk the first project solved; a production readiness checklist that exists only in one engineer's head or one project's documentation doesn't transfer knowledge to new team members or new projects; and there's no recurring practice (like tutorial 25's monthly review) ensuring that even the first project's good practices don't silently decay over time as models, usage patterns, and team membership change. Enterprise governance — a defined checklist, a review process, an accountability structure, a recurring cadence — is the mechanism that converts individual diligence into organizational reliability, which is precisely the gap between 'I built one good AI feature' and 'our organization reliably builds good AI features,' and it's why this tutorial treats governance as a capstone-level concern rather than something covered adequately by good individual engineering alone.
11. A team building the code-review assistant reference project wants to have the AI model replace their existing linter and static analysis tools entirely, arguing 'the model can do everything the linter does, plus more.' Evaluate this proposal using this tutorial's AI-vs-traditional-code framework.
This proposal should be rejected for tasks squarely in the linter's domain, even though the model may technically be capable of producing similar output in many cases. A linter's core value is deterministic, perfectly reliable detection of well-defined patterns — a specific security vulnerability signature, a fixed style rule violation, a syntax issue — where correctness has one right answer per input and needs to be caught with certainty every single time. Routing this through a model call instead introduces exactly the properties traditional code is meant to avoid: non-determinism (the model might catch a pattern on one run and miss it on a logically identical case phrased slightly differently), added latency and cost per check, and a probabilistic risk of missing a known, catchable pattern that a rule-based tool would never miss. The 'plus more' capability the model offers — judgment about code clarity, design quality, naming, structural suggestions — is precisely where AI adds genuine value that a rule-based tool cannot easily provide, since these dimensions resist being reduced to fixed rules. The correct architecture, following this tutorial's description of the code-review assistant as a clean augmentation example, keeps the linter and static analyzers doing what they do best (deterministic, reliable, cheap pattern detection) and adds the AI model specifically for the judgment-requiring commentary layer on top — combining both rather than replacing the reliable tool with a less reliable one, even if the less reliable one is more broadly capable in principle.
12. Trace how a single change — switching the internal knowledge bot's underlying model deployment to a newer model version — would need to move through this tutorial's four phases, and what could go wrong if a phase were skipped.
Plan and design: confirm the change is scoped correctly — is this a full model swap or a version upgrade within the same family, and does the system design (particularly the AI service's abstraction boundary) already isolate this to one configuration change rather than requiring code changes elsewhere; skipping this check risks discovering mid-change that the model swap actually requires touching several files because the abstraction wasn't as clean as assumed. Build the AI service: update the configuration (deployment name) and, critically, re-examine whether the existing prompt (deep-dive 2) still performs as well on the new model, since prompt behavior can shift meaningfully between model versions — skipping this means shipping a change that silently degrades response quality because the old prompt was implicitly tuned to the old model's quirks. Robustness and safety: confirm error handling still functions correctly (different models can have different rate-limit behaviors or error response shapes) and that guardrails still catch what they're meant to catch on the new model's output patterns — skipping this risks a guardrail that worked against the old model's failure modes silently failing to catch a new model's different failure modes. Ship and govern: re-run the full golden-dataset evaluation (tutorials 22, 26) comparing old-model and new-model outputs via pairwise comparison, deploy via canary rollout (tutorial 23) rather than a full cutover, and update the production readiness documentation to reflect the new model version — skipping evaluation specifically is the single highest-risk omission, since a model swap that looks fine on a few manual tries could easily regress on cases the golden dataset would have caught, shipping to all users at once via a full cutover instead of canary removes the safety net that would limit the blast radius of any regression evaluation missed.
13. Explain why this tutorial frames the step-by-step walkthrough's final step — 'reflect and plan the next iteration' — as 'the point of the whole tutorial' rather than an optional closing remark.
The entire tutorial has walked through thirteen subtopics as if building one complete pass through a feature, which risks leaving the impression that a real AI feature is 'finished' once all thirteen boxes are checked once — plan, design, build, harden, ship, govern, done. The final step exists specifically to correct that impression: it explicitly states that a real AI feature is never done after one pass, and that the same thirteen-subtopic discipline should repeat for each new increment (the example given is adding a tool for live ticket status) rather than being treated as a one-time linear checklist completed at initial launch. This reframing matters because it's the difference between building a feature that stays maintainable and safe as it evolves versus one that accumulates unmanaged scope creep, undocumented prompt drift, and untested new capabilities bolted onto a system whose original rigor only covered its first version. By calling this the point of the whole tutorial rather than a closing remark, the tutorial insists that the real skill being taught isn't 'how to build one AI feature following thirteen steps' but 'how to sustain the discipline of these thirteen concerns across the entire lifetime of an evolving AI feature' — a meaningfully more valuable and more difficult skill, and the one that actually determines whether a team's AI capability remains trustworthy months or years after initial launch, not just on day one.
14. This tutorial states it introduces 'no new mechanism.' Defend the value of a tutorial that introduces no new technical mechanism, using specific examples of what a developer who has completed tutorials 10-26 individually might still be missing.
A developer who has completed tutorials 10 through 26 individually has learned each mechanism in isolation — how to call Azure OpenAI, how to build a RAG pipeline, how to secure secrets, how to write a golden dataset, how to deploy with infrastructure as code — but isolated mastery of parts doesn't automatically confer the integration judgment a real project demands. Specific gaps this tutorial fills: knowing WHEN in a project's timeline to apply each technique — a developer might know how to write a golden dataset (tutorial 22) but not have internalized that evaluation needs to happen before every release as a gate, not as an afterthought once something feels wrong in production; knowing HOW MUCH of a given practice a specific project's stakes warrant — someone who's only seen tutorial 20's governance concepts applied to an enterprise multi-agent system might not know how to scale that same discipline down sensibly for a small internal tool without either skipping it entirely or over-engineering it; and, most concretely, knowing how the pieces physically fit together in one codebase — the four-layer system design, the single AI service abstraction that error handling, testing, and deployment all attach to, the specific order in which planning, building, hardening, and shipping actually happen in practice. This tutorial's value is exactly this connective, sequencing, and proportionality judgment — the kind of knowledge that's genuinely hard to convey through isolated single-topic tutorials, no matter how well each is taught individually, and that typically only comes from having actually built a complete real project or from a deliberate capstone synthesis like this one.
15. Reflecting on this course as a whole (tutorials 10 through 27), articulate the single most important idea a developer should carry forward after completing it, using this final tutorial's structure as evidence for your answer.
The single most important idea is that building AI-powered applications well is fundamentally an application of sound, pre-existing software engineering discipline to a genuinely new kind of dependency — a probabilistic, natural-language-interfaced, cost-metered model — rather than an entirely separate discipline requiring wholesale new practices. This tutorial's own structure is the strongest evidence for this: its thirteen subtopics map directly onto ordinary software engineering phases (planning, system design, implementation, error handling, security, testing, deployment, governance) that any competent .NET developer would recognize from non-AI projects, with each phase's AI-specific addition being a targeted extension (prompt refinement, groundedness checking, token cost tracking, hallucination-aware guardrails) rather than a foreign new activity replacing the underlying discipline. The tutorial explicitly says it introduces 'no new mechanism' and that its value is entirely in ordering and integration — which is itself the lesson: a developer who deeply understands service abstraction, secrets management, structured logging, resilience patterns, and test-driven validation already has most of what's needed to build responsible AI features; what they need to add is the specific vocabulary and techniques (prompts, embeddings, RAG, agents, groundedness, tokens) this course supplied tutorial by tutorial, attached to engineering judgment they may already possess. Carrying this idea forward means a developer facing an AI feature they've never built before should reach first for the software engineering instincts that already serve them well — scope carefully, design cleanly, abstract the volatile dependency, handle errors and secrets properly, test before shipping, govern proportionally to stakes — and treat the AI-specific techniques as an addition to that foundation, not a replacement for it.

17 Flashcards

Click a card to reveal the back.

Four phases of a real GenAI project
Plan & Design → Build the AI Service → Robustness & Safety → Ship & Govern. Thirteen subtopics map onto these four phases.
Use-case scoping / MVP
Define what the feature will/won't do BEFORE coding. Scope to an MVP that validates the core AI hypothesis before building the full feature surface.
Four-layer system design
UI (tutorial 14) → API → AI service (owns ALL model calls) → Configuration (tutorial 13). Prevents AI logic leaking into controllers/views.
AI vs traditional code
AI: open-ended, unstructured language, no fixed rule set. Traditional: fully specifiable logic, needs perfect reliability, a simple lookup/rule solves it.
Service abstraction payoff
One interface + one implementation = error handling, testing (mockable), and deployment (swap SDK/framework) all attach to ONE place, not scattered calls.
Prompt refinement = ongoing
Never a one-time step. Continuous: observe real outputs → identify pattern → one targeted change → validate against golden dataset (tutorial 26).
Layered robustness
Input validation → AI call with retry/backoff → guardrail check → fallback on any failure. Each layer catches a different failure class.
Honest fallback logic
A fallback must clearly say 'couldn't help' — NEVER silently return generic content pretending nothing went wrong (defeats the guardrail's whole purpose).
End-to-end testing = 22 + 26
Golden-dataset regression testing (tutorial 22) + relevance/groundedness/consistency checks (tutorial 26), run before EVERY release, not once at launch.
Production readiness checklist
Secrets secured + guardrails/fallback tested + evaluation passing + IaC deployment + monitored dashboard with an owner. Scale rigor to actual stakes.
Enterprise governance purpose
Converts 'I built one good AI feature' into 'our organization reliably builds good AI features' — checklist, review process, recurring cadence.
Deployment best practices
Infrastructure as code, Managed-Identity-based model access, canary rollout for prompt changes, and a monitored dashboard live from day one.
FAQ assistant
Simplest RAG-shaped reference project — fixed knowledge base, retrieval, grounded cited answer. Recommended FIRST project.
Resume analyzer
AI extracts structured fields from unstructured text; traditional code applies downstream business rules/scoring to those fields.
Code-review assistant
Augmentation example: keep the linter/static analyzer for deterministic pattern detection; add AI specifically for judgment-based commentary (style, clarity).
The cycle never ends
A real AI feature repeats the 13-subtopic discipline for EVERY new increment — never 'done' after one pass. This is 'the point of the whole tutorial.'

18 Interview Questions and Answers

1. Walk me through how you'd plan and scope a new AI feature from scratch.
I'd start with use-case scoping: define precisely what the feature will and won't do in its first version, and write down what's explicitly out of scope to prevent creep later. Then I'd scope to an MVP that validates the riskiest assumption first — usually 'can the model actually perform well enough on this specific task' — before investing in the full feature surface like multi-turn memory or tool integration. Sprint planning for this needs to budget real time for prompt iteration and evaluation, which is easy to underestimate if you plan an AI feature like you'd plan deterministic code, since the uncertainty here isn't just 'will we finish the code' but 'will the model actually do this well,' and that second question often can't be answered until you've tried real prompts against real data.
2. Describe the system design you'd use for a new GenAI .NET application.
Four layers: a UI that collects input and displays results but never talks to the model directly; an API layer exposing the feature as endpoints, handling DTOs and streaming; an AI service that's the single place in the whole application that constructs prompts and calls the model; and configuration supplying that service its credentials and tunable parameters like temperature and prompt text, all bound through the options pattern rather than hardcoded. I sketch this out — even just a box diagram — before writing any implementation, because the most common mistake I see is AI SDK calls creeping directly into a controller or a Razor view instead of staying behind the service boundary, which then makes every later concern — testing, swapping providers, adding resilience — much harder to retrofit.
3. How do you decide whether a given capability should be built with AI or traditional code?
I ask whether the task requires interpreting open-ended natural language or synthesizing across unstructured sources in a way a fixed rule set can't enumerate — that's a good AI fit. If the logic is fully specifiable in advance, needs perfect reliability, or a simple lookup or validation rule already solves it, that's traditional code, and routing it through a model call instead just adds cost, latency, and non-determinism with no benefit. A concrete example I use: extracting skills and experience from a freely-formatted resume is a great AI task, but checking whether a required extracted field is non-empty afterward is a one-line traditional check — I've seen teams route both through the model out of habit, which is wasteful and less reliable for the second case.
4. Why do you build a service abstraction for AI logic even on a small project?
Because every other concern in the project — error handling, testing, deployment, swapping providers — needs one well-defined place to attach to, and the service abstraction is that place. If I wrap the AI SDK behind an interface from day one, unit tests can mock it and run instantly without real model calls, resilience and structured logging wrap one method instead of being duplicated at scattered call sites, and if I later need to swap the SDK, move to a different framework, or add a second model, I'm editing one class instead of hunting through the codebase for every place a model gets called. Retrofitting this after the fact on a project that's already scattered AI calls everywhere is real, painful work — it's much cheaper to do it from the start even when the project feels small enough that 'it's just one call, why bother' seems tempting.
5. How do you approach validation, guardrails, and fallback logic together, rather than as separate concerns?
I think of them as one layered pipeline a request passes through: input validation catches malformed or abusive requests before they reach the model at all; the AI call itself runs with retry and backoff for transient failures; a guardrail checks the result against a project-specific safety rule — for a factual assistant, refusing to return an answer with zero supporting sources is a good example, since an unsourced factual claim is a hallucination risk; and fallback logic is what the user actually sees if any stage along that pipeline fails or refuses. The part I insist on is that the fallback has to be honest — if a guardrail blocks an ungrounded answer, the fallback needs to clearly say 'I couldn't find anything relevant,' not silently generate some generic-sounding paragraph that looks like a normal answer but isn't actually sourced from anything real, because that would completely defeat the point of having the guardrail in the first place.
6. What does end-to-end testing look like for an AI feature before you ship it?
I run the full evaluation stack, not just unit tests. A golden dataset of representative real questions gets run through the current implementation, and I check relevance (does it actually address what was asked), groundedness (is every claim supported by sources), and consistency (does it answer the same or logically equivalent question compatibly across runs). This runs as regression testing on every meaningful change — a prompt tweak, a retrieval change, a model version swap — not just once before the initial launch, because agent and prompt behavior can regress in ways ordinary unit tests over deterministic code would never catch. I gate deployment on this: if groundedness or relevance drops below a threshold I've set as acceptable, that blocks the release rather than proceeding on the hope that it's probably fine.
7. What's on your production readiness checklist for an AI feature before it ships?
No secrets in source control — Managed Identity where possible, Key Vault otherwise. Input validated and guardrails tested, including a deliberate test that confirms the fallback path actually triggers correctly, not just that it exists in code. A golden-dataset evaluation passing with relevance and groundedness above a defined bar, wired to run automatically on future changes. Deployment via infrastructure as code with a health check that makes a real, minimal model call rather than just checking the process is alive. And a monitoring dashboard that's actually live, with an explicitly assigned owner and alerts that route somewhere a person will see them — a dashboard with no owner provides essentially no operational value. I scale how heavily I apply all of this to the feature's actual stakes; a low-risk internal tool doesn't need the same weight as something customer-facing or handling sensitive data, but I want every feature to have gone through some version of this checklist deliberately, not skipped it entirely.
8. Which of the four reference project types — FAQ assistant, resume analyzer, internal knowledge bot, code-review assistant — would you recommend as a team's first AI project, and why?
The FAQ assistant, generally. It's the simplest RAG-shaped project — a defined knowledge base, retrieval, a grounded and cited answer, no tool integration, no multi-turn memory to manage. Its evaluation is also the most straightforward: you can check directly whether known FAQs get answered correctly, which makes it easier to build genuine confidence in your evaluation practice before tackling something with a broader, harder-to-fully-enumerate scope. I'd want a team to build real competence with retrieval quality, grounding, and evaluation on this simpler scope before taking on something like the internal knowledge bot, which adds tool governance and a much wider variety of real employee questions, or the code-review assistant, which needs careful judgment about combining AI with existing deterministic tooling.
9. How would you handle a request to add a new tool to an existing, already-shipped AI assistant?
I'd treat it as a full pass through the same discipline as a new feature, not a quick bolt-on. Scoping: define exactly what the new tool does and doesn't do, and reconsider whether it genuinely needs to be a model-invoked tool or could be simpler traditional logic. Building: implement it behind the same service abstraction the existing capabilities live behind, following tutorial 12's tool safety discipline — validated arguments, authorization, idempotency. Robustness: make sure error handling and any new guardrails specific to this tool's risk profile are in place, especially if the tool can take a consequential action. Testing: extend the golden dataset with cases that specifically exercise the new tool, and re-run the full evaluation to confirm the existing capabilities haven't regressed as a side effect of adding a new option the model can now choose. Shipping: canary the change rather than a full cutover, and update the production readiness documentation. Skipping any of these steps because 'it's just one more tool' is exactly how scope creep quietly erodes a well-built system's safety and quality over time.
10. What would you tell a team that treats their AI feature as 'done' after the initial launch?
That this is the single biggest mistake I see, and it's specifically what the last step of a real build process should correct. An AI feature isn't like a piece of deterministic code that, once correct, stays correct — models get updated, usage patterns shift and reveal edge cases the original scope didn't anticipate, and new capabilities get requested that each need the same planning-through-governance discipline the first version got, not a shortcut because 'we're just adding a small thing.' I'd want the team to treat this as a repeating cycle: identify the next most valuable increment, apply the same thirteen-part discipline — even in a lightweight form for something small — and keep the evaluation, monitoring, and governance practices running continuously rather than treating them as launch-day checkboxes. The teams that struggle with AI features long-term are almost always the ones that did everything right at launch and then let prompt refinement, evaluation, and monitoring quietly lapse afterward.
11. How do you decide how much of this whole discipline — planning, service abstraction, guardrails, testing, governance — to apply to a small, low-stakes internal tool?
I scale rigor to actual stakes rather than either skipping the discipline entirely or applying maximum weight uniformly to everything. Some things I consider close to non-negotiable regardless of size — secrets never in source control, a service abstraction even for a small project since it costs little upfront and saves real pain later, and at least a lightweight evaluation pass before shipping. Things I'll scale down for a genuinely low-stakes tool: the formality of the review process, the depth of the production readiness checklist, the frequency of monitoring review. What I won't do is skip the underlying question for each subtopic entirely — even for a small tool, I want a quick, deliberate answer to 'have we scoped this,' 'is this safe,' 'have we tested it,' even if the answer for a low-stakes tool is a five-minute check rather than a formal sign-off process. The discipline is having addressed each concern proportionally, not having applied identical weight to every project regardless of consequence.
12. Explain the code-review assistant's design in terms of build-vs-buy-vs-augment thinking.
I'd frame it as an augment decision specifically, not build-from-scratch or buy-a-complete-solution. The deterministic parts — detecting known vulnerability patterns, enforcing style rules — are already well solved by existing static analysis tools and linters, so I wouldn't rebuild that capability with AI; I'd keep using the existing tool for what it does reliably. What AI adds is a genuinely new capability those tools can't easily provide: judgment-based commentary on code clarity, naming, or design quality that resists being reduced to a fixed rule. So the actual system augments the existing toolchain with an AI layer specifically for the judgment-requiring gap, rather than either replacing working deterministic tools with a less reliable AI-only approach, or trying to buy an off-the-shelf tool that may not integrate with the team's specific codebase and conventions. That augment framing — keep what's reliable, add AI where it genuinely contributes something new — is the pattern I'd apply to most 'should we use AI for this' decisions, not just this specific reference project.
13. What's the biggest integration challenge you'd expect moving from having built individual pieces (RAG, agents, deployment, evaluation) to assembling a complete real-world application?
Getting the ordering and boundaries right, more than any individual technique. Someone who's done each tutorial individually often knows how to build a RAG pipeline, how to secure secrets, how to write a golden dataset — but assembling them means making judgment calls none of those individual tutorials force: how much scoping is enough before you start building, where exactly the AI service's boundary should sit so testing and deployment both work cleanly against it, and how much of the full governance and evaluation apparatus a specific project's actual stakes warrant. I'd expect the biggest early mistake to be either under-integrating — building each piece well in isolation but never actually wiring guardrails, evaluation, and deployment together into one coherent, gated release process — or over-applying every technique uniformly regardless of the project's actual risk, which burns effort disproportionately on a low-stakes feature. Getting comfortable with that proportionality judgment, more than any specific mechanism, is what separates having learned the pieces from being able to actually ship a complete, well-integrated system.
14. How would you explain to a junior developer why this course spent so much time on non-AI-specific topics like service abstraction, secrets management, and deployment?
I'd tell them that building a good AI feature is mostly good software engineering with a new, unusual kind of dependency layered on top — a probabilistic, natural-language-interfaced, metered-cost model — rather than an entirely separate discipline. The AI-specific pieces (prompts, embeddings, RAG, agents, groundedness checks) matter and take real skill, but they only produce a trustworthy production system when wrapped in the same engineering discipline that any well-built service needs: a clean architecture that isolates volatile dependencies, credentials handled securely, errors handled gracefully, changes tested before they ship, and the whole thing deployed and monitored responsibly. A team that's excellent at prompt engineering but skips service abstraction, secrets discipline, or evaluation gating will ship something that works in a demo and fails in ways that are hard to diagnose or fix once it's live. The non-AI-specific topics are the foundation the AI-specific techniques stand on, and skipping that foundation because it feels like 'not the interesting AI part' is exactly how promising AI features become unmaintainable or unsafe in production.
15. What's the single most important takeaway you'd want someone to carry forward after completing this entire course?
That building AI-powered applications well is an extension of sound engineering judgment you likely already have, not a replacement for it. Every technique across this whole course — from calling Azure OpenAI to building multi-agent systems to evaluating response quality — attaches to ordinary software engineering concerns: architecture, security, testing, operations, governance. If I've internalized service abstraction, secrets management, structured logging, resilience patterns, and disciplined testing from working on non-AI systems, I already have most of what a trustworthy AI feature needs; what this course adds is the specific vocabulary and techniques — prompts, tokens, embeddings, retrieval, grounding, agents, evaluation — to apply that existing judgment to this new kind of dependency. I'd tell someone finishing this course: the next time you face an unfamiliar AI capability, reach first for the engineering instincts that already serve you well — scope it carefully, design it cleanly, isolate the volatile dependency behind an abstraction, handle its errors and secrets properly, test it before shipping, and govern it proportionally to its stakes — and treat everything AI-specific as an addition to that foundation, never a substitute for it.

19 Glossary

Use-case scoping
Deliberately defining what an AI feature will and won't do before building it, so effort targets a specific, valuable, achievable outcome.
Sprint planning
Breaking an AI feature into buildable increments, accounting for the extra uncertainty prompts and model behavior add versus deterministic code.
System design
The high-level arrangement of an application's layers — UI, API, AI service, configuration — and how they depend on each other.
Azure OpenAI integration
The mechanical foundation of a GenAI .NET app: an AzureOpenAIClient, a chat deployment, and the chat completion call, built once inside the AI service.
Service abstraction
Hiding an AI SDK behind an application-owned interface, so callers depend on domain-shaped methods instead of vendor types.
Error handling and logging
Wrapping every AI call in resilience (timeout, retry with backoff) and structured logging of latency, tokens, and finish reason, never prompt bodies by default.
Secure configuration
Supplying an AI service's credentials and tunable parameters via Managed Identity, Key Vault, and bound options, never hardcoded or in source control.
UI/UX
The five interaction states (idle, loading, success, error, cancelled) plus visible streaming progress that make an AI feature feel responsive and trustworthy.
Fallback logic
A planned, safe alternative response or action used when the primary AI call fails, is refused, or produces an unusable result.
Guardrail
A rule or check constraining what an AI system is allowed to do or say, reducing the range of possible bad outcomes.
End-to-end testing
Combining golden-dataset regression testing with relevance, groundedness, and consistency checks, run before every release, not just once at launch.
Prompt refinement
Iteratively improving a prompt's clarity, structure, and constraints based on observed output quality and cost.
Deployment best practices
Infrastructure as code, Managed-Identity-based model access, canary rollout for prompt changes, and live monitoring dashboards from day one.
Enterprise governance
Organizational policies, review processes, and accountability structures ensuring AI systems are built and operated responsibly at scale.
Build-vs-buy-vs-augment
The decision of whether to build custom AI logic, use an off-the-shelf solution, or add AI to an existing traditional feature.
MVP (minimum viable product)
The smallest version of a feature that delivers real value, used to validate an idea before investing in its full scope.
Technical debt
Shortcuts in prompt design, missing evaluation, or unscoped tool access that will cost more to fix later than to do right initially.
Production readiness checklist
A concrete list of operational, security, and quality requirements a system must meet before it is considered safe to ship.
Reference project
A concrete, buildable project scope (an FAQ assistant, resume analyzer, internal knowledge bot, or code-review assistant) anchoring a course's techniques in a real build.
FAQ assistant
A reference application answering common questions from a defined knowledge base, typically the simplest RAG-shaped project.
Resume analyzer
A reference application extracting and evaluating structured information from unstructured resume documents using AI.
Internal knowledge bot
A reference application answering employee questions from internal documentation, policies, and systems, often via RAG and tools.
Code-review assistant
A reference application analyzing code changes and providing feedback, often combining static analysis with AI-generated commentary.
Traditional code
Deterministic, rule-based application logic that always produces the same output for the same input, as contrasted with a model call.

πŸ—’ My Notes