Learn how to create, configure, and run AI Blocks in Mage to generate text, produce structured outputs, write and validate code, and trigger other pipelines—empowering you to build advanced RAG and automation workflows with ease.
ai
.output.code
)output.format
)|
.output.format
and variables
fields use JSON Schema draft-07 (subset) to define:
type
— string, number, integer, boolean, array, objectdescription
— field descriptionenum
— allowed valuesitems
— item schema for arraysminItems
, maxItems
— constraints for arrayspattern
— regex validation for stringsrequired
— list of required keysoneOf
, anyOf
, allOf
— branching validation$ref
, $defs
— recursive or modular schemasoutput.code
only when expecting executable code.output.format
for predictable structured outputs.code
and format
in the same block.|
for readability.validation
prompt for critical outputs.variables
clearly for tool execution.