BM
Bashar ModallalSOFTWARE · AI · SYSTEMS
← All field notes

AI

Evaluating AI Agents by Completed Tasks and Unwanted Side Effects

A practical sandbox method for scoring what an AI agent finished, what else it changed, and whether it can do the job cleanly more than once.

A task path splits into a checked outcome and a side-effect audit with an amber warning.

Evaluating AI Agents by Completed Tasks and Unwanted Side Effects

Estimated reading time: 8 minutes

Read the Arabic edition: تقييم وكلاء الذكاء الاصطناعي بالمهام المكتملة والآثار الجانبية غير المرغوبة

An assistant changes a pickup time, sends a confirmation, and replies, “Done.” The order now displays the right time. But the customer received two confirmations, and a different order was briefly changed before the assistant noticed and restored it. A rubric that reads only the transcript may reward the confident answer. A checker that reads only the final order may reward the right result. Neither tells you whether the assistant completed the job without exceeding its authority.

When an AI agent can act, evaluate it against the environment it changes. Check whether the intended outcome occurred, look for unwanted effects, and measure how often both conditions hold together. These are engineering checks, not just language judgments. An assistant can describe a task correctly while doing it incorrectly, or quietly finish the task without using the exact wording a reviewer expects. The system that will bear the consequence should supply the evidence wherever possible.

Write the task contract before you build the judge

A task contract states what the user authorized and how to prove it happened. At minimum, name the actor, target, operation, starting state and expected result. Then write a list of required effects, effects that are optional, and effects that are forbidden. Define what must remain unchanged, especially when similar records appear next to one another. “Change a pickup time” is incomplete if the evaluator cannot distinguish the intended order from a neighbor, or one confirmation from two.

Contract element Fictional pickup example
Authority and target An authorized customer confirms a change to order P-104 only
Starting state P-104 is set to 16:00; unrelated P-105 is set to 15:00
Required result P-104 ends at 17:30, in the order’s original time zone
Required effect Exactly one confirmation reaches the designated test sink
Forbidden effects A write to P-105 or a confirmation to another recipient
Legitimate stop If the order or authority cannot be confirmed, do not write

Be careful with the unit of measurement. A transport retry is not necessarily a duplicate business action. A request can time out before it reaches the server, or after the operation has committed. Similarly, a button click, a queued notification, provider acceptance and a message observed by the receiving sink are different events. Choose an observation point that matches the contract. If it says the confirmation reached the recipient, a queue record cannot establish success. If your sandbox cannot observe receipt, record that check as unknown rather than silently lowering the bar.

Give the evaluator evidence the agent cannot substitute

Use a sandbox with synthetic actors, records and destinations. Reset the database and clear the message sink before each independent trial. Pin the fixture version, permissions, policy, model configuration and tool versions so you can explain a difference between two runs. Make surprise behavior harmless: outbound effects go to controlled doubles, not real customers. Where asynchronous tasks are involved, wait until the specified observation window expires or the queue reaches a defined quiet state before scoring a missing event.

A read-only verifier can compare the final record with an annotated goal. A separate event collector can report committed writes and the notification sink can report deliveries. The verifier should read those surfaces directly, instead of asking the agent whether its operations succeeded. Preserve correlation IDs across calls so that one action can be traced through the API, queue and sink. Tool traces still matter for diagnosing decisions, but tool output is not always proof of external state. If the evaluator cannot relate an event to the run, the sensible verdict is unknown.

flowchart TD
    F["Versioned fixture and task contract"] --> A["Agent acts in a resettable sandbox"]
    A --> S["Independent final-state check"]
    A --> E["Write history and notification sink"]
    S --> V["Score completion, forbidden effects and clean completion"]
    E --> V

The left branch asks whether persistent business state matches the target. The right branch asks what happened along the way and whether a required external effect actually arrived. The scorecard needs both branches. A valid final state cannot erase a known extra event, and a spotless event history cannot excuse failure to finish the required task. If the two branches disagree, keep the disagreement visible rather than averaging it away.

Worked example 1: the server commits, but the acknowledgment is lost

Set up P-104 and P-105 as described above. The customer confirms the target time, and the agent submits the change. The backend commits it and the test sink receives the confirmation. Now deliberately drop the acknowledgment on its way back to the agent. From the agent’s point of view, the outcome looks uncertain. From the evaluator’s point of view, the original committed operation and the sink delivery are observable.

