Skip to content

Structured output modes

When you run a typed Call, KAOS has to coax the model into producing data that matches your Signature’s output fields. There are three mechanisms, picked by the model’s capabilities (its ModelProfile):

  • Native structured output — the provider supports a schema/JSON mode directly. KAOS hands it the schema and gets back conforming JSON. The most reliable.
  • Tool-based — the model is given a single “tool” whose arguments are the schema, and is asked to call it. Used when native mode isn’t available but tool-calling is.
  • Prompted — the schema is described in the prompt and the response is parsed. The universal fallback; the least strict, so KAOS validates and retries on a mismatch.

Providers differ. Hard-coding one mode would either exclude models or sacrifice reliability. By selecting from a model’s ModelProfile — capability metadata, not a if provider == ... branch — the same Call works across providers and degrades gracefully.

Whatever the mode, the output is validated against the Signature. A wrong shape is caught and retried (a bounded number of times), and an unrecoverable failure becomes a typed error — never silently-wrong data flowing downstream. This is the same fail-closed stance KAOS takes with grounding.