Monitor, Evaluate and Debug Agents
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 neededExam 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.
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
- Open Evaluations and start a new evaluation of an agent.
- Choose the agent evaluators. They read the whole run, including tool calls.
- Runs 2 and 3 fail. Open run 2.
- 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.
🖱️ Drag to rotate · scroll or pinch to zoom
Monitor and debug agent runs
Agent evaluators read the whole run: intent resolution, tool call accuracy and task adherence. Error analysis groups the failing rows, such as a made-up tool argument, and points to the fix.
🤔 What happens if…
Read this tour as text
- Deploy a model, call the deployment. A deployment is a named copy of a model with a version, a deployment type and capacity. Your app calls the deployment name, never the model name. Pick a large model for hard work and a small language model for cheap, fast, simple work.
- RAG: retrieve first, then answer. Retrieval-augmented generation searches your own content (Azure AI Search, hybrid keyword plus vector), puts the best chunks in the prompt and asks the model to answer from them with citations. Without retrieval the model guesses.
- A multistep flow with checks. A workflow breaks one big request into steps you control: classify, extract to a JSON schema, call a tool, draft, then verify. Retries, fallbacks and a final check live in code, so one bad step can’t slip through unseen.
- Evaluate before you ship. Evaluators score each answer on a test set: groundedness (is it supported by the context?), relevance, coherence and safety checks. A fabrication shows up as a low groundedness score on one row, so you fix it before users see it.
- SDK, project endpoint and connections. The Foundry SDK (
azure-ai-projects) opens one door: AIProjectClient with the project endpoint and DefaultAzureCredential. From it your app gets an OpenAI-compatible client, deployments and connections (Azure AI Search, Application Insights) with no secrets in code. - Design the agent: role, goal, tool schema. An agent is a model plus instructions (role and goal), tools and a conversation (thread). A strict function schema names each parameter and marks the required ones, so the model asks the user instead of inventing a value.
- Retrieval, function calling and memory. One agent can use file search for documents, a function for live data and memory for what it learned about a user. The model asks to call a function; your code runs it and returns the result. Memory survives into a new conversation.
- Multi-agent orchestration. Several specialist agents can share a job. Sequential passes work down a line, concurrent fans out and merges, handoff moves control to the right specialist, group chat lets agents take turns in one shared conversation and Magentic lets a manager agent plan and delegate. Microsoft Agent Framework builds all five.
- Autonomy with approvals. Reads are safe, writes are not. A tool marked approval required pauses the run until a person decides. A hard limit in code blocks what no one should approve, whatever the model says.
- Monitor and debug agent runs. Agent evaluators read the whole run: intent resolution, tool call accuracy and task adherence. Error analysis groups the failing rows, such as a made-up tool argument, and points to the fix.
- Tune prompts and parameters. Instructions shape tone and rules, a few-shot example shows the format, temperature and top_p change how adventurous the wording is, and max output tokens caps length. A self-critique loop drafts, checks against a checklist and revises once.
- Trace every call and count tokens. OpenTelemetry spans record each agent run, model call and tool call, with tokens and latency, and Application Insights stores them. Tracing is opt-in, and recording message content is for development only because it captures prompts and answers.
- Route requests to the right model. A hybrid design puts rules first for answers code can decide, a small model for easy language work and a large or reasoning model only when needed. A model router can pick for you. Fewer big-model calls means a lower bill and faster replies.
The order agent passes demos, but real runs look odd. Score recorded runs with agent evaluators, read the error analysis, then switch on tracing to Application Insights and measure tokens and latency.
🎓 Education-only simulation. Your lab is saved in this browser, so you can leave and continue later.
😟 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
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
| Evaluator | Looks at | Typical failure it finds |
|---|---|---|
| Intent resolution | The user request and the agent’s response | Answered about invoices when the user wanted to cancel |
| Tool call accuracy | The tool calls and arguments | Called get_order_status with “ORD-0000”, an order number nobody gave |
| Task adherence | The instructions and the run | Didn’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 rows | Fix |
|---|---|
| Invented tool arguments | Required parameters in a strict schema, and “ask if missing” in the instructions |
| Claimed an action with no tool call | Add the tool, require approval, and check the trace for the call |
| Wrong tool chosen | Clearer tool descriptions, or split the agent |
| Ignored a rule | Move 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
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.
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.
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.Which evaluator checks tool arguments?Show
Tool call accuracy.
-
2.Which checks understanding of the goal?Show
Intent resolution.
-
3.Which checks following instructions?Show
Task adherence.
-
4.What is error analysis?Show
Grouping failures by cause.
-
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
Lesson done? Make it stick with a quick gameSort It, Match the Pairs, Lightning Round and Who Am I? Earn XP and badges.