Interface StructuredReplySpec

interface StructuredReplySpec {
    schema?: ZodType<unknown, unknown, $ZodTypeInternals<unknown, unknown>> | JsonSchemaObject;
    schemaRef?: string;
    name?: string;
    description?: string;
    maxRetries?: number;
    onExhausted?: "error" | "return_invalid";
    streamDeltas?: boolean;
}

Properties

schema?: ZodType<unknown, unknown, $ZodTypeInternals<unknown, unknown>> | JsonSchemaObject

A Zod schema, or a JSON Schema object. One of schema and schemaRef is required.

schemaRef?: string

The key of a schema in AgentOSConfig.structuredSchemas, resolved before the turn.

name?: string

Named in the instruction and in the output's meta. Default "reply".

description?: string
maxRetries?: number

Repair rounds after a reply that does not match. Default 2, clamped to 0..5.

onExhausted?: "error" | "return_invalid"

When every attempt failed: end the turn with GMI_STRUCTURED_OUTPUT_INVALID, or return the last reply with meta.valid: false. Default error.

streamDeltas?: boolean

Stream the model's text deltas on a structured turn. Default false: the caller sees nothing before the check.