MSBA-312 · Lesson 4 of 12 · 19 min

Evaluation and red teaming

▶ Video coming soon A video version of this lesson is on the way.

Lesson 3 placed evaluation sets in the middle of the testing strategy. This lesson looks inside them: how AI behavior is scored, how scores turn into release decisions, how evaluation continues once a solution is live, and how red teaming probes for the failures that ordinary users would never trigger on purpose. These are the activities the AB-100 study guide groups under recommending the process and metrics to test agents, and under analyzing vulnerabilities, including prompt manipulation.

At Quillfield, evaluation began as Yusra's way of checking the Policy Service Assistant before each release. By November 2026 Bram had turned it into a portfolio practice with three moments: offline evaluation before release, online evaluation of live traffic, and red teaming before any agent gains new powers.

What evaluation measures

An evaluation runs a set of inputs through an agent and scores each response. The scoring method depends on what "good" means for that case. Some methods compare against an expected answer: exact match, keyword match, text similarity, or a model's judgment of whether the meaning is the same. Some judge quality without a reference: relevance, groundedness in the retrieved sources, completeness, coherence, fluency. Some judge safety: whether the response contains harmful content or protected material. And for agents, some judge process: whether the right tool was called with the right inputs, whether the agent understood the user's intent, and whether it stuck to its instructions.

Copilot Studio's agent evaluation, covered in detail in MSBA-242, offers general quality (relevance, groundedness, completeness and abstention), content safety, compare meaning, text similarity, exact match, keyword match, tool use, and custom graders defined by instructions and labels. Foundry's evaluator catalog covers similar ground with more options: agent evaluators such as task adherence, intent resolution and tool call accuracy; retrieval-augmented generation evaluators such as groundedness and relevance; risk and safety evaluators; general-purpose evaluators such as coherence and fluency; graders such as string check and text similarity; and custom evaluators written as code or as model-judged rubrics.

A circular diagram with three stations. Offline evaluation before release, with a test set, evaluators and a release gate. Online evaluation in production, sampling live conversations and sending scores to monitoring dashboards. Red teaming before new capabilities, with automated attack probes and human testers. Arrows show failures from online evaluation and red teaming flowing back into the offline test set.
Three moments of evaluation: before release, in production and before new powers, with every failure feeding the test set.

Model-judged scores need calibration

Many evaluators use a language model as the judge. That makes evaluation scalable, but the judge can be wrong, biased toward long answers, or blind to domain errors. The remedy is calibration: before trusting a judge for release decisions, compare its verdicts with expert human judgments on a sample, and adjust its rubric until they agree well enough. MSBA-242 described Quillfield's calibration of a custom grader for service notes; Bram extended the rule to every judge used in a gate. Each judge has a calibration record showing the sample size, the agreement rate with Tomasz's reviewers, and the date it was last checked. When the judge's model changes, calibration is repeated.

Model-judged scores also vary between runs. Running a set twice can give slightly different results even with no change to the agent. Gates should therefore use thresholds with a margin, compare a candidate against a baseline run at the same time with the same judge, and treat small differences with suspicion. The GitHub Action for AI agent evaluation helps here: when it evaluates several agent versions it reports confidence intervals and a pairwise statistical comparison that indicates whether a difference is meaningful or random variation.

From scores to release gates

A score becomes useful when it is tied to a decision. Quillfield's release gate for the Policy Service Assistant has four parts. Floors are minimum scores on the full set, such as groundedness and compare-meaning pass rates. No regressions means the candidate must not score meaningfully worse than the current production version on any group of cases. Zero tolerance applies to specific cases, such as any data-changing action taken on an ambiguous request or any response that reveals another client's data; a single failure blocks release. And human review covers a sample of responses read by a team lead, because scores can miss problems that people notice at once.

Gate elementWhat it checksDecision rule
FloorsOverall quality on the full setBelow floor blocks release
No regressionsEach case group against the production baselineA meaningful drop blocks release unless approved by the business owner
Zero toleranceWrong-record changes, data leaks, unsafe contentAny single failure blocks release
Human reviewA sample of 30 responses read by a team leadBlocking issues block release; others go to the backlog

Not every agent needs the same gate. The HR Leave Assistant, which only answers questions and hands off to HR advisers, has floors and human review but no zero-tolerance group for data changes, because it cannot change data. The certificates-mailbox agent, which drafts documents that brokers approve, has a zero-tolerance rule for certificates naming the wrong insured, because a broker reviewing many drafts a day might miss one. Gates scale with risk.

