Skip to content

Copilot Studio Agent Evaluation in a CI/CD Pipeline

Copilot Studio agent evaluation runs from a pipeline through REST, a connector and a preview CLI. Learn documents no built-in gate. Here is where the docs stop.

Alex Pechenizkiy 15 min read Power Platform Release Gates and Agent Security hub
Copilot Studio Agent Evaluation in a CI/CD Pipeline

Copilot Studio agent evaluation shows a warning when “No evaluation exists.” or when “The agent model changed since the latest evaluation.” Microsoft Learn’s run and review page then adds the sentence release owners need to read: “These warnings don’t block you from publishing.” The short version: you can call the evaluation signal from a pipeline. Deciding when it blocks a release is up to you.

The overview page points somewhere else. It says the REST APIs and connectors let you “integrate testing into automated workflows such as continuous integration and continuous deployment (CI/CD) pipelines.” Learn documents evaluation as something a maker runs. A release pipeline needs it to work as a gate.

One scope note before the details. Every API fact in this article applies to standard-harness agents. Learn’s how-to pages for the evaluation API and the connector are standard-harness pages, and the pac copilot-studio reference links each of its evaluation commands to the matching REST API operation. The Microsoft Copilot harness pages, which document evaluation as a production-ready preview feature, and the Customer Conversation harness page describe only the Evaluate tab. The separate Copilot Studio CLI (preview) is covered in The CLI section below.

What Microsoft documents for Copilot Studio agent evaluation

Everything starts with the test set. Per Create a single response test set, “A test set for single response evaluations consists of a group of up to 100 test cases.”

You can fill a test set in five ways:

  • Generate cases. A quick question set has Copilot Studio create them from the agent’s description, instructions and capabilities.
  • Import a CSV. “The file can contain up to 100 questions.” Each question can be up to 1,000 characters, including spaces.
  • Write cases by hand.
  • Reuse test chat queries. Test your agent covers this.
  • Build from real conversations. This uses analytics themes, which are labeled preview.

Results do not stay around. “Test results are available in Copilot Studio for 89 days. To save your test results for a longer period, export the results to a CSV file.”

Each test set runs one or more test methods. The table below quotes the “Measures” and “Scoring” columns from Choose evaluation methods word for word.

Method
General quality
Measures
How good is a test case's response(s) based on specific qualities
Scoring
Scored out of 100%
Method
Content safety
Measures
Whether the test case's response contains harmful content, such as hate, violence, self-harm, or sexual content
Scoring
Pass/fail
Method
Compare meaning
Measures
How well the meaning of the test case's answer matches the expected answer
Scoring
Scored out of 100%
Method
Capability use
Measures
Whether the test case used all or any of the expected resources
Scoring
Pass/fail
Method
Keyword match
Measures
Whether the test case used all or any of the expected keywords or phrases
Scoring
Pass/fail
Method
Text similarity
Measures
How well the text of the test case's answer matches the expected answer
Scoring
Scored out of 100%
Method
Exact match
Measures
Whether the test case's answer matches the expected answer exactly
Scoring
Pass/fail
Method
Classification
Measures
Whether the test case's response meets your defined criteria or expectations.
Scoring
Pass/fail (passes the defined label criteria)
The eight standard-harness test methods, what each measures and how it scores.

Three details from the same pages affect any gate you build:

  • General quality is the default. “All test sets start with this method by default,” and it is the only method that does not need expected responses or keywords.
  • Compare meaning needs expected answers. “The default passing score is 50.” Also, “Any test case without expected answers produces an Invalid result for this test method.”
  • Pass scores are set inside the test set. Learn says “Some methods require a pass score,” and you set that score per method in the test set. Your thresholds therefore live partly in the test set itself.

Results work like this:

  • “Each test case receives a Pass, Fail, Invalid, or Error based on the criteria of the test case,” and the UI shows a Pass rate.
  • “Response time is a measurement only. It doesn’t assign a Pass or Fail result or affect the test set’s pass rate.”
  • Visibility is split. Any maker can see run status and metrics, “but only the maker who initiated the test run can view the agent responses and result explanations.”

Safety is covered, with a limit. Learn lists four safety evaluators and then says plainly that “they don’t guarantee that an agent is safe or appropriate for every scenario.”

Takeaway: standard-harness Copilot Studio agent evaluation is available, and it gives you per-case verdicts you can build on.

Running it from a release pipeline: the Copilot Studio evaluation API, the connector and the CLI

The REST API

The Copilot Studio evaluation API is documented in Automate agent evaluations with Power Platform API. This is the endpoint exactly as Learn gives it:

