Skip to main content
Pass a schema and the SDK shapes the task’s research output, then validates the returned rows into typed objects. Use a wrapper model with a single list field: each item is one output row.
TypeScript requires Zod v4 (npm install zod@4).

How it maps

The SDK converts your schema into the task’s output.schema (a flat, canonical research schema) on the way in. On the way out it flattens each “cell” row (fields come back as {value, source_id}) to plain values and validates them against your schema. Rows that fail validation are dropped, so result.output only contains well-formed objects. The raw rows (with sources and provenance) remain available on result.rows. A schema with no wrapper is treated as the row itself, so result.output is then a list of that model.

Under the hood

This is the same output.schema you can pass directly via a task spec. The SDK schema is a convenience over it. Supported field types resolve to str, int, float, bool, and list[...].