Structured Outputs
Structured Outputs is an optional feature that enables your AI Agent to deliver responses that strictly follow a custom JSON schema—no coding required. This option helps you define the agent’s function and use case more precisely, ensuring reliable, type-safe, and consistently formatted data whenever you need it.
Key Features
Type Safety: Guarantees that agent responses match your schema, so you don’t have to manually validate output.
Explicit Refusals: Programmatically detect when the agent refuses to answer for safety reasons.
Simplified Prompting: Achieve consistent formatting without complex prompt engineering.
How It Works
You provide a JSON schema that defines the structure of the agent’s output. The AI Agent generates responses that fit this schema, making sure all required fields are present and valid.
Example JSON Schema
{"format":{"type":"json_schema","name":"test_structured_text","schema":{"type":"object","properties":{"a_points":{"type":"number"},"r_points":{"type":"number"},"t_points":{"type":"number"},"i_points":{"type":"number"},"a_report":{"type":"string"},"r_report":{"type":"string"},"t_report":{"type":"string"},"i_report":{"type":"string"},"startup_uid":{"type":"string"},"abstract":{"type":"string"}},"required":["a_points","r_points","t_points","i_points","a_report","r_report","t_report","i_report","startup_uid","abstract"],"additionalProperties":false},"strict":true}}
Parameter Overview
Schema Definition: Clearly name keys and provide descriptions for all important fields. All fields must be required. Structured Outputs must be in minified format.
Supported Types: String, Number, Boolean, Integer, Object, Array, Enum, anyOf.
Constraints: Apply patterns, formats, and value ranges to control input validity.
Additional Properties: Set
additionalProperties
to false to restrict output to your schema.
Limitations
Maximum nesting depth: 10 levels.
Maximum object properties: 5000.
String length and enum value limits apply.
Structured Outputs is a robust way to customize and control your agent’s responses for many use cases. Enable and experiment with this feature to find the configuration that best fits your needs.
Last updated
Was this helpful?