POST https://api.powerplatform.com/copilotstudio/environments/{EnvironmentId}/bots/{BotId}/api/makerevaluation/testsets/{TestSetId}/run?api-version=2024-10-01

The prerequisites include a test set created in Copilot Studio and “A user access token issued by Microsoft Entra ID (OAuth 2.0).”

The run reference (API version 2024-10-01) lists these request body fields:

  • evaluationRunName
  • runOnPublishedBot: “If set to false, the operation will run on a draft bot instance.”
  • mcsConnectionId: “leave empty for an anonymous run”
  • toolsConnections

The Copilot Studio evaluation API run is asynchronous. The response carries a callbackUri, “The URI to poll for the evaluation run results.” You poll EvaluationRunState until it reaches a final value. The documented values are Abandoned, Cancelled, Completed, Deleted, Failed, InProgress, Queued and Unknown.

Our view: the JSON below is illustrative, not a Learn sample. Every value in it is a placeholder.

{
  "evaluationRunName": "<release-candidate-name>",
  "runOnPublishedBot": false,
  "mcsConnectionId": "<connection-id>",
  "toolsConnections": []
}

The connector

Trigger agent evaluations with connectors covers the no-code route. It offers two main actions, plus actions that list runs and test sets and get test set details:

  • Evaluate Agent: “Run an evaluation for an agent by using a specific test set”
  • Get Agent Test Run Details: “Get status and results for a specific test run”

Learn’s example uses a Recurrence trigger and polls until the run state is Completed. It calls this “a repeatable quality signal without manual API orchestration.”

The connector reference adds two constraints:

  • “This is not shareable connection.”
  • Throttling is 300 calls per 60 seconds per connection.

The CLI

The evaluation commands live under pac copilot-studio, for example run-maker-evaluation-test-set and get-maker-evaluation-test-run. Every one of them is marked “(Preview)”.

The pac copilot group is different. It is the one with clone, pull, push, pack and publish, and Learn documents no evaluation command in it.

Learn also documents a separate Copilot Studio CLI (preview), installed as msagent. msagent agent eval testset create builds a test set from a CSV, and msagent agent eval run runs it against the draft, or the published agent with --published, in the environment you name with --environment-id. Its test sets hold “up to 20 conversations, with up to 6 questions per conversation and 1,000 characters per question.” Learn is explicit about the gate: “The CLI reports the results; you or your team choose when the agent is ready to publish.”

Limits Learn states

  • Learn says: “You can run only one test at a time.” It does not say what happens to a second run started while one is in progress. Our view: run your evaluation stages one after another, never in parallel.
  • Data policies for agents state that a policy blocking the Microsoft Copilot Studio connector prevents “running automated evaluations by using an authenticated account.”
  • Learn: “Evaluations only support agents set to use No authentication or Authenticate with Microsoft. Agents set to Authenticate manually aren’t supported.”
RouteStatus on LearnDocumented constraint
RESTNo preview label, API version 2024-10-01User access token; runs asynchronously
ConnectorNo preview labelConnection not shareable; 300 calls per 60 seconds per connection
pac copilot-studioPreviewLives under pac copilot-studio, not pac copilot
msagent (Copilot Studio CLI)PreviewCSV test sets of up to 20 conversations; you pick the environment

Our view: use REST for code pipelines and the connector for flow-based gates. Treat both CLIs as preview and do not rely on either alone for a production gate.

Gap 1: Learn documents no built-in gate on evaluation results

Learn documents no API, CLI or connector parameter that sets a minimum pass rate:

  • The run request takes evaluationRunName, mcsConnectionId, runOnPublishedBot and toolsConnections, and nothing else.
  • The TestRun object has no pass-rate property.

Your pipeline has to compute pass or fail from the per-test-case MetricStatus values, which are Error, Fail, Pass and Unknown.

I checked the tooling pages on 2026-11-15:

Learn documents no built-in pipeline gate on Copilot Studio agent evaluation results.

Learn does describe two gate patterns, both in Microsoft’s Copilot Agent Kit. Microsoft’s ALM guidance names both: “To block a deployment that doesn’t meet a quality bar, use the Agent Review Pipeline or automate testing and deployment with pipelines in Power Platform by using Copilot Agent Kit.” Microsoft’s Copilot Agent Kit guidance, Automate testing and deployment of agents using pipelines in Power Platform, describes a flow that “runs automated tests, evaluates test results, and decides whether to proceed with deployment.” The Kit, per its troubleshooting page, “is an open-source project licensed under the MIT License, for which Microsoft doesn’t provide support.” Its detailed steps sit in a PDF outside Learn, so I cite nothing from that PDF. The other, the Agent Review Pipeline, is “an automated quality gate for Copilot Studio agents deployed through Power Platform Pipelines.” It scores the agent’s configuration and instruction compliance against a threshold (default 60), not your evaluation test set results.

