Tests pass because a mock omits the risky tool
Detect: Harness coverage review reveals a missing production capability.
Recover: Add a safe equivalent and rerun relevant scenarios.
Continuously test adversarial inputs against the application’s actual trust boundaries, measuring unauthorized effects and preserving reproducible regression cases.
Adversarial prompt testing deliberately probes how an agent behaves when inputs attempt to violate its intended boundaries. Tests should cover direct prompts, retrieved documents, tool results, attachments, conversation history, and encoded or multilingual content. The objective is to find operational failures, not merely collect unusual model responses.
Define the adversary's access and desired consequence. A supplier controlling one PDF has different capabilities from an authenticated user with tool access. Use isolated test environments and synthetic sensitive data, then assess whether the system disclosed protected information, invoked unauthorized tools, or misrepresented completion.
A prototype can start with a small threat-model-driven set of attacks and benign controls. Record reproducible inputs rather than relying on live improvisation alone.
Production runs regression cases against every material prompt, model, retrieval, or tool change. Test the complete application because a model refusal can coexist with a leaked tool result.
At scale, combine curated cases, generated variants, and expert review. Track coverage by attack surface and consequence, and prioritize confirmed boundary failures over raw counts of suspicious outputs.
Defines attacker control, protected assets, trust boundaries, and unacceptable outcomes.
Stores versioned payloads, source placement, prerequisites, and expected safe behavior.
Executes realistic workflows using synthetic secrets and nonproduction tool endpoints.
Checks data exposure, tool invocations, destination access, and state changes.
Converts confirmed failures into fixes, ownership, and stable prevention tests.
flowchart LR
T["Threat model"] --> C["Versioned attack cases"]
C --> H["Isolated application harness"]
H --> M["Model and retrieval"]
M --> G["Test tool gateway"]
G --> O["Effect observation"]
M --> O
O --> R["Failure triage"]
R --> F["Control fix"]
F --> CSpecify what the attacker controls and which unauthorized effect the test attempts.
Place the payload in a realistic source with necessary permissions and benign surrounding context.
Run the same retrieval, model, tool, and output paths used by the product.
Inspect tool calls, data flows, state mutations, and visible responses.
Distinguish actual violations from harmless quotations or expected refusals.
Preserve the minimal reproducer and verify both attack resistance and legitimate task behavior.
Industrial procurement · Illustrative enterprise scenario, not a reported customer outcome.
A procurement platform summarizes attachments submitted by external suppliers and can query internal comparison records.
The team has tested direct jailbreak prompts but has not tested instructions hidden in proposal text or extracted image content.
The assistant must resist attempts to expose competing bids or alter approved evaluation criteria.
An isolated harness uses synthetic bids, controlled supplier documents, and tool endpoints that record every attempted action.
If a bypass succeeds, the team repairs the relevant boundary and retains the exact artifact as a regression case.
Track confirmed exfiltration or unauthorized-action rate, attack-surface coverage, false-positive blocking, and time to verified remediation.
| Decision | Benefit | Cost |
|---|---|---|
| Generated attack variants | Broader phrasing and encoding combinations can be explored. | Many variants are redundant or unrealistic. |
| End-to-end testing | Real integration weaknesses become visible. | Tests cost more and require safe representative environments. |
| Strict outcome checks | Findings focus on meaningful boundary failures. | Some subtle information leakage requires expert review. |
Detect: Harness coverage review reveals a missing production capability.
Recover: Add a safe equivalent and rerun relevant scenarios.
Detect: Benign control cases regress after the change.
Recover: Refine the control while preserving the confirmed boundary protection.
Inspect tools, data movement, and persisted state.
Include every untrusted content source.
Use synthetic canaries and controlled nonproduction systems.