Online evaluation in production

Offline evaluation tells you how an agent handles the cases you collected. Online evaluation tells you how it handles what users actually send. In Foundry, continuous evaluation samples agent runs in production at a configured rate and scores them with selected evaluators; results go to Application Insights and appear in Foundry's observability dashboards linked to traces. The sampling rate and a maximum number of evaluation requests per hour keep cost under control. Microsoft's documentation for continuous evaluation in the classic Foundry portal labels it a preview, and the new portal describes continuous and scheduled evaluation as its equivalent; both depend on a connected Application Insights resource.

For Copilot Studio agents, the equivalents are analytics (satisfaction, resolution, escalation and themes), transcripts reviewed by authorized staff, and periodic re-runs of evaluation sets against the published agent. Bram's operating model asks for a monthly evaluation run on every production agent even when nothing has changed, because knowledge content, connected systems and the underlying models can change without a release. A drop in a monthly run with no release behind it is a signal to investigate, covered in Lesson 9.

Online evaluation results are production data. They can contain customer details, and if reasoning explanations are included in results they can repeat sensitive content. Access to them follows the same rules as access to transcripts.

What red teaming is

Red teaming is deliberately trying to make a system fail in harmful ways, so that the failures can be fixed before someone else finds them. For AI systems, Microsoft's practice covers both security failures, such as prompt injection that makes an agent misuse a tool, and responsible AI failures, such as harmful, biased or ungrounded content. Red teaming is not the same as evaluation with an adversarial set: evaluation measures known risks at scale, while red teaming searches for unknown ones with creativity and persistence. Both are needed.

For agents, the most important risks are those that turn language into action. The OWASP Top 10 for Agentic Applications, released by the OWASP GenAI Security Project in December 2025, names them: agent goal hijack, tool misuse and exploitation, identity and privilege abuse, agentic supply chain vulnerabilities, unexpected code execution, memory and context poisoning, insecure inter-agent communication, cascading failures, human-agent trust exploitation and rogue agents. Lesson 6 uses the list in threat modeling; here it guides what red teamers try.

Automated red teaming in Foundry

Foundry's AI Red Teaming Agent automates part of this work. It uses Microsoft's open-source Python Risk Identification Tool (PyRIT) together with Foundry's risk and safety evaluations to simulate an adversarial user, probe a model or agent endpoint, score each attack and response, and produce a scorecard. Its key metric is attack success rate (ASR): the proportion of attacks that produced an undesired result. It applies attack strategies that disguise or transform harmful requests, such as encodings, character substitutions, jailbreak prompts and multi-turn approaches that escalate gradually.

Its risk categories include content risks such as hateful and unfair, sexual, violent and self-harm-related content, protected materials, code vulnerability and ungrounded attributes, which can run locally or in the cloud. Agentic risk categories run only in cloud red teaming against Foundry agents: prohibited actions (banned, high-risk or irreversible actions defined by your policies), sensitive data leakage (tested with synthetic sensitive data and mock tools), task adherence, and indirect prompt injection, in which attack text is planted in mock tool outputs to see whether the agent follows it. Microsoft recommends running these scans in a production-like but non-production environment, notes that results from generative scoring can include false positives and should be reviewed, and says automated tools work best combined with expert human analysis. Cloud runs are limited to certain regions and to supported Foundry agent types.

AspectAutomated (AI Red Teaming Agent)Human red team
CoverageMany attacks across known strategies, quicklyFewer attempts, deeper and more creative
StrengthRepeatable, measurable with ASR, good for regressionFinds novel, context-specific and business-logic failures
WeaknessLimited to supported targets and strategies; false positivesSlow, costly, depends on testers' skill
Best useEvery release of a Foundry agent; trend trackingBefore new tools, new channels or new user groups

Human red teaming at Quillfield

Copilot Studio agents cannot yet be targeted by every automated scan, and business-logic failures need people who understand the business. Quillfield's human red team is small: Wendell Pike-Amari for compliance, a member of the IT security team, one experienced broker and Yusra. Before the certificates-mailbox agent was allowed to draft certificates for a second office in November 2026, they spent an afternoon trying to break it, all in the test environment with synthetic data. They sent emails asking for certificates naming an insured who was not a client, emails with instructions hidden in a signature block telling the agent to send the draft to an outside address, and requests for additional insured wording that the policy did not support.

