Teams should run the agent in a separate execution environment from the grader, with only the outputs passed across a narrow interface. The sandboxed task runner should prevent the agent from reading labels, hidden tests, or scoring code, and the grading logic should be isolated from model prompts, tools, and memory so the agent cannot influence its own score.
Why sandboxing and grading must be split
The core design principle is separation of duties. The agent should only control a constrained task environment, while the grader should remain a separate, trusted component that sees only the artefacts it is meant to score. That reduces the chance that a prompt, tool call, or side effect can alter the criteria being applied.
A clean split also makes the trust boundary explicit. The sandbox can be treated as an execution zone for untrusted model behaviour, while the grader is part of the evaluation plane. When those roles blur, hidden tests, labels, scoring rules, or reference answers become part of the agent’s attack surface.
What the sandboxed runner must hide
The sandbox should expose only the minimum interface needed to complete the task, typically inputs, execution time, and a bounded output channel. It should not expose hidden tests, rubric internals, scoring code, or filesystem paths that reveal evaluation artefacts. If the agent can inspect those details, it can optimise for the grader rather than for the task.
This is also where output mediation matters. The safest pattern is to let the agent produce a result, then pass only that result, or a narrowly typed summary of it, to the grader. The grader should not accept direct control signals from the agent, and it should not run in the same process, notebook, or memory space as the model.
How to keep grading logic out of the agent's reach
The grading side should be treated as trusted infrastructure, not as another tool the model may discover. Keep prompts, policies, scoring thresholds, and reference data outside the sandbox, and avoid embedding them in environment variables or shared mounts that the agent can read back. For teams building agent evaluation pipelines, AI Agent Sandboxing and Code Execution Guide is a useful reference for isolating code execution and egress.
That boundary should extend to orchestration. If the agent can call back into grader logic, adjust its own prompt after seeing partial scores, or influence what gets logged and replayed, then the evaluation is no longer independent. The right model is one-way flow: sandboxed execution produces artefacts, and the grader consumes them without exposing its internals in return.
Risk and Threat Considerations
When grading and execution are coupled, the main risk is score manipulation through information leakage or prompt injection into the evaluation path. The agent may not need to break the sandbox if it can infer hidden tests, exploit shared state, or cause the grader to accept a crafted output format that bypasses intended checks.
Failure mechanism: A shared runtime, shared memory, or shared prompt stack lets the agent observe or influence labels, scoring rules, or test cases, which defeats independent evaluation and can produce inflated or meaningless scores.
Impact: Teams lose trust in benchmark results, reward the wrong behaviour, and may ship agents that optimise for the evaluator rather than the underlying task. In adversarial settings, that same flaw can leak hidden evaluation assets or enable test-set contamination.
Standards & Framework Alignment
This section maps relevant standards and security frameworks to the operational risks and controls described in this guidance.
OWASP Agentic AI Top 10 addresses the attack and risk surface, while CIS Controls v8 and NIST SP 800-53 Rev 5 set the governance and control requirements practitioners need to meet.
| Framework | Control / Reference | Relevance |
|---|---|---|
| OWASP Agentic AI Top 10 | ASI03 — Identity & Privilege Abuse | Agent scoring pipelines fail when the agent can see or influence privileged evaluator context. |
| ASI05 — Unexpected Code Execution | Sandboxed execution is meant to stop agent-generated code from running beyond its intended boundary. | |
| Recommendation — Isolate grader privileges and deny the agent any path to influence scoring state. Run untrusted agent code in a hardened sandbox with strict output-only mediation. | ||
| CIS Controls v8 | CIS-4 — Secure Configuration of Enterprise Assets and Software | Separate execution and grading environments require hardened configuration and isolation boundaries. |
| Recommendation — Harden the sandbox and grader as separate environments with minimal exposed services. | ||
| NIST SP 800-53 Rev 5 | SC-39 — Process Isolation | Process isolation directly supports keeping agent execution separate from grading logic. |
| AC-6 — Least Privilege | The agent should only receive the narrowest access needed to complete its task. | |
| Recommendation — Enforce process isolation between the sandboxed runner and the grading service. Restrict the agent to the minimum interfaces and data needed for execution. | ||
Practitioner Guidance
What to verify: Confirm that the agent process cannot read grading inputs, hidden tests, or scorer code through mounted volumes, logs, exceptions, or debug endpoints. Also verify that the grader cannot consume raw prompts, mutable agent memory, or tool outputs that were not explicitly intended for scoring.
Implementation sequence: Start with process and filesystem isolation, then constrain the egress path to a single output channel, and finally run the grader in a separate trust zone with its own secrets and configuration. If you need richer evaluation metadata, add it deliberately and one field at a time rather than exposing the whole evaluation environment.
Practitioner takeaway: The evaluation boundary only works when the agent can affect results through outputs, not through visibility into the rules of scoring.
Related resources from NHI Mgmt Group
Deepen Your Knowledge
Free weekly newsletter
Subscribe to the NHI & AI Identity Journal
The latest on NHI and Agentic AI security – articles, research, breaches, news and events every week.
Bonus 33% off our NHI Course when you subscribe.
Reviewed and updated by the NHIMG editorial team on November 4, 2026.
NHI Mgmt Group — the #1 independent authority on Non-Human Identity, IAM, and Agentic AI security. nhimg.org