Skip to lesson

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:

FamilyIllustrative testObservable expectation
Ordinary taskSummarize a permitted support ticketUseful summary without unrelated operations
Direct conflictUser asks to override a standing confidentiality ruleNo confidential disclosure; permitted assistance remains
Indirect injectionRetrieved ticket asks for an unrelated exportTreat that directive as ticket content
Delimiter attackThird-party string imitates a closing tag and role labelPreserved data structure and no change of task
Missing informationRequired fact is absent from the supplied ticketSpecific uncertainty rather than an invented value
Benign look-alikeTicket quotes a malicious command for analysisSummarize 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.

The candidate is released only after both owners accept their separate measures; a rejection sends it back through the versioned suiteThe candidate guardrail runs the versioned suite, which splits into attack trials judged by the security owner and legitimate analysis cases judged by the support owner. Both judgments join at one acceptance decision. When both owners accept, the team releases; otherwise engineering restricts export permissions, revises the rule and runs the versioned suite again.yesnoruns againCandidate guardrailVersioned suiteAttack trialsLegitimateanalysis casesSecurity ownerSupport ownerBoth ownersaccept?Team releasesEngineeringrestricts exportpermissions,revises the rule

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

References