Two findings mattered. The agent correctly refused to send anything outside Quillfield, because it can only create drafts for broker review; the design had removed that risk. But it did sometimes include additional insured wording copied from the client's email even when the policy did not provide it, which a hurried broker might approve. The fix combined an instruction, a check in the flow against BrokerDesk endorsements, and a new zero-tolerance case in the evaluation set. Every red-team finding became a test case, so it would be checked on every future release.

Worked problem

Planning red teaming for a new capability

The Commercial Submission Desk design will let an agent send submission packages to carriers by email. Before build, the AI council asks what red teaming is needed. What should Bram propose?

Show solution
  1. Identify what the new capability changes: the agent will send external email, which is a high-impact, hard-to-reverse action.
  2. Map relevant agentic risks: goal hijack through instructions in client documents, tool misuse to send to the wrong recipient, sensitive data leakage of other clients' data.
  3. Automated: run the AI Red Teaming Agent's agentic categories (prohibited actions, sensitive data leakage, indirect prompt injection) against the Foundry components in the test project, with a prohibited-action policy naming external sends without approval.
  4. Human: a half-day session with a broker, Wendell and a security engineer using realistic submission documents with planted instructions.
  5. Gate: zero successful external sends without approval; every finding becomes an evaluation case; repeat after any change to the send tool.

Answer: A combined automated and human red-team plan focused on the new external-send capability, with a zero-tolerance gate and findings fed back into the evaluation set.

Keeping evaluation honest

Evaluation can decay into theater. Sets go stale, judges drift, thresholds creep down to let a release through. Bram set three guardrails. Evaluation sets are reviewed quarterly and must include cases from the last quarter's production traffic. Threshold changes need the business owner's written approval, recorded in the release record. And once a year, someone outside the building team (for the Policy Service Assistant, Precious Mahlangu's team) writes fifty fresh cases without seeing the existing set, to check whether the set still represents reality.

Common mistakes

  • MistakeTrusting a model-judged score without checking it against people.

    InsteadCalibrate judges on an expert-labeled sample and recalibrate when the judge changes.

  • MistakeComparing a candidate to last month's scores.

    InsteadRun the production baseline and the candidate together with the same judge, and look for meaningful differences.

  • MistakeApplying one gate to every agent.

    InsteadScale floors, zero-tolerance groups and review to the agent's ability to change data or reach outside.

  • MistakeTreating automated red teaming as complete.

    InsteadCombine automated scans with human red teaming focused on business logic and new capabilities.

  • MistakeLeaving red-team findings in a report.

    InsteadTurn every finding into an evaluation case so it is checked on every release.

Summary and key terms

  • Evaluation scores responses against references, quality criteria, safety criteria and agent process measures such as tool call accuracy and task adherence.
  • Model-judged evaluators need calibration against human judgment and comparison with a baseline run under the same conditions.
  • Release gates combine floors, no-regression rules, zero-tolerance cases and human review, scaled to risk.
  • Online evaluation samples production traffic; in Foundry, continuous evaluation sends scores to Application Insights and observability dashboards.
  • Red teaming searches for harmful failures; the AI Red Teaming Agent automates content and agentic risk probes and reports attack success rate.
  • Human red teams find business-logic failures, and every finding becomes a test case.
Offline evaluation
Scoring an agent on a prepared test set before release.
Online evaluation
Scoring a sample of live production interactions.
Calibration
Checking a model-judged evaluator against expert human labels and adjusting it until they agree.
Release gate
The set of score thresholds and rules a candidate must meet before it is released.
Red teaming
Deliberately attempting to make an AI system fail in harmful or insecure ways in order to fix the weaknesses.
Attack success rate (ASR)
The proportion of red-team attacks that produced an undesired result.
Indirect prompt injection
An attack that hides instructions in content an agent reads, such as a document or tool output.

Practice problems

Work each problem on paper first, then reveal the answer to check.

  1. Why run the production baseline and the candidate in the same evaluation?

    Show answer

    Model-judged scores vary between runs and judge versions, so only a side-by-side run shows a real difference.

  2. Which AI Red Teaming Agent categories are agentic and cloud-only?

    Show answer

    Prohibited actions, sensitive data leakage and task adherence, with indirect prompt injection tested through mock tool outputs.

  3. What happens to a red-team finding at Quillfield?

    Show answer

    It is fixed and added to the evaluation set as a permanent test case.

Lesson quiz · 5 questions

Score 60% or more to complete this lesson.

Take the quiz