Kairox Arch Prep
EXAM SCENARIO

Structured data extraction

What the structured data extraction scenario tests on the CCA-F exam: schemas, forced tool use, nullable fields, enums and validation-retry.

The structured data extraction scenario turns documents — invoices, contracts, forms, emails — into records that downstream systems can trust. It concentrates on the prompt engineering and structured output domain, with reliability questions about scale and cost from context management.

The system you should picture

Documents arrive in a queue. For each, the application sends the document and instructions to Claude with a tool whose input schema is the target record, forces Claude to call that tool, validates the result in code, and stores it. Records that fail validation are retried with feedback or sent for human review. Archives of historic documents are processed in bulk.

Decisions the exam probes

Getting the shape right. Asking for "valid JSON" in prose fails occasionally. A required tool whose input schema is the record — or the structured-output feature — makes the shape explicit. With several tools available, naming the specific tool in tool_choice is what forces it.

Designing honest schemas. A field that is required but often absent from the source pushes the model to invent values. Making it nullable, with an instruction to return null when the document does not state it, keeps extraction faithful. Fixed vocabularies such as categories become enums with short definitions.

Separating inputs. Long documents, instructions and examples are wrapped in clearly named tags so example text is never mistaken for the document.

Validation and retry. Every record is validated in code. A failed record is retried with the specific error rather than resent unchanged, retries are capped, and persistent failures are queued for review. Truncated output is detected through the stop reason.

Scale and cost. Large archives with relaxed deadlines go through the Message Batches API at a lower price. A large reference document reused across many requests is a good candidate for prompt caching.

Common traps

How to practise

Pick ten real documents of one type and build an extractor with a forced tool, a nullable field and an enum. Write a validator, then feed it documents that are missing fields or use odd category spellings. Track how many records pass first time, after one retry and never — the numbers will tell you which part of your design needs work.

The six scenarios are listed in Anthropic's official exam guide (version 1.1), with four drawn per sitting. The emphasis described here is our own study guidance, not official exam content.

Practice questions set in this scenario

Original questions, not real exam items. All 10 questions in this scenario also appear in the practice exam.

Practice question 1

Domain 3: Prompt Engineering & Structured Output

An extraction pipeline must always return JSON matching a fixed schema so downstream code can parse it. Which approach gives the most reliable structure?

  1. A. Ask for a markdown table and convert it to JSON with a regular-expression parser
  2. B. Ask for valid JSON in the prompt, include the schema, and parse whatever comes back
  3. C. Use structured outputs with a JSON schema, check the stop reason, then validate business rules
  4. D. Set a very high max_tokens so the JSON object is never cut off before it closes
Show answer and explanation

Answer: C. Structured outputs (a JSON schema supplied in output_config.format) constrain the response to the schema; you still check the stop reason for truncation and validate rules the schema cannot express. Strict tool use (strict: true) is the equivalent for tool inputs. Prompt-only JSON requests fail occasionally; regex over tables is brittle; a large max_tokens prevents truncation but not schema errors.

Practice question 2

Domain 3: Prompt Engineering & Structured Output

On a model that supports forced tool use, a request offers several tools, and you want Claude to call record_invoice specifically rather than answering in prose. Which tool_choice setting selects it?

  1. A. {"type": "any"}, which requires Claude to call one of the tools in the request
  2. B. {"type": "auto"}, with a system prompt that tells Claude to always use record_invoice
  3. C. {"type": "none"}, with record_invoice described in the system prompt instead
  4. D. {"type": "tool", "name": "record_invoice"}, which forces that specific tool
Show answer and explanation

Answer: D. Naming the tool forces that specific tool. "auto" lets Claude decide whether to call a tool at all; "any" forces some tool call but lets Claude pick which, so it is not enough when several tools are offered; "none" prevents tool use. Forced tool choice is model-dependent: several current models, and manual extended thinking, reject "any" and "tool" — there the documented alternatives are "auto" with strict tool use, or structured outputs.

Other scenarios