Our view: build the gate on a gated extension in pipelines in Power Platform. It works in three steps:

  1. Pick Pre-export Step Required (“runs custom validation logic when you submit a deployment request”) or Pre-deployment Step Required.
  2. Attach a cloud flow on OnDeploymentRequested or OnPreDeploymentStarted. The flow calls the evaluation, polls it and computes the result.
  3. Call UpdatePreExportStepStatus or UpdatePreDeploymentStepStatus with the outcome. Learn defines the reject code: “30 for rejecting the step. The deployment doesn’t proceed and the system sets the status to failed.”

One caveat from the same page: “New pipeline extensions are gradually rolling out across regions and might not be available yet in your region.”

Our view: the gate is a flow you own. Put it under change control and review it like any other release script.

Gap 2: Learn documents no way to move test sets with the agent

I checked six pages on 2026-11-15:

Learn documents no way to move a test set between environments with the agent.

Two facts sit next to each other on Learn, and they do not settle the question:

  • The pipelines overview says “Pipelines, or solutions in general, don’t contain data stored within Dataverse tables.”
  • The run object describes testSetId as “The ID of the object model test set entity record that the run is associated with.”

Learn does not say test sets are Dataverse table data, and it does not say solutions exclude them. Do not assume either answer.

The model migration guidance advises: “Keep the set with the agent in source control, and rerun it unchanged for every model change.” It gives no procedure for exporting a test set.

Our view: make the CSV the source of truth. Keep it in the repo next to the pac copilot workspace. In every environment where the evaluation runs, recreate the test set by importing that CSV in Copilot Studio. Learn documents CSV import in Create a single response test set. For a scripted import, the Copilot Studio CLI (preview) creates a test set from a CSV in a named environment (msagent agent eval testset create with --environment-id and --from-csv), and Learn notes that “Test sets belong to a specific agent and environment.” Its CSV groups questions into conversations with a required conversationNumber column and holds up to 20 conversations, so it is a different file from the single response template, which takes up to 100 questions. Learn’s examples run it from a local CLI project for the agent (--project and --agent-name). For an agent built in the portal, Learn’s open an existing agent page creates that project by cloning the agent (msagent agent create with --mcs-clone-agent-id). Until that CLI leaves preview, plan the import as a checked step in your release checklist. Record each environment’s test set ID as a pipeline variable, or look it up with the connector’s list actions, because a recreated set gets a new ID.

For agents deployed with the Copilot Studio CLI (preview), Learn’s deploy and promote page says to “Evaluate the agent in your test environment” with msagent agent eval run --environment-id. For a managed solution promoted through pipelines in Power Platform, Learn gives no procedure. The REST how-to lists “Run recurring performance checks against production or staging agents.” as a use case, and the ALM guidance says to evaluate a new default model “in development and test before you move production,” but the API takes an environment, a bot and a test set, and says nothing about managed solutions. Our view: treat downstream evaluation of a solution-deployed agent as unverified until you have tested it in your own tenant.

Gap 3: Copilot Studio automated testing runs as a signed-in user

Learn documents no service principal option.

The identity rules are spread across four pages:

  • “Evaluations run as the currently signed-in user.”
  • The create page says the same thing in its own words: “Automated testing uses the authentication of the currently signed-in user.”
  • The API needs “A user access token.”
  • The connector connection is not shareable.

I checked the REST how-to, the run reference, the connector reference and the CLI reference on 2026-11-15. Learn documents no service principal option for the maker evaluation API.

The connection ID changes what the evaluation can see. “If you don’t add an mcsConnectionId to your call, the evaluation runs without authentication.” That means knowledge sources and tools that need authentication only work when the run has an mcsConnectionId user profile. Tools take their own user connections through toolsConnections, which the REST how-to describes as “a list of tools along with the corresponding user connections that should be used for each tool.”

The data exposure follows the identity. “Generated test cases can include sensitive data that the connected account can access. Any maker with access to the agent can also view the test sets linked to that agent.” That sets what the evaluation sees and who can read its test sets.

Our view: the run identity is a decision for the security lead, not the pipeline author, and it comes before the first pipeline step. Write down whose access the evaluation uses and why. A broad admin account gives an unrealistic test and exposes its data to every maker on the agent. If the gate is a cloud flow, its evaluation runs as the owner of that flow’s connection, so pick that owner on purpose.

