Prompt Engineering & Structured Output20% of the exam

Validation-retry loops for extraction quality

How to catch the semantic errors strict schemas let through, feed specific validation errors back to Claude, recognise when a retry cannot help because the data is absent, and design schema fields and finding metadata that surface discrepancies and false-positive patterns.

Official exam objective
Implement validation, retry, and feedback loops for extraction quality

~8 min read · 10 practice questions ·

What the exam expects

  • Tell a schema syntax error (which strict tool use eliminates) from a semantic error (values that do not sum, a value in the wrong field) and put business-rule validation in application code.
  • Build a retry-with-error-feedback step: a follow-up that carries the original document, the failed extraction and the specific validation errors, or a tool_result with is_error: true that names the fields and rules.
  • Predict when a retry will work (format mismatches, structural errors) and when it cannot (the information is absent or sits in a document that was never sent), and route the second case instead of retrying.
  • Design self-correction fields such as calculated_total beside stated_total and a conflict_detected boolean.
  • Add a detected_pattern field to structured findings so dismissals can be analysed by pattern.

Key terms: syntax error (output that does not parse or match the schema); semantic error (schema-valid output whose values are wrong); retry with error feedback (re-asking with the specific errors attached); self-correction field (a schema field that lets a discrepancy be recorded instead of hidden); dismissal analysis (grouping rejected findings to find false-positive patterns).

Key facts

Strict tool use eliminates syntax errors
Detail
Semantic errors (values don't sum, wrong field) still need validation
No retries for schema violations
Detail
Structured outputs are "always valid" and type safe
minimum, maximum, multipleOf unsupported
Detail
Unsupported schema features return a 400 error
SDK helpers move constraints into code
Detail
Strip from the wire schema, note in description, validate the response
Enum capitalization is not guaranteed
Detail
Compare enum values case-insensitively
Error feedback in a tool loop
Detail
tool_result with tool_use_id and is_error: true; instructive, not "failed"
Claude retries invalid calls 2-3 times
Detail
Then apologizes to the user
Self-correction follow-up contents
Detail
Original document, failed extraction, specific validation errors
Self-correction chain
Detail
Draft, review against criteria, refine; each a separate API call
Agent SDK structured result is valid only when
Detail
subtype is success and structured_output is present
Agent SDK retry failure subtype
Detail
error_max_structured_output_retries
Sources for this section (5)
  • Why can a pipeline drop its JSON-repair retries after moving to strict tool use but not its business-rule validator?
  • When will a retry with error feedback fail no matter how specific the feedback is?
  • What should a tool_result that reports a failed validation contain?
  • Why add a detected_pattern field to review findings?

The questions are free to read. Answers with their sources and self-grading are included with the pack.

Keep reading with the Claude Certified Architect - Foundations pack

  • Core concepts
  • Exam traps
  • Worked scenario

The pack includes:

  • All 30 lessons of the Claude Certified Architect - Foundations guide, with reading progress
  • Interactive decision walks and step-by-step sequence steppers
  • Inline practice questions and one-click topic practice (10 questions for this lesson)
  • An official source cited for every claim
  • An AI tutor that answers from the guide
  • Unlimited timed practice exams

Practice for the Claude Certified Architect - Foundations exam

Certifyforce is an independent study resource and is not affiliated with, endorsed by or sponsored by Anthropic. Claude is a trademark of Anthropic.