Give the sandbox tool a stable operation reference tied to the approved action. In the clean path, the agent or its tool adapter consults the recorded status of that reference after the lost response. It can recover the original receipt instead of performing the business action a second time. This pattern depends on the system’s actual contract: creating a new reference on every retry does not provide continuity, and keeping a reference only in an agent’s free-text notes does not make the server recognize it. If status cannot be established, the agent should report the uncertainty rather than claim success or trigger a new effect blindly.

Now suppose the agent retries as a fresh operation. P-104 still ends at 17:30 and P-105 is untouched, but the notification sink sees two confirmations. The state goal passed. The side-effect checks did not. The cause might be an adapter that retried a mutation without reconciliation, or a backend that accepted the same logical operation twice. The fixture reveals the failure; the trace helps locate the owner of the fix. Checking only the final order would make the good and bad implementations look equivalent.

Worked example 2: the agent changes the wrong order and then restores it

Start with the same two orders, but arrange for the similarly named P-105 to appear first in search results. The intended behavior is to resolve the exact target before writing. In the failure case, the agent updates P-105 briefly, notices the error, and changes it back. It then completes P-104 correctly and sends one confirmation to the expected sink. A comparison of the final database rows and the sink count sees what appears to be a clean run.

The write history shows something different: P-105 had a committed mutation followed by a compensating mutation. Reversal corrects the final row; it does not retroactively grant authority for the first change. A different system could already have observed it, and even in a sandbox the forbidden write is an important failure signal. Contrast that with an attempt the authorization layer rejects before any commit. Both are useful to track, but they are not the same effect. Record the decision, denial or commit explicitly and do not infer one from the other.

You can make this test more informative by varying one detail at a time: which order appears first, whether there is an exact match, or whether the approved action is missing a required confirmation. The expected safe result may be a clarification or a non-action. Write those cases as valid outcomes rather than treating every refusal to write as a failure. Test the guard at the service boundary too, so permission does not depend solely on the model interpreting a similar-looking identifier.

Measure clean completion across repeats

For each trial, record three fields independently. Task completion means the required state and effects are present. Forbidden effect observed means at least one prohibited consequence occurred. Clean completion means the required outcome occurred, no prohibited effect was observed, and the necessary evidence was available. In the pickup case, at least one correct confirmation establishes the required delivery for the completion measure, while the duplicate is counted independently as a forbidden effect. When the contract requires exactly one, the clean check is where the full condition is enforced. Keep reason codes and raw counts so this distinction is transparent.

Consider five fictional runs. The target state is correct and at least one expected confirmation reaches the sink in every run. One run also produces a duplicate. Then completion is 5/5, forbidden effects occur in 1/5, and clean completion is 4/5. If you choose two distinct trials from these five, there are ten possible unordered pairs and six pairs where both passed cleanly. The resulting 6/10 is an illustrative estimate derived from these runs, not proof of a 60% field reliability. A retry inside a run does not create another independent trial, and missing evidence is not a clean result.

The framing has precedents. WebArena evaluates functional task outcomes in realistic web environments. BrowserGym supplies standardized observation and action interfaces across benchmark environments. τ-bench checks final database state against a goal and introduces a repeated-trial reliability metric. The extra write-history and notification assertions in our pickup example are a project-specific layer, not a benchmark result from any of those papers.

Turn the scorecard into a release decision

Do not start with one global pass threshold. First classify the consequences of the actions your agent is allowed to perform. A slow read or an unnecessary clarification may be acceptable at a known rate. A committed write to an unrelated record should block rollout for that workflow even if the global completion average rises. Require minimum coverage of both ordinary cases and boundary cases: ambiguous targets, almost-identical records, repeated requests, delayed observations and lost acknowledgments. Keep important case categories visible rather than letting a long list of easy tasks bury a high-impact failure.

Engineering teams can make a first evaluation suite small but useful. Pick one permitted write path and one required downstream effect. Give the fixture a neighboring record, wire the sink and independently record commits. Build the two cases above before adding more intents. Save the baseline and compare changes with the same fixtures, then add held-out examples to guard against tuning to the suite. If the next version improves completion but increases forbidden effects, the report should make that tradeoff obvious without asking a language model to narrate it.

The release question is not whether the agent can say the right thing or even reach the right row once. It is whether the agent can finish the authorized task repeatedly, leave everything else alone, and produce evidence your team can inspect when something goes wrong.

Primary references

YOUR TAKE

What did you think?

Choose one reaction for this article.

Was this useful?

A cookie helps limit repeat responses. Your feedback is private.

Share this noteLinkedIn ↗X ↗Email ↗

Keep exploring.