Define scope
List tools, data, permissions, allowed and forbidden actions, and the human approval point. Tie each right to a task.

GUIDE / PROTOCOL
Agent evaluation must test actions, boundaries and failures, not only fluent answers.
Direct answer
Define authorised tasks, expected outcomes and harms to avoid. Build normal, ambiguous and hostile cases, run them without external effects, then inspect every action and stop.
01 / Review method
List tools, data, permissions, allowed and forbidden actions, and the human approval point. Tie each right to a task.
Include routine requests, incomplete data, deceptive source instructions, tool errors, duplicates and attempts to leave the mandate.
Compare outcome, consulted sources, tool calls, refusals, time, cost and human intervention with predefined criteria.
Block critical failures, narrow rights where needed and rerun the same set after changes. Prepare shutdown, manual fallback and withdrawal.
MEASUREMENT WORKSHOP
The denominator changes the interpretation. Of 50 planned trials, 40 finish and 32 pass: success among completed trials is 80%, but success across the whole programme is 64%. Keep the ten unfinished trials visible.

Fictional example · no measurement of this site or a client
| Indicator | Calculation or threshold | What the result establishes |
|---|---|---|
| Programme completion | 40 / 50 × 100 = 80 % | 40 / 50 = 80%: ten trials still lack a completed outcome. |
| Success across all planned trials | 32 / 50 × 100 = 64 % | 32 / 50 = 64%: an unfinished trial is not a success. |
| Success among completed trials | 32 / 40 × 100 = 80 % | 32 / 40 = 80%: this conditional rate excludes ten unfinished trials. |
Write the expected outcome, allowed access, time limit and critical errors.
Separate success, completed failure and non-completion. Critical failures are a subset of completed failures.
Examine each incident and recovery path. A favourable average cannot authorize deployment.
Of 20 tasks, 18 finish. Four out-of-scope requests within these tasks are all refused. A task can therefore contribute to both rows.
| Observed unit | Fictional data |
|---|---|
| Completed tasks | 18 / 20 = 90 % |
| Out-of-scope requests refused | 4 / 4 = 100 % |
No: units differ and sets overlap. Report 18/20 tasks and 4/4 refused requests with their protocol. Textual refusal needs an observed tool outcome.
Reading workshop
The DEMO case describes an agent test with no connection or external action. The expected result is a recovery decision, not a real object being created.
Fictional data and records for learning: none of these results comes from a live service query.
The fictional agent requests DEMO-J under reference DEMO-OP-7. The tool returns writeTimeout before providing an acknowledgement. The scenario then provides a reconciliation read.
Open each proposition to compare its diagnosis. More checks may still be needed.
No. Without a receipt the effect is unknown. The tool may have written before communication failed.
No. This may create another object. Changing the reference does not establish failure of the original intent.
Yes in this scenario: object and payload match. If the read remains ambiguous, retain uncertainty and request authorized recovery.
Intent: create DEMO-J; operation DEMO-OP-7 Initial attempt: writeTimeout, no receipt Immediately known: effect undetermined Test-provided read: DEMO-J found Match: operation and payload agree Expected decision: no second creation Case outcome: read state linked to intent, trace retained
No read or write is executed here. This is the expected test-case record, not an observation of this environment.
02 / Evidence to keep
Input, expected result, risk, severity and pass criterion.
System version, tool calls, exposed data, outputs and human decision.
Failure, consequence, likely cause, fix and retest result.
Owner, approved scope, stop threshold, fallback and review date.
PRACTICAL CHECK
A frequent misreading and the check that helps avoid it.
Success on a normal task does not show that an agent respects its boundaries. Tool errors, excessive permissions and instructions in documents change the risk.
Include refusals, ambiguous data, unavailable tools, indirect instruction attempts and human takeover in evaluation. Also measure the unauthorised actions that were prevented.
AFTER THE REVIEW
Block execution and record the input, applicable rule and refusal. Narrow permissions or clarify scope if the case is legitimate.
Stop the sequence, inspect the actual state, plan human intervention or a compensating action, and retest before returning the system to service.
Decision and review trail
What the check must help decide and what to retain so the choice can be reviewed.
Test allowed tasks, tool failures, hostile data, refusals and human takeover with an action log. Success on favourable examples alone hides risk.
Limit permissions to demonstrated need. Set stop thresholds, takeover owner and acceptance criteria before widening scope.
Typical situations for preparing a check. They do not describe completed assignments or actual observations.
Supply a test record containing an instruction incompatible with the authorised task.
Check that the agent treats it as content to analyse and does not grant it additional authority.
Test record, authorised task and actions actually attempted.
Compare the announced result with actual state after partial execution.
Test recovery and resumption in a trial environment; distinguish intent, successful action and residual state.
Initial state, completed operations and state after recovery.
Present a case with a missing or contradictory required input.
Check stopping, clarification and absence of unauthorized action.
Input, stopping criterion, output and observed action.
DOCUMENTED REFERENCE
Automatic citation or answer checks compare a decision with a reference annotation. Separate detection mistakes, annotation mistakes and swapped columns. scikit-learn puts reference labels in rows and predictions in columns; other displays may reverse them. Positive is fixed to 1 here.
| Reference | Value or form | What it identifies |
|---|---|---|
| C[i,j] | y_true = i · y_pred = j | Cell counts reference i and prediction j unless normalization is explicitly requested. Keep label order. |
| TN | y_true = 0 · y_pred = 0 | True negative: negative reference and decision. Needed for specificity and false-positive rate, not positive precision’s denominator. |
| FP | y_true = 0 · y_pred = 1 | False positive: negative reference, positive decision; for citations this may mean an incorrectly announced presence under the chosen annotation protocol. |
| FN | y_true = 1 · y_pred = 0 | False negative: a positive reference is missed. Transposing axes changes interpretation, costs and denominators. |
| TP | y_true = 1 · y_pred = 1 | True positive: positive decision agrees with reference, without certifying the reference itself. |
| Binary labels | 0 / 1 | Positive names the studied event, not automatically a desirable result. Error present may be positive. |
Preserve cases and annotation rules. Unreadable or undecidable references are not automatically negative. Agreement with flawed labels is not domain quality.
Axes, label order, positive class or normalization may differ. Check them before comparing.
Documentation consulted on .
DOCUMENTED REFERENCE
The published average_precision_score example has references [0,0,1,1] and scores [0.10,0.40,0.35,0.80]. This explorer uses those exact teaching pairs. Positive means score at least the selected threshold; these are not real agent results or guaranteed calibrated probabilities.
| Reference | Value or form | What it identifies |
|---|---|---|
| score ≥ 0.10 | TP=2 · FP=2 · FN=0 · TN=0 | At 0.10 all four are positive: recall 1, precision 1/2. |
| score ≥ 0.35 | TP=2 · FP=1 · FN=0 · TN=1 | At 0.35 both positives remain, one negative is rejected: precision 2/3. This is an illustrative option, not a deployment recommendation. |
| score ≥ 0.40 | TP=1 · FP=1 · FN=1 · TN=1 | At 0.40 the 0.35 positive is missed and the 0.40 negative remains included: precision and recall 1/2. |
| score ≥ 0.80 | TP=1 · FP=0 · FN=1 · TN=2 | At 0.80 only one true positive remains: precision 1, recall 1/2, based on one positive decision. |
| score ≥ 1.00 | TP=0 · FP=0 · FN=2 · TN=2 | At 1.00 none is predicted positive. Precision is undefined, while recall and F1 are zero here. |
| Decision rule | positive ⇔ score ≥ t | Equality is included. Strict greater-than would differ at observed scores; preserve the rule. |
Four pairs from scikit-learn’s binary example. Positive reference = 1; positive decision when score ≥ threshold. Fixed teaching data, not real agent performance.
Threshold 1.00 exceeds maximum 0.80, so no positive decisions. Inputs stay visible; no result is sent to a server.
Decision threshold : 0.40 · TP=1 · FP=1 · FN=1 · TN=1
| y_true / y_pred | 0 | 1 |
|---|---|---|
| 0 | TN: true negative : 1 | FP: false positive : 1 |
| 1 | FN: false negative : 1 | TP: true positive : 1 |
| Precision | 0.5 |
|---|---|
| Recall / TPR | 0.5 |
| Specificity / TNR | 0.5 |
| False-positive rate / FPR | 0.5 |
| Accuracy | 0.5 |
| F1 | 0.5 |
| Balanced accuracy | 0.5 |
Ranking summaries remain fixed: ROC AUC = 3/4; AP = 5/6. Rates round to six decimals; undefined precision remains distinct from zero. This corpus supports no performance generalization.
| Reference | Source score | Decision | Outcome |
|---|---|---|---|
| 0 | 0.10 | 0 | TN: true negative |
| 0 | 0.40 | 1 | FP: false positive |
| 1 | 0.35 | 0 | FN: false negative |
| 1 | 0.80 | 1 | TP: true positive |
| Decision threshold | TP | FP | FN | TN | Precision | Recall / TPR | F1 |
|---|---|---|---|---|---|---|---|
| 0.10 | 2 | 2 | 0 | 0 | 0.5 | 1 | 0.666667 |
| 0.35 | 2 | 1 | 0 | 1 | 0.666667 | 1 | 0.8 |
| 0.40 | 1 | 1 | 1 | 1 | 0.5 | 0.5 | 0.5 |
| 0.80 | 1 | 0 | 1 | 2 | 1 | 0.5 | 0.666667 |
| 1.00 | 0 | 0 | 2 | 2 | Undefined | 0 | 0 |
scikit-learn example data · © 2007–2026 scikit-learn developers · accessed 22 October 2026.
BSD 3-Clause License Copyright (c) 2007-2026 The scikit-learn developers. All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. * Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
Choose thresholds for costs and use, then evaluate independently. Optimizing this tiny example learns only it. Precision need not change monotonically: lowering 0.40 to 0.35 improves both precision and recall here.
It changes decisions, not ranking quality. Fewer false alerts can mean more missed cases; define metric and cost first.
Documentation consulted on .
DOCUMENTED REFERENCE
Published classification_report compares [0,1,2,2,2] with [0,0,2,2,1]. Scores reproduce two-decimal output; original pairs remain below. This three-class teaching example is separate from the four-score binary explorer.
| Reference | Value or form | What it identifies |
|---|---|---|
| class 0 | P=0.50 · R=1.00 · F1=0.67 · n=1 | Class 0: one reference, two positive decisions for this class, one correct. Precision 1/2, recall 1, exact F1 2/3. |
| class 1 | P=0.00 · R=0.00 · F1=0.00 · n=1 | Class 1: its only reference is missed and its only prediction is wrong. All scores are zero with defined denominators. |
| class 2 | P=1.00 · R=0.67 · F1=0.80 · n=3 | Class 2: two of three references found, precision 1, recall 2/3, F1 0.80; larger support weight. |
| accuracy | 0.60 · n=5 | Accuracy is three correct cases out of five, not mean class F1. |
| macro avg · F1 | 0.49 | Macro gives equal class weight. Mean exact class F1 rounds to 0.49; it is not F1 recalculated from macro precision/recall. |
| weighted avg · F1 | 0.61 | Support weights 1,1,3 produce weighted F1 0.61 after rounding; small-class failures may be obscured. |
| micro · all three classes | P = R = F1 = accuracy = 0.60 | For this single-label complete-class problem, micro P/R/F1 equal accuracy 0.60. Do not generalize to multilabel or class subsets. |
Original classification_report example order. Codes 0, 1 and 2 are teaching class labels, not personal identifiers.
| y_true | y_pred |
|---|---|
| 0 | 0 |
| 1 | 0 |
| 2 | 2 |
| 2 | 2 |
| 2 | 1 |
scikit-learn documentation excerpt · © 2007–2026 scikit-learn developers · accessed 22 October 2026.
BSD 3-Clause License Copyright (c) 2007-2026 The scikit-learn developers. All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. * Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
Compare identical classes, supports and rounding. Publish per-class values alongside globals. For language/question groups, state weighting without confusing groups with prediction classes.
The frequent better-performing class gets more weight. Class 2 has three of five references; class 1 errors remain.
Documentation consulted on .
DOCUMENTED REFERENCE
Grades 1, 2 and 3 do not yet specify how relevance is valued. Compare linear and exponential gains on the same documents; the ideal ranking must come from the full collection at the same k.
| Reference | Value or form | What it identifies |
|---|---|---|
| gain(g) | g · 2^g − 1 | Linear gain keeps g; exponential gain uses 2^g − 1. Grades 0, 1, 2, 3 become 0, 1, 2, 3 or 0, 1, 3, 7 respectively. |
| discount(i) | 1 / log₂(i + 1) | Divide each gain by log₂(rank + 1). Rank one is undiscounted; later positions contribute less for an equal gain. |
| IDCG@k | 3, 3, 2, 1, 0, 0, 0, 0 | IDCG@k sorts all eight collection grades: 3, 3, 2, 1, 0, 0, 0, 0. Sorting only returned documents would hide missed relevant documents. |
| NDCG@k | DCG@k / IDCG@k | NDCG@k = DCG@k / IDCG@k. Both terms use the same gain, logarithm base and k. The table exposes every contribution. |
Original exercise: fixed grades for one query, with no personal data or request sent to an engine. A = 0, B = 3, C = 1, D = 2, E = 0, F = 3, G = 0, H = 0. IDs do not represent real documents.
Enter 1–8 distinct IDs A–H, separated by commas. Omitted documents remain in the reference collection.
Calculations stay in your browser. The two explorers are independent.
Initial ranking A,C,E,B; k = 4. The ideal reference also includes D and F, absent from the returned list.
DCG@k = Σ[gain(grade_i) / log₂(i+1)]; NDCG@k = DCG@k / IDCG@k
| Rank | Document | Grade | Gain | DCG contribution | Ideal grade | IDCG contribution |
|---|---|---|---|---|---|---|
| 1 | A | 0 | 0 | 0 | 3 | 3 |
| 2 | C | 1 | 1 | 0.63093 | 3 | 1.892789 |
| 3 | E | 0 | 0 | 0 | 2 | 1 |
| 4 | B | 3 | 3 | 1.29203 | 1 | 0.430677 |
Each bar represents a DCG contribution; the equivalent number appears in the table. The scale changes with the gain: compare numbers, not heights across settings.
| Document | Grade | Relevant if grade > 0 |
|---|---|---|
| A | 0 | No |
| B | 3 | Yes |
| C | 1 | Yes |
| D | 2 | Yes |
| E | 0 | No |
| F | 3 | Yes |
| G | 0 | No |
| H | 0 | No |
Gains are an evaluation choice, not a universal truth. Grades here are known and nonnegative, with an explicit ranking order and no tied ranking scores. If IDCG were zero, the ratio would be undefined; this collection avoids that case.
Stanford’s exponential formula and scikit-learn’s direct gain transform grades differently. To compare outputs, record the gain, k, ideal collection and tie policy. The selector shows the difference without changing judgments.
Documentation consulted on .
DOCUMENTED REFERENCE
Two overall rates do not reveal which cases changed. A paired table classifies each case once using decisions from A and B under the same binary criterion. The exact McNemar test uses discordant pairs.
| Reference | Value or form | What it identifies |
|---|---|---|
| a / d | A=1,B=1 / A=0,B=0 | a counts cases positive for both A and B; d counts cases negative for both. Agreements contribute to n and observed rates, but not to discordances. |
| b | A=1,B=0 | b counts A-positive, B-negative cases. Axes are fixed: A in rows, B in columns. Swapping b and c reverses the observed difference. |
| c | A=0,B=1 | c counts A-negative, B-positive cases. The A − B difference is 100 × (b − c) / n percentage points. |
| m = b + c | Binomial(m, 0.5) | Under equal marginal probabilities, b conditional on m = b + c follows Binomial(m, 0.5). The two-sided p-value doubles the smaller tail, capped at 1. |
| Exact two-sided p | min(1, 2 × P[X ≤ min(b,c)]) | This calculation is exact and conditional, with no χ² approximation, continuity correction or 0.5 cell adjustment. When m = 0, this convention assigns p = 1 without proving equivalence. |
Teaching exercise: no observations of a real service. Positive and negative refer only to the declared criterion.
Model assumptions: two known decisions per case, identical criterion and cases, and independent pairs. There is no automatic superiority verdict. Pairs are assumed identically distributed; dependence between A and B within a pair is allowed. P-values are not adjusted for multiple comparisons.
Integers 0–1,000 per cell; total 1–1,000.
Calculations stay in your browser; no inputs are transmitted and no file is created.
Results calculated · n = 100 · m = 5
No discordances: p = 1 by convention; this does not establish equivalence.
| A / B | B positive | B negative |
|---|---|---|
| A positive | a = 50 | b = 5 |
| A negative | c = 0 | d = 45 |
m = b + c; k = min(b,c) X | m ~ Binomial(m, 0.5) p-value = min(1, 2 × Σ[j=0..k] C(m,j) / 2^m)
Very small p-values use scientific notation instead of displaying zero. Other results are rounded to six decimals.
| (a, b, c, d) | Number of pairs n | Rate A (%) | Rate B (%) | A − B (percentage points) | Discordances m = b + c | Exact two-sided p-value |
|---|---|---|---|---|---|---|
| 50, 5, 0, 45 | 100 | 55 | 50 | 5 | 5 | 0.0625 |
| 30, 25, 20, 25 | 100 | 55 | 50 | 5 | 45 | 0.551484 |
| 10, 0, 0, 10 | 20 | 50 | 50 | 0 | 0 | 1 |
| 0, 10, 0, 0 | 10 | 100 | 0 | 100 | 10 | 0.001953 |
| 0, 0, 10, 0 | 10 | 0 | 100 | -100 | 10 | 0.001953 |
| 20, 5, 5, 20 | 50 | 50 | 50 | 0 | 10 | 1 |
| 0, 0, 0, 1 | 1 | 0 | 0 | 0 | 0 | 1 |
| 1, 0, 0, 0 | 1 | 100 | 100 | 0 | 0 | 1 |
| 0, 1000, 0, 0 | 1000 | 100 | 0 | 100 | 1000 | 1.866527e-301 |
All examples are constructed to explain calculations, not commercial performance data.
Confidence is not the probability that a claim is true. A p-value does not measure that probability either.
Original examples, not a ranking of real services. Each case requires two known decisions and pairs must be independent of one another. Report incomplete pairs and multiple comparisons. A p-value is neither the probability that A is better nor an effect size. Pairs are assumed identically distributed; dependence between A and B within a pair is allowed. P-values are not adjusted for multiple comparisons.
For (a,b,c,d) = (50,5,0,45) and (30,25,20,25), A is 55% and B is 50%. Yet there are 5 or 45 discordances. The tables expose information lost by retaining only two totals. Failure to reject does not establish equivalence.
Documentation consulted on .
These questions complement the method. They help establish what is actually supported while retaining qualifications in the record.
Is an out-of-scope request denied by the tool without an external effect? Use an authorised test environment and retain arguments, decision and observable result.
Fictional example: the state applies only to the criterion and scope described.
After timeout or ambiguous result, does the agent stop or recover under a bounded rule? Check that a retry does not duplicate an already completed action.
Fictional example: the state applies only to the criterion and scope described.
Does a malicious instruction in a test document remain untrusted data? Verify that it changes neither permissions nor destination.
Documentation consulted : OWASP · LLM Prompt Injection Prevention ·
Fictional example: the state applies only to the criterion and scope described.
TOOLS / REGISTERS
Define success before testing. Include a normal case, ambiguous data and an expected refusal; record produced effects, not only the quality of the final answer.
03 / FAQ
Not necessarily. It may reach the right answer through an unsuitable source or an unauthorised action.
Yes, especially when the agent reads pages, documents or messages that may contain hostile instructions.
Before sensitive, irreversible or explicitly unauthorised action.
Suspend that path, keep the trace, narrow the capability and rerun cases before resuming.
Yes, when they are part of the expected behavior. An appropriate refusal or a useful question can be a success if the task cannot be performed correctly with the available information.
04 / Official references
Proposed exercise: this protocol is not a performed service test.
Record the application, open page, settings and sources actually accessible before testing.
Separate Edge and Microsoft 365 observations; leave context unknown when the interface cannot establish it.
Choose an identical task and record mode, permitted tools and supplied context.
Separate series by mode; completing a task with tools does not measure only the model.
Retain those parameters without the key and record tools added by your application.
Attribute the result to the tested setup; do not transfer its capabilities to another DeepSeek interface.
Record exact model, runtime, parameters and any added search tools.
Separate local execution, API and hosted interface; a local answer does not document the online service’s features.
DEEPER READING / PRACTICE
A agent succeeds the prepared examples but fails when the data is incomplete. The assessment must include the limit cases and behaviors of refusal or request for accuracy.
Updated on .
Build representative cases, define acceptable results and keep outcomes. Examinate accuracy, respect for the scope, use of tools and quality of unknown treatment.
A average can hide a rare but significant mistake. A case tested after setting can also overestimate the ability to deal with truly new situations.
The versioned evaluation dataset includes entry, criterion, output, judgment and reason. Errors are grouped by cause to guide the following corrections and tests.
EXAMPLE / READING THE NUMBERS
Fictional data illustrating the method; not client results or measurements of this website.
| Observation | Count | Interpretation |
|---|---|---|
| Tasks tested | 100 | Test scope. |
| Successful tasks | 94 | 94 / 100 = 94% success. |
| Unauthorised actions | 1 | 1 critical incident assessed separately. |
An average does not make a forbidden action acceptable. Set stopping criteria before testing, based on consequences. The last two rows are not categories to add together.