Your profile

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

Lesson 21 of 39
❮Prev Next❯

Monitor, Evaluate and Debug Agents

Module 2: GenAI & Agents ⏱ 12 min read Updated

Your note

My notes for this lesson

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

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

    All my bookmarks and notes

    Reading settings

    For every lesson, saved in this browser.

    Text size
    Line spacing
    Font

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

    30-second answer

    Evaluate an agent by its whole run, not only its final text. Intent resolution asks if it understood the goal, tool call accuracy checks the tools and arguments, and task adherence checks it followed its instructions. Error analysis groups failing runs into causes, such as a made-up argument or a claimed action with no tool call, so you fix the cause and rerun the same dataset. In production, add monitoring and continuous evaluation on sampled live traffic.

    Simulate it » No Azure account needed

    Exam objective: 2.2.6 Integrate monitoring into deployed agents, evaluate agent behavior and perform error analysis. (Skills measured as of April 16, 2026)

    Simulations

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

    Azure portal: Evaluate agent runs and read the error analysis Open an evaluation of agent runs and read the error analysis.
    </> Embed

    Embed this simulation

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

    Loading the portal…

    Open <strong>Evaluations</strong> and start a new evaluation of an <strong>agent</strong>.

    👆 Click the glowing item in the portal to continue

    Read the steps as text
    1. Open Evaluations and start a new evaluation of an agent.
    2. Choose the agent evaluators. They read the whole run, including tool calls.
    3. Runs 2 and 3 fail. Open run 2.
    4. Error analysis groups failures into causes you can act on. Then re-run the same dataset to prove the fix.

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

    😟 THE PROBLEM

    The agent passes demos but real conversations show invented arguments and claimed actions.

    😊 THE SOLUTION

    Evaluate whole runs and group the failures into causes.

    • Wrong or made-up tool arguments✓ Tool call accuracy
    • Misunderstood the request✓ Intent resolution
    • Ignored the instructions✓ Task adherence
    🛠️ Solved with: Agent evaluators and error analysis

    Start with a question

    How does a driving examiner judge a driver?

    The examiner doesn’t only check that you arrived. She watches the whole drive: did you understand where to go, did you use the mirrors and signals correctly, did you follow the rules of the test?

    Agent evaluators are the examiner. Intent resolution asks if the agent understood the destination. Tool call accuracy watches the mirrors and signals, meaning the tools and arguments. Task adherence checks it followed the rules it was given.

    Explain it like I’m 10

    The technical explanation

    What each evaluator reads

    EvaluatorLooks atTypical failure it finds
    Intent resolutionThe user request and the agent’s responseAnswered about invoices when the user wanted to cancel
    Tool call accuracyThe tool calls and argumentsCalled get_order_status with “ORD-0000”, an order number nobody gave
    Task adherenceThe instructions and the runDidn’t ask for the order number as instructed

    The dataset holds agent messages and tool calls, for example one JSON line per run:

    {"query": "Where is my order?",
     "tool_calls": [{"name": "get_order_status", "arguments": {"order_id": "ORD-0000"}}],
     "response": "It arrives tomorrow."}
    from azure.ai.evaluation import evaluate, TaskAdherenceEvaluator, ToolCallAccuracyEvaluator, IntentResolutionEvaluator
    
    result = evaluate(data="agent-runs.jsonl",
                      evaluators={"task_adherence": TaskAdherenceEvaluator(judge),
                                  "tool_call_accuracy": ToolCallAccuracyEvaluator(judge),
                                  "intent_resolution": IntentResolutionEvaluator(judge)},
                      azure_ai_project=project_endpoint)

    Error analysis

    Scores tell you which runs failed. Error analysis tells you why. Read the lowest rows and group them:

    Cause seen in rowsFix
    Invented tool argumentsRequired parameters in a strict schema, and “ask if missing” in the instructions
    Claimed an action with no tool callAdd the tool, require approval, and check the trace for the call
    Wrong tool chosenClearer tool descriptions, or split the agent
    Ignored a ruleMove the rule higher in the instructions and add an example

    Then rerun the same dataset to prove it worked, and add the failing cases to your test set so they can’t come back.

    In production

    Pre-release tests don’t catch drift. Foundry can run continuous evaluation on a sample of live conversations, show scores, latency, tokens and failures on a monitoring dashboard, and raise alerts through Azure Monitor. For one bad run, open its trace in Application Insights and read the spans in order, as of 25 November 2026.

    Architect level Why average scores mislead for agents

    Agent runs fail in clusters. If 10 percent of runs invent an order number, the average can still look healthy, yet one in ten customers gets a wrong answer. Report the pass rate per evaluator, list the failing rows, and tag each with a cause. Track the share of each cause release by release, so you can see which fix helped.

    Real-world business scenario

    Retail

    Contoso Retail (fictional)

    The problem
    The order agent passed demos but real conversations showed invented order numbers and replies like Your order is cancelled when no cancel tool had run.
    What they used
    A 120-run evaluation set scored with intent resolution, tool call accuracy and task adherence, an error analysis tagging each failure, and continuous evaluation on 5 percent of live conversations with an alert.
    Why that choice
    The scores pointed to two causes, a missing required parameter and a missing cancel tool, and the rerun proved both fixes.
    The result
    Invented arguments disappeared from the test set, and a later drop after a model change was caught by the alert the same day.

    When to use it and when not to

    ✓ Use it when…

    • The agent calls tools or follows multi-turn instructions.
    • You change instructions, tools or models and need to compare.
    • The agent is live and quality could drift.

    ✕ Think twice when…

    • Only judging the last message of a run.
    • Treating one score as proof of safety. Add safety evaluators and review.
    • Evaluating without real or realistic conversations.

    ↔ Alternatives to consider

    • Quality evaluators for single-turn RAG answers.
    • Tracing to debug one run in detail.
    • Red teaming to attack the agent on purpose.
    Ready for more?The full lesson adds the technical explanation, when to use it, interview questions and revision notes.

    Test yourself with exercises

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

    Question 1

    Question 1 of 5

    An agent called a function with an order number the user never provided.

    Which evaluator highlights this problem?

    Question 2

    Question 2 of 5

    An agent answered a question about invoices when the user wanted to cancel an order.

    Which evaluator measures whether the agent understood the user’s goal?

    Question 3

    Question 3 of 5

    An agent was told to always ask for the order number, but it answered without asking.

    Which evaluator measures adherence to the instructions?

    Question 4

    Question 4 of 5

    An evaluation of 200 agent runs shows 30 failures.

    What should the team do next?

    Question 5

    Question 5 of 5

    A deployed agent must be checked for quality drift on real traffic.

    Which approach should you use?

    Interview preparation

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

    Beginner Why not just read the agent's final answer?

    Model answer

    The answer can sound right while the agent did something wrong on the way, like calling a tool with a made-up order number. Agent evaluators look at the whole run, including the tool calls.

    Intermediate What do the three main agent evaluators check?

    Model answer

    Intent resolution checks it understood the goal, tool call accuracy checks the tools and arguments it used, and task adherence checks it kept to its instructions and scope.

    Experienced developer How do you turn failing runs into improvements?

    Model answer

    I group failures by cause. If many runs invent an argument, I tighten the schema and instructions. If an agent claims an action without a tool call, I add the missing tool and require approval. Then I rerun the same dataset to prove the fix and add the cases to the test set.

    Scenario An agent is live. How do you notice it getting worse?

    Model answer

    I run continuous evaluation on a sample of real conversations, watch the scores and failure rates on a dashboard, and set an alert on a drop. I also trace slow or failing runs in Application Insights to debug them.

    Quick revision

    Key points

    • Agent evaluators read the whole run, including tool calls.
    • Intent resolution, tool call accuracy and task adherence cover different failures.
    • Error analysis groups failures into causes.
    • Rerun the same dataset after a fix.
    • Continuous evaluation watches live traffic.

    Important terminology

    Intent resolution
    An agent evaluator that scores whether the agent identified and addressed what the user wanted.
    Tool call accuracy
    An agent evaluator that scores whether the agent called the right tools with correct arguments.
    Task adherence
    An agent evaluator that scores whether the agent followed its assigned task and instructions.
    Error analysis
    Grouping failed runs by cause so fixes target patterns, not single cases.
    Continuous evaluation
    Scoring a sample of live agent conversations on a schedule to catch drift.
    Agent run
    One execution of an agent, including model calls, tool calls and the final answer.

    Common mistakes

    • Judging an agent only by its final text.
    • Fixing one failing case instead of the pattern.
    • Evaluating once before release and never again.

    Exam tips

    • "Called a tool with an argument the user never gave" = tool call accuracy.
    • "Misunderstood what the user wanted" = intent resolution.
    • "Ignored an instruction" = task adherence.

    Five quick revision questions

    1. 1.Which evaluator checks tool arguments?Show

      Tool call accuracy.

    2. 2.Which checks understanding of the goal?Show

      Intent resolution.

    3. 3.Which checks following instructions?Show

      Task adherence.

    4. 4.What is error analysis?Show

      Grouping failures by cause.

    5. 5.How do you watch production quality?Show

      Continuous evaluation on sampled traffic.

    Official references

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

    Next up: Prompt Engineering, Parameters and Self-Critique

    Studying with a friend? Send them this lesson

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

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

    Install MSDEVBUILD Azure

    Free · no account · works offline

    Save the whole course for offline ›

    Hi, I’m your Nimbus

    Your study buddy. Pick what we do next.

    MSDEVBUILD · Multi-Stack Dev Build

    Sign in to MSDEVBUILD

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