Testing breaks down when it covers only model output and ignores the operational stack. A system can pass language tests yet still choose the wrong tool, expose sensitive retrieval data, or take unsafe actions after a context change. For governance, that means the evaluation does not match the deployed risk surface.
Why This Matters for Security Teams
AI testing fails fast when teams validate the prompt-response layer but ignore the operational stack underneath it. Tools, retrieval, and memory are where a harmless answer can turn into a bad ticket action, a sensitive document leak, or an unsafe follow-on step. That is why evaluation has to reflect how the system actually behaves in production, not just how well it chats.
The risk is especially visible in systems that chain tool calls or retain conversational state. A model may produce safe text and still invoke the wrong connector, surface retrieved data outside its intended audience, or carry stale context into a later decision. The DeepSeek breach is a reminder that failures around data exposure and operational control rarely begin at the model layer alone. Current guidance from the NIST AI 600-1 Generative AI Profile reinforces that testing should include the full system context, not just model quality. In practice, many security teams discover these gaps only after an agent has already taken the wrong action or surfaced the wrong data, rather than through intentional pre-production testing.
How It Works in Practice
Effective testing treats the AI application as a composed system. The model is only one component. Retrieval layers, memory stores, tool permissions, and orchestration logic all influence the security outcome. A strong test plan checks whether the system can:
- select the right tool for the right task, and refuse tools it should not use
- retrieve only the documents it is supposed to access
- avoid leaking data from memory across users, sessions, or tasks
- handle stale, conflicting, or adversarial context without taking unsafe actions
That means testing should include prompt injection against retrieval, authorization checks on tool use, and replay tests that simulate stale memory or changed user intent. It also means logging each step of the chain so reviewers can see whether the failure came from retrieval, policy, memory, or model reasoning. NIST’s guidance in the Generative AI Profile is useful here because it pushes teams to evaluate contextual risks, not just output correctness. NHIMG’s coverage of the DeepSeek breach shows why exposed records, backend credentials, and chat history become part of the test surface as soon as retrieval or memory can reach them.
Practically, security teams should run tests across three layers: static unit tests for prompt and policy behavior, integration tests for tool and retrieval boundaries, and adversarial tests for memory persistence and context poisoning. These controls tend to break down when agents are allowed to chain tools across long sessions because the security state changes faster than the test assumptions do.
Common Variations and Edge Cases
Tighter evaluation often increases testing overhead, requiring organisations to balance faster release cycles against broader system coverage. That tradeoff becomes more acute in systems with multiple vector stores, shared memory, or many external tools.
There is no universal standard for this yet, but current guidance suggests several edge cases deserve special treatment. Multi-tenant assistants need explicit tests for cross-user retrieval leakage. Long-running agents need memory reset tests and session-bound assertions. Tool-using copilots need tests for permission drift after a context switch, because the model may remain confident even when the task has changed. Systems that blend search, retrieval, and action also need failure-mode testing for partial outages, since fallback behavior can expose data or trigger unsafe retries.
Security teams should also avoid assuming that a successful offline benchmark proves production safety. A model can score well on answer quality and still fail the moment it meets a live connector, a stale cache, or a malformed document. The right question is not whether the model is smart enough, but whether the whole workflow is safe enough under realistic conditions.
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, CSA MAESTRO and OWASP Non-Human Identity Top 10 address the attack and risk surface, while NIST AI RMF and NIST CSF 2.0 set the governance and control requirements practitioners need to meet.
| Framework | Control / Reference | Relevance |
|---|---|---|
| OWASP Agentic AI Top 10 | LLM04 | Covers tool misuse and unsafe agent actions when tests ignore execution paths. |
| CSA MAESTRO | T5 | Addresses runtime trust in agent workflows, including retrieval and tool chains. |
| NIST AI RMF | Risk management must cover system context, not just standalone model output. | |
| NIST CSF 2.0 | PR.DS-1 | Sensitive data exposure through retrieval and memory maps to data security risk. |
| OWASP Non-Human Identity Top 10 | NHI-07 | Tool and service identities can fail if testing ignores runtime access paths. |
Assess the full AI system lifecycle, including retrieval, memory, and actions.
Related resources from NHI Mgmt Group
- What breaks when AI tools do not share memory across investigations?
- What breaks when AI security testing ignores undocumented endpoints?
- What breaks when AI testing ignores workflows and integrations?
- What breaks when AI security testing is limited to the model layer and ignores enterprise controls?
Deepen Your Knowledge
Reviewed and updated by the NHIMG editorial team on August 28, 2026.
NHI Mgmt Group — the #1 independent authority on Non-Human Identity, IAM, and Agentic AI security. nhimg.org