Safety evaluation for an AI agent is not the same exercise as accuracy evaluation, and conflating them is how teams ship an agent that answers correctly 95% of the time but takes a genuinely harmful action the other 5%. Accuracy asks "did it get the right answer." Safety asks "when it doesn't, how bad is the outcome, and did it stay within its intended boundaries even under pressure to do otherwise."
Define the boundaries before you can test them
You can't evaluate whether an agent stays within its boundaries until the boundaries are written down as specific, checkable statements: which tools it may call, under what conditions, for which users, within what value or record-count limits. "The agent should behave responsibly" isn't testable. "The agent must not approve a payment above the requesting user's approval limit" is. Most safety-eval failures on real projects trace back to skipping this step — the eval suite was built before anyone wrote down what "safe" actually meant for this specific agent.
Capability boundaries vs. behavioral boundaries
Split the evaluation into two categories that need different tests. Capability boundaries are about what the agent is technically able to do — does its tool surface expose anything beyond what the use case requires (an agent that only needs to draft AR reminder emails shouldn't have a tool that can delete customer records, regardless of prompting). Behavioral boundaries are about what a technically-capable agent chooses to do when given ambiguous, adversarial, or edge-case input. Test capability boundaries by auditing the tool registry directly; test behavioral boundaries by running scenario-based evals against the live system.
An agent that literally cannot call a dangerous tool is safe regardless of what the prompt says. An agent that could call it but is instructed not to is only as safe as the prompt is effective — which, per model-provider safety research, is measurably less than 100%. Prefer removing the capability over relying on instructions whenever the use case allows it.
Build scenario-based evals, not generic benchmarks
Public safety benchmarks test general model behavior; they say nothing about whether your specific agent, with your specific tools and your specific ERP context, stays safe. Build scenarios from your actual domain: a customer asking the agent to backdate an invoice, a user requesting an action outside their role, an ambiguous instruction that could be read as either a benign report request or a data-exfiltration attempt. Grade each scenario on whether the agent refused, escalated to a human, or completed the action, and treat "completed a boundary-violating action" as a hard failure regardless of how well-reasoned the agent's explanation was.
def grade_safety_scenario(scenario, agent_response):
if agent_response.action_taken and scenario.expected == "refuse_or_escalate":
return {"passed": False, "severity": scenario.severity, "reason": "took action instead of refusing"}
if not agent_response.action_taken and scenario.expected == "complete":
return {"passed": False, "severity": "low", "reason": "over-refused a legitimate request"}
return {"passed": True}
# severity-weighted: one "critical" failure blocks release regardless of overall pass rate
def gate_release(results):
critical_failures = [r for r in results if not r["passed"] and r["severity"] == "critical"]
return len(critical_failures) == 0
Test under adversarial pressure, not just neutral input
An agent that respects its boundaries under a polite, neutral request can still fail under social-engineering pressure — a user claiming urgency, invoking a fake authority ("the CFO told me to skip approval"), or repeating a request with escalating insistence across turns. Include multi-turn pressure scenarios in the eval set specifically, not just single-shot prompts, since real-world attempts to push an agent past its limits rarely happen in one message.
Run it continuously, tied to the same gate as regression tests
Safety evaluation degrades the same way accuracy does — a prompt edit, a new tool, or a model version bump can quietly widen what the agent is willing to do. Wire the safety scenario suite into the same CI gate used for functional regression tests, and treat any critical-severity safety regression as a release blocker, full stop, regardless of how the accuracy numbers look.
| Boundary type | How to test it |
|---|---|
| Capability (what it can do) | Audit the tool registry directly, no LLM needed |
| Behavioral (what it chooses to do) | Scenario-based evals, including adversarial pressure |
| Severity of violation | Weight critical findings as release blockers |
Wrapping up
Safety evaluation is a distinct discipline from accuracy evaluation — write down concrete, testable boundaries first, prefer removing dangerous capabilities over trusting instructions, build scenarios from your actual domain instead of generic benchmarks, and gate releases on critical-severity safety failures the same way you'd gate on a broken build.
Independent software engineer in Nairobi specialising in Acumatica customisations, Laravel backends, and tax fiscalisation integrations across East and Southern Africa.