Skip to main content
Forms and intake documents often combine identity fields with repeated sections such as employment, education, skills, and references. A nested Pydantic schema captures this structure in one run. Place the resume to extract at resume.pdf in the directory where you run this code.
Adapt the outer model and instructions for job applications and KYC intake. Reuse the File input and Agent configuration.

KYC intake

Identity verification forms add typed fields the downstream system has to accept verbatim (passport numbers, dates of birth, addresses). The schema should be conservative about types: keep IDs as strings to preserve leading zeros and country-specific formats.
For KYC, every field is review-worthy. Combine this schema with the confidence pattern so the downstream queue knows what to send to a compliance reviewer.

Multi-page applications

Job applications arrive as one combined PDF or as a set of loose attachments. files takes a sequence, so the whole bundle goes into a single run against one schema.
Run once per attachment when you want an isolated schema per document, then compose in plain Python. Every run needs its own schema, because output_schema takes a Pydantic model: Resume for the resume, and a wrapper for the reference list. A bare List[str] is not a schema.

Schema-shape comparison

Reuse the Agent setup across these workloads and change output_schema for the document structure.

Next steps

Developer Resources