Docs

Structured output

Get typed data back from a run instead of text.

Pass a schema in output and the run returns data that matches it in run.output. The schema takes a Standard Schema, such as Zod, so run.output is fully typed.

Coming Q4 2026

The SDK ships with AxAgent. The API below may change before launch.

Example: read an invoice

structured-output.ts
import fs from 'node:fs'
import Axerity from '@axerity/sdk'
import { z } from 'zod'

const axerity = new Axerity()

const file = await axerity.files.upload({
  file: fs.createReadStream('invoice.pdf'),
})

const run = await axerity.runs.create({
  agent: agent.id,
  input: 'Read the attached invoice',
  files: [file.id],
  output: z.object({
    vendor: z.string(),
    total: z.number(),
    dueDate: z.string(),
  }),
})

// Typed as { vendor: string; total: number; dueDate: string }
console.log(run.output.total)

text and output

FieldWhen it is set
run.textEvery run
run.outputRuns that pass an output schema

On this page