Skip to content

Form Schema Reference

The form schema is the canonical definition of an AgentsForms form. It is written as a JSON document, validated server-side, and versioned on publish.

A form definition is a JSON object with these top-level properties:

PropertyTypeRequiredDescription
namestringyesHuman-readable form name.
slugstringyesURL-safe identifier matching ^[a-z0-9][a-z0-9-]{0,62}[a-z0-9]$.
descriptionstringnoShort description of the form’s purpose.
fieldsField[]yesArray of field definitions. Minimum 1, maximum 100.
settingsSettingsnoForm-level settings (submit label, success message, retention).

Every field in the fields array shares these base properties:

PropertyTypeRequiredConstraintsDescription
idstringyesRegex ^[a-zA-Z][a-zA-Z0-9_.-]{0,63}$, unique within the formStable developer-defined field identifier. Used in webhook payloads and submissions.
labelstringyesMinimum 1 characterHuman-readable label rendered above the input.
typestringyesOne of 13 field types (see below)Controls the input widget presented to the user.
requiredbooleannoDefault falseIf true, the user must provide a value before submitting.
descriptionstringnoHelper text shown below the field.
agentHintstringnoNatural-language hint for AI agents about what value to provide. Not shown to the end user.
optionsOption[]conditionalRequired for select, multi_select, radio; minimum 1 optionArray of { "label": string, "value": string } pairs. Both must be non-empty.
defaultValueunknownnoType must match the field typePrefill value shown when the form first loads.
hiddenbooleannoDefault falseIf true, the field is not shown to the human user (agent-only). The value is still collected and included in submissions.

All 13 supported field types, with example JSON snippets:

Single-line text input.

{ "id": "name", "label": "Full name", "type": "text", "required": true }

Multi-line text area for longer input.

{ "id": "message", "label": "Description", "type": "textarea", "required": true }

Email input with client-side validation.

{ "id": "email", "label": "Email address", "type": "email", "required": true }

URL input with client-side validation.

{ "id": "website", "label": "Website", "type": "url" }

Numeric input with optional min/max (define via description or agent-specific context).

{ "id": "age", "label": "Age", "type": "number" }

Toggle / checkbox for true/false values.

{ "id": "agreed", "label": "I agree to the terms", "type": "boolean", "required": true }

Date picker (ISO 8601 date string).

{ "id": "due_date", "label": "Due date", "type": "date" }

Single-select dropdown.

{
"id": "priority",
"label": "Priority",
"type": "select",
"required": true,
"options": [
{ "label": "Low", "value": "low" },
{ "label": "Medium", "value": "medium" },
{ "label": "High", "value": "high" }
]
}

Multi-select allowing multiple choices.

{
"id": "categories",
"label": "Categories",
"type": "multi_select",
"options": [
{ "label": "Bug", "value": "bug" },
{ "label": "Feature", "value": "feature" },
{ "label": "Question", "value": "question" }
]
}

Single checkbox (boolean with a label — distinct from boolean which renders as a toggle).

{ "id": "subscribe", "label": "Subscribe to updates", "type": "checkbox" }

Radio button group.

{
"id": "plan",
"label": "Plan",
"type": "radio",
"required": true,
"options": [
{ "label": "Starter", "value": "starter" },
{ "label": "Pro", "value": "pro" }
]
}

Field not displayed to the user. Value provided by the agent or system.

{ "id": "session_id", "type": "hidden", "defaultValue": "sess_xxx" }

File upload field.

{ "id": "attachment", "label": "Screenshot", "type": "file" }

The settings object configures form-level behavior:

PropertyTypeDefaultDescription
allowPartialbooleanfalseAllow the user to submit partial (incomplete) responses.
submitLabelstring"Submit"Custom label for the submit button.
successMessagestringMessage shown after successful submission.
retentionDaysnumberNumber of days to retain submissions. Integer, positive, max 3650 (10 years).

A complete form definition with every property used:

{
"name": "Support Intake",
"slug": "support-intake",
"description": "Collect missing info from users for support agents.",
"fields": [
{
"id": "email",
"label": "Email",
"type": "email",
"required": true,
"description": "We'll use this to follow up.",
"agentHint": "User's verified email address"
},
{
"id": "priority",
"label": "Priority",
"type": "select",
"required": true,
"options": [
{ "label": "Low", "value": "low" },
{ "label": "Medium", "value": "medium" },
{ "label": "High", "value": "high" }
],
"defaultValue": "medium"
},
{
"id": "message",
"label": "What do you need help with?",
"type": "textarea",
"required": true,
"description": "Include steps to reproduce if reporting a bug."
},
{
"id": "session_id",
"type": "hidden",
"defaultValue": "sess_placeholder"
}
],
"settings": {
"submitLabel": "Send to agent",
"successMessage": "Thanks — an agent will continue with this.",
"retentionDays": 90
}
}

Forms are validated server-side using Zod schemas (source: packages/schemas/src/index.ts). Violations produce a 422 response with detailed error paths.

RuleError codeDescription
Field id must start with a letter and contain only [a-zA-Z0-9_.-], max 64 charsinvalid_stringThe id is used as a stable key in API responses and webhook payloads.
Field id must be unique within the formduplicate_field_idTwo fields cannot share the same id.
slug must match ^[a-z0-9][a-z0-9-]{0,62}[a-z0-9]$invalid_stringLowercase alphanumeric, optional hyphens, must not start or end with a hyphen.
select, multi_select, and radio fields require at least one optionselect_options_requiredThese field types are meaningless without choices.
Maximum 100 fields per formtoo_bigForms are not designed for unbounded field counts.
options array entries must have non-empty label and valueinvalid_stringEach { label, value } pair must be complete.