Skip to content

io_schema

The io_schema section defines the input/output contract for your agent. It controls:

  • What the /invoke endpoint accepts (request body shape)
  • What the /invoke endpoint returns (response body shape)
  • Whether output is strictly validated against the schema
  • How Swagger UI renders the request/response models
FieldTypeDefaultDescription
strictbooltrueWhen true, the agent’s output is validated against the output schema. On validation failure, the raw output is returned instead (no error).
inputIOSubSchemanullJSON Schema for the request body
outputIOSubSchemanullJSON Schema for the response body

If output is null, strict validation is automatically disabled regardless of the strict field.

IOSubSchema (used by both input and output)

Section titled “IOSubSchema (used by both input and output)”
FieldTypeDefaultDescription
typestring"object"Root type. One of: object, string, number, integer, boolean, array, null
propertiesdict{}Property definitions. Each value must be a dict with at least a type field.
requiredlist[str][]List of required property names. Must be a subset of properties keys (when type is object).
itemsdictnullSchema for array items. Required when type is array.
descriptionstringnullHuman-readable description of this schema

Types are validated both at the root level and within properties[].type:

TypePython mapping (for Swagger)
stringstr
numberfloat
integerint
booleanbool
arraylist
objectdict
nullAny

Unknown types result in Any in the generated Pydantic model.

  1. Property names must be non-empty strings after stripping whitespace
  2. Nested type values within properties must be one of the supported types
  3. Array properties must include an items key defining the element schema
  4. Required fields — no duplicate entries allowed; each entry must exist in properties (when type is object and both lists are non-empty)
  5. Array root type — if root type is "array", the items field is required

When the runtime starts, it uses create_pydantic_model_from_schema() to convert your io_schema into dynamic Pydantic models:

io_schema.input → {AgentName}Input → POST /invoke request body
io_schema.output → {AgentName}Output → output field in response

These models appear in the Swagger UI at /docs, giving callers exact type information for your agent’s API.

The invoke response wraps the output:

{
"success": true,
"output": { ... }, // matches your io_schema.output
"metadata": { ... }
}

See 4.2 How io_schema Shapes Swagger for full details on the type mapping.

io_schema:
strict: true
input:
type: object
properties:
query:
type: string
description: "The user's question"
required: [query]
output:
type: object
properties:
answer:
type: string
confidence:
type: number
io_schema:
input:
type: object
properties:
topic:
type: string
output:
type: object
properties:
suggestions:
type: array
items:
type: string
io_schema:
input:
type: object
output:
type: object

When no properties are defined, the generated Pydantic model accepts any JSON object. This is useful during early development but means Swagger won’t show specific fields.

Source: IOSchema, IOSubSchema in packages/schema/dockrion_schema/dockfile_v1.py; create_pydantic_model_from_schema() in packages/runtime/dockrion_runtime/schema_utils.py


Previous: 2.1 agent | Next: 2.3 auth →