A reference evaluate-before-deploy release design

Our view: this is a reference design a team can build. It is not a Microsoft diagram, and every step that touches the gate is your own build.

  1. 1

    Build in a custom solution

    Create the agent in a development environment inside a custom solution, not the default one, and add its flows, environment variables and connection references to that solution.

  2. 2

    Keep the definition in source control

    Sync the agent definition through the Power Platform CLI workspace commands or the generally available Visual Studio Code extension, and produce a solution zip.

  3. 3

    Create and seed the test set

    Create the test set in Copilot Studio, choose methods and pass scores, and seed it by importing the CSV kept in the repo.

  4. 4

    Run and poll the evaluation

    Start the run, choose published or draft explicitly, and poll until the run reaches a final state. One run at a time.

  5. 5

    Compute pass or fail

    Calculate the result from the per test case statuses against the threshold your team wrote down.

  6. 6

    Gate the promotion

    Attach your cloud flow to a gated extension and reject the step when the result fails. The flow evaluates the agent in the development environment, because Learn gives a downstream evaluation procedure only for agents deployed with the Copilot Studio CLI (preview), not for solutions promoted through pipelines.

  7. 7

    Configure the target environment

    Deploy managed. Confirm block unmanaged customizations is off, because Learn lists that publishing an agent does not work with it on. Reconfigure authentication and settings that are not solution-aware, set environment variable values, republish, and publish the imported agent.

  8. 8

    Watch and keep evidence

    Watch Monitor, which holds 360 days of metrics and 28 days of session and transcript detail, plus Application Insights if connected. Export evaluation results to CSV before the 89-day window closes.

The commands behind the design:

  • Step 2: pac copilot clone, pull and push keep the definition in sync. pac copilot pack “packages an agent workspace into a Dataverse solution .zip that you can deploy with pac solution import.”
  • Step 4: set runOnPublishedBot explicitly: true for the published agent, false for the draft.
  • Step 7: pac copilot publish covers the final publish.

Two notes on step 7: the block unmanaged customizations page lists “Publishing an agent doesn’t work.” as a known limitation, and the variables overview requires a republish after environment variable changes, except for a value of type secret.

For agents built in Microsoft Foundry instead, az365 decodes the Foundry side of the same release problem. The two do not connect: Learn documents no way to point Foundry evaluations at a Copilot Studio agent. I checked the Foundry cloud evaluation targets page on 2026-11-15, and it does not mention Copilot Studio.

Takeaway: the documented parts cover running the evaluation and promoting the solution. The decision step in the middle is yours.

Decisions your team owns before the first gated release

The threshold. Microsoft’s model migration guidance gives the best basis on Learn: “Define acceptance criteria before evaluating the candidate model, so that the agent evaluation produces a decision instead of only a set of scores.” Its criteria include a “Minimum overall pass rate” and “Critical failures that block migration regardless of aggregate score.” Write both down. Our view: decide up front whether Error, Invalid and Unknown count as failures. A gate that ignores them can pass a run in which nothing was scored. The same guidance warns: “Model outputs are probabilistic. Run important scenarios more than once when variability can affect the decision.”

Which methods gate. Content safety exists as a test method, but the API’s MetricType values include no content safety type. Our view: confirm how safety results reach your pipeline before a gate depends on them.

Ownership and sign-off. Decide two things:

  • Who owns and edits the test set: the maker or the platform team.
  • Who signs off on a change to the threshold.

Our view: a threshold that a maker can lower the night before release is not a control. The risk-tiered agent governance model scales this: stricter sign-off for agents that touch sensitive data, a lighter path for low-risk ones.

Drift and evidence. Learn’s documented trigger for a new evaluation is the “agent model changed” warning. Our view: also rerun after changes to knowledge sources or environment variables. Archive exported results outside Copilot Studio, because results are available in Copilot Studio for only 89 days.

Copilot Studio agent evaluation gives you a callable signal. Pipelines in Power Platform give you a gated extension that can reject a deployment, though it is still rolling out by region. What connects the two is yours to build: the arithmetic, the threshold, where the test set lives and whose identity runs it.

Our view: write those decisions down before the first run, not after the first failure, and version them like code. The gate is then as trustworthy as any other release check.

Get a second pair of eyes on your agent release path

If you are the platform or DevOps lead who now has to build this gate, Citizen Development Academy looks at what your team has built or plans to build with AI, names the top three risks in that release path, and recommends one next step.

Book a free 30-minute AI app review with Citizen Development Academy

Stay in the loop

Get new posts delivered to your inbox. No spam, unsubscribe anytime.

Related articles