# Validation-retry loops for extraction quality

*Claude Certified Architect - Foundations Study Guide · Prompt Engineering & Structured Output · Last updated October 22, 2026 · https://www.certifyforce.com/study-guide/claude-certified-architect-foundations/prompt-engineering-and-structured-output/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.

- Certification: Claude Certified Architect - Foundations
- Exam section: Prompt Engineering & Structured Output
- Study guide: https://www.certifyforce.com/study-guide/claude-certified-architect-foundations

**Official exam objective:**

> Implement validation, retry, and feedback loops for extraction quality

## 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

| Fact | Detail | Source |
|---|---|---|
| Strict tool use eliminates syntax errors | Semantic errors (values don't sum, wrong field) still need validation | [Exam guide](https://everpath-course-content.s3-accelerate.amazonaws.com/instructor%2F6nizmqk8tpzpfjvt6qmmav7rh%2Fpublic%2F1783542750%2FClaude+Certified+Architect+%E2%80%93+Foundations+Exam+Guide.pdf) |
| No retries for schema violations | Structured outputs are "always valid" and type safe | [Structured outputs](https://platform.claude.com/docs/en/build-with-claude/structured-outputs) |
| `minimum`, `maximum`, `multipleOf` unsupported | Unsupported schema features return a 400 error | [Structured outputs](https://platform.claude.com/docs/en/build-with-claude/structured-outputs) |
| SDK helpers move constraints into code | Strip from the wire schema, note in description, validate the response | [Structured outputs](https://platform.claude.com/docs/en/build-with-claude/structured-outputs) |
| Enum capitalization is not guaranteed | Compare enum values case-insensitively | [Structured outputs](https://platform.claude.com/docs/en/build-with-claude/structured-outputs) |
| Error feedback in a tool loop | `tool_result` with `tool_use_id` and `is_error: true`; instructive, not "failed" | [Handle tool calls](https://platform.claude.com/docs/en/agents-and-tools/tool-use/handle-tool-calls) |
| Claude retries invalid calls 2-3 times | Then apologizes to the user | [Handle tool calls](https://platform.claude.com/docs/en/agents-and-tools/tool-use/handle-tool-calls) |
| Self-correction follow-up contents | Original document, failed extraction, specific validation errors | [Exam guide](https://everpath-course-content.s3-accelerate.amazonaws.com/instructor%2F6nizmqk8tpzpfjvt6qmmav7rh%2Fpublic%2F1783542750%2FClaude+Certified+Architect+%E2%80%93+Foundations+Exam+Guide.pdf) |
| Self-correction chain | Draft, review against criteria, refine; each a separate API call | [Prompting best practices](https://platform.claude.com/docs/en/build-with-claude/prompt-engineering/claude-prompting-best-practices) |
| Agent SDK structured result is valid only when | `subtype` is `success` and `structured_output` is present | [Get structured output from agents](https://code.claude.com/docs/en/agent-sdk/structured-outputs) |
| Agent SDK retry failure subtype | `error_max_structured_output_retries` | [Get structured output from agents](https://code.claude.com/docs/en/agent-sdk/structured-outputs) |

## Check yourself

- 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?

## Sources

- [Claude Certified Architect – Foundations Exam Guide v1.0](https://everpath-course-content.s3-accelerate.amazonaws.com/instructor%2F6nizmqk8tpzpfjvt6qmmav7rh%2Fpublic%2F1783542750%2FClaude+Certified+Architect+%E2%80%93+Foundations+Exam+Guide.pdf)
- [Structured outputs](https://platform.claude.com/docs/en/build-with-claude/structured-outputs)
- [Handle tool calls](https://platform.claude.com/docs/en/agents-and-tools/tool-use/handle-tool-calls)
- [Strict tool use](https://platform.claude.com/docs/en/agents-and-tools/tool-use/strict-tool-use)
- [Reduce hallucinations](https://platform.claude.com/docs/en/test-and-evaluate/strengthen-guardrails/reduce-hallucinations)
- [Prompting best practices](https://platform.claude.com/docs/en/build-with-claude/prompt-engineering/claude-prompting-best-practices)
- [Get structured output from agents](https://code.claude.com/docs/en/agent-sdk/structured-outputs)
- [Define success criteria and build evaluations](https://platform.claude.com/docs/en/test-and-evaluate/develop-tests)

## About the full unit

The "Core concepts", "Exam traps" and "Worked scenario" sections of this unit, its 10 linked practice questions, and unlimited timed mock exams are included with the Claude Certified Architect - Foundations pack (USD $19): https://www.certifyforce.com/practice-exams
