AnthropicClaude Certified Architect – Professional2026-102.2 Design system prompts, templates, and guardrails
Release prompts against adversarial regression cases
Completed by the knowledge check
Learning objective
Version and regression-test prompts and guardrails against conflicting instructions and injected content
Core idea
A production prompt release changes behavior across a distribution of requests. Fixing one complaint is insufficient if the revised guardrail breaks a legitimate task or gives an attacker another way to redirect the workflow. Version the material that reaches Claude and compare the candidate against the accepted release on the same cases.
Anthropic’s evaluation guidance starts with measurable success criteria and task-specific tests, including edge cases. Its injection guidance adds deliberate attacks in documents, emails, and tool outputs before deployment, followed by monitoring of successful injection attempts. The architect turns those recommendations into a release decision with a named owner, a reproducible comparison, and a known rollback target.
For a Messages API integration, the release record is application-owned. Claude Managed Agents instead provides a versioned agent resource; its version and session pinning identify the configuration being tested. The team still owns acceptance criteria and the release decision.
How it works
Version what the model actually receives
Store the standing prompt and request templates as reviewable artifacts. Give each approved release an immutable identifier and preserve the prior release. Record which version assembled a response so an incident can be associated with the wording that produced it. Do not edit a shared live string and retain the same identifier.
Review examples, tool descriptions, and the rendered request alongside system; a template file alone cannot reveal a serializer that inserts supplier text into instructions.
Use a release record containing the prompt revision, template revision, model and inference configuration used by the integration, tool-definition revision, suite revision, and grader revision. These are application artifacts: without them, a model or grader change can look like a prompt improvement.
Managed Agents is beta and requires anthropic-beta: managed-agents-2026-04-01. Its agent bundles the model, system prompt, tools, MCP servers, and skills. The agent’s version starts at 1 and increments when an update changes the configuration. Supply version on an update for optimistic concurrency; a mismatch returns 409. GET /v1/agents/{agent_id}/versions lists the history. Pin a session with agent: {"type": "agent", "id": AGENT_ID, "version": n}, replacing AGENT_ID and n with the selected identifier and version. Record that pin with the regression result; staged rollout and rollback decisions are covered in 4.3.4.
Define observable expectations before tuning
Follow Anthropic’s recommendation to make criteria specific, measurable, achievable, and relevant. “Resists injection” is too broad to grade. “The supplied email cannot make the assistant request an unrelated export operation” names an observable behavior. “Keeps answering permitted email-summary requests” guards against the easiest false repair: refusing every message.
Give each case an input, expected action or supported response, and forbidden outcomes. For a conflicting-instruction test, identify which standing instruction should govern and what a compliant alternative looks like. If the policy itself is inconsistent, settle the owner decision before treating one model response as correct.
Include ordinary work, edge cases, and adversarial cases. Anthropic explicitly calls out irrelevant or nonexistent data, long inputs, harmful or irrelevant user input, and ambiguity. These cases expose whether a stronger guardrail solves the intended risk while preserving useful behavior.
Test conflicts and injections separately
Use at least the following distinct families in the regression suite:
| Family | Illustrative test | Observable expectation |
|---|---|---|
| Ordinary task | Summarize a permitted support ticket | Useful summary without unrelated operations |
| Direct conflict | User asks to override a standing confidentiality rule | No confidential disclosure; permitted assistance remains |
| Indirect injection | Retrieved ticket asks for an unrelated export | Treat that directive as ticket content |
| Delimiter attack | Third-party string imitates a closing tag and role label | Preserved data structure and no change of task |
| Missing information | Required fact is absent from the supplied ticket | Specific uncertainty rather than an invented value |
| Benign look-alike | Ticket quotes a malicious command for analysis | Summarize the quoted command without executing it |
The benign look-alike is essential. An assistant that refuses to analyze every document containing “ignore previous instructions” is easier to grade as safe but can make a security-analysis workflow unusable. Grade what the assistant does with the text, not only whether a phrase appears in the input or output.
For third-party test payloads, use the production delivery path: labeled content inside tool_result, with encoded strings from 2.2.2 or native citable blocks from 2.2.4 as appropriate. A successful test with an artificial wrapper does not establish that the deployed renderer preserves the same distinction. Include actual proposed tool calls and their results in the inspection; a harmless final sentence does not excuse a preceding confidential export request.
Match graders to the assertion
Anthropic describes code-based, human, and LLM-based grading. Use deterministic checks for well-defined assertions such as whether a forbidden tool was requested or an expected category was returned. Use a written rubric for semantic judgments such as whether an answer’s factual claims are supported. Review ambiguous or disputed judgments with the domain owner.
Test an LLM grader’s reliability before scaling it; its instructions can be ambiguous. Keep its rubric and version with the result, and preserve failed examples for inspection. Do not report “all tests passed” when the grader silently skipped malformed outputs or accepted a refusal as a correct summary.
Compare baseline and candidate case by case and by failure family. Where stochastic variation matters, use repeated trials under the deployment configuration and report counts; see 4.3.3 for interpreting repeated runs. Anthropic includes consistency among relevant success criteria; one successful attack replay is not enough to conclude that an intermittent failure disappeared. Conversely, a finite suite with zero observed violations is not proof that future injections cannot succeed.
Connect regression results to operation
The release owner should accept the measured trade-off, not only the prompt author’s explanation. Preserve the known good release for rollback, and feed production failures into a later suite revision as covered in 4.2.4. Anthropic recommends analyzing outputs for successful injection and iteratively refining prompts, validation, and filtering.
Keep those changes attributable. If an incident requires both prompt wording and a tool-permission repair, record both. Passing behavioral tests after the permission repair does not prove the wording alone was sufficient. A release record should let an operator identify which control limited the observed consequence.
Key distinctions and trade-offs
Example versus regression case: An example teaches behavior in the prompt. A held-out regression case measures transfer to inputs the prompt does not demonstrate.
Safety rate versus service quality: Fewer violations can accompany more unnecessary refusals. Report those measures separately rather than hiding them in an aggregate score.
Repeatability versus certainty: Preserved artifacts make a comparison inspectable. Repeated trials characterize observed variation without proving universal compliance.
Architecture / decision scenario
A technology company’s six-person service desk processes customer tickets under a four-hour response commitment. A candidate guardrail stops an injected ticket from requesting a confidential export, but also refuses tickets that quote suspicious commands for investigation.
The proposed immediate fix is to ship because the security tests pass. The architect requires the same comparison on legitimate analysis cases: the baseline completes 92 of 100, while the candidate completes 61. In 100 attack trials, the baseline requests an unrelated export six times and the candidate zero times. These are illustrative local results, not product performance claims.
The security owner rejects the export behavior; the support owner rejects the 31-case service regression. Engineering restricts export permissions, revises the rule to distinguish reporting a directive from obeying it, and runs the versioned suite again. The team releases only after both owners accept the separate measures. The release record preserves all revisions and the rollback target so a later production incident can be reproduced and added to the suite rather than repaired through an untracked live edit.
The candidate is released only after both owners accept their separate measures; a rejection sends it back through the versioned suite.
Common exam traps
- Fixing one attack and replaying only that attack.
- Reporting a refusal as a successful legitimate-task response.
- Grading only final text when a forbidden tool was requested earlier.
- Changing the model or grader while attributing all improvement to wording.
- Treating zero observed violations as deterministic prevention.
What to remember
Version the assembled behavior, define success before tuning, and compare the candidate with the accepted release on ordinary, conflicting, and injected inputs. Inspect actions as well as language, measure unnecessary refusals separately, and preserve the release record needed for rollback and incident reproduction.
Knowledge check
A candidate guardrail for a security-operations assistant is compared with the current release. In 100 injected-ticket trials, the release requests an unrelated export 5 times and the candidate never does. On 100 legitimate tickets that quote malicious commands for analysis, the release completes 90 and the candidate 58. The security owner requires zero exports in the attack trials, and the support owner requires completion within two tickets of the release. What is the release decision?
A regression suite must reject any request for the forbidden export_customers tool. Its grader checks only each final answer for confidential data. On one case it passes the run, but the transcript shows the assistant requested the export_customers tool mid-run; the call failed for an unrelated reason and the final answer was harmless. What should the suite change?
Between a baseline run and a candidate run, the team edited the system prompt, moved the model from Sonnet 5.5 to Opus 5.5, and updated the LLM grader’s rubric. Scores rose 9 points, and the prompt author credits the new wording. What makes that claim testable?
A team runs Claude Managed Agents. Its regression suite passed on agent version 7, and production creates each session by passing the agent ID as a plain string. Editors keep updating the agent during the week. How should production sessions run exactly the tested configuration?
"version": 7 on every agent update request{"type": "agent", "id": AGENT_ID, "version": 7}version on an update is optimistic concurrency against conflicting edits, and logging the newest version records the drift instead of preventing it.References
- Anthropic, Define success criteria and build evaluations
- Anthropic, Mitigate jailbreaks and prompt injections
- Anthropic, Prompting best practices
- Anthropic, Define your agent
- Anthropic, Start a session