io_schema
The io_schema section defines the input/output contract for your agent. It controls:
- What the
/invokeendpoint accepts (request body shape) - What the
/invokeendpoint returns (response body shape) - Whether output is strictly validated against the schema
- How Swagger UI renders the request/response models
Fields
Section titled “Fields”IOSchema (root io_schema key)
Section titled “IOSchema (root io_schema key)”| Field | Type | Default | Description |
|---|---|---|---|
strict | bool | true | When true, the agent’s output is validated against the output schema. On validation failure, the raw output is returned instead (no error). |
input | IOSubSchema | null | JSON Schema for the request body |
output | IOSubSchema | null | JSON 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)”| Field | Type | Default | Description |
|---|---|---|---|
type | string | "object" | Root type. One of: object, string, number, integer, boolean, array, null |
properties | dict | {} | Property definitions. Each value must be a dict with at least a type field. |
required | list[str] | [] | List of required property names. Must be a subset of properties keys (when type is object). |
items | dict | null | Schema for array items. Required when type is array. |
description | string | null | Human-readable description of this schema |
Supported Types
Section titled “Supported Types”Types are validated both at the root level and within properties[].type:
| Type | Python mapping (for Swagger) |
|---|---|
string | str |
number | float |
integer | int |
boolean | bool |
array | list |
object | dict |
null | Any |
Unknown types result in Any in the generated Pydantic model.
Validation Rules
Section titled “Validation Rules”- Property names must be non-empty strings after stripping whitespace
- Nested
typevalues within properties must be one of the supported types - Array properties must include an
itemskey defining the element schema - Required fields — no duplicate entries allowed; each entry must exist in
properties(whentypeisobjectand both lists are non-empty) - Array root type — if root
typeis"array", theitemsfield is required
How io_schema Drives the API
Section titled “How io_schema Drives the API”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 bodyio_schema.output → {AgentName}Output → output field in responseThese 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.
Examples
Section titled “Examples”Simple text in/out
Section titled “Simple text in/out”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: numberArray output
Section titled “Array output”io_schema: input: type: object properties: topic: type: string output: type: object properties: suggestions: type: array items: type: stringNo schema (permissive)
Section titled “No schema (permissive)”io_schema: input: type: object output: type: objectWhen 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,IOSubSchemainpackages/schema/dockrion_schema/dockfile_v1.py;create_pydantic_model_from_schema()inpackages/runtime/dockrion_runtime/schema_utils.py
Previous: 2.1 agent | Next: 2.3 auth →