Skip to content

accepts

accepts

Declare the input contract for a machine. The accepts section defines what data a machine expects to receive when invoked. Each field has a name, type, and optional modifiers (required, default value, validation constraints). The runtime validates incoming data against this contract before execution begins.

Replaces the legacy provides > inputs syntax. The parser accepts both forms; run mashin fmt to auto-migrate.

When to use

Every machine that takes input should have an accepts section. Omit it only for machines that are triggered purely by events (via subscribes) or schedules with no parameters.

Syntax

accepts
<field_name> as <type>, <modifiers>
...

Field declaration

Each field follows the pattern:

<name> as <type>, <modifier1>, <modifier2>, ...

Types

TypeDescriptionExample
text / stringText valuename as text
numberNumeric value (integer or decimal)count as number
integerInteger onlyage as integer
decimalDecimal/floatscore as decimal
booleanTrue or falseactive as boolean
listArray of valuesitems as list
list of <type>Typed listtags as list of text
mapKey-value objectmetadata as map
anyAny type (untyped)data as any

Modifiers

ModifierDescriptionExample
is requiredField must be providedname as text, is required
default: <value>Default value if not providedlimit as number, default: 10
description "<text>"Human-readable description (shown in UI)email as text, description "User email address"
label "<text>"Display label for the visual builderemail_id as text, label "Email"

Validation constraints

ConstraintApplies toDescriptionExample
min: <n>number, integerMinimum valueage as integer, min: 0
max: <n>number, integerMaximum valueage as integer, max: 150
min_length: <n>textMinimum string lengthname as text, min_length: 2
max_length: <n>textMaximum string lengthname as text, max_length: 100
format: "<fmt>"textFormat validationemail as text, format: "email"
pattern: "<regex>"textRegex pattern matchcode as text, pattern: "^[A-Z]+$"
choices: [...]textAllowed values (whitelist)role as text, choices: ["admin", "user"]
exclude: [...]textDisallowed values (blacklist)status as text, exclude: ["deleted"]
subset: [...]listList items must be from this setteams as list, subset: ["eng", "design"]
range: [lo, hi]numberValue must be within rangescore as number, range: [0.0, 1.0]

Accessing input values

Inside steps, input fields are accessed via input.<field_name>:

compute greet
{greeting: "Hello, " + input.name + "!"}

Examples

Simple inputs

accepts
name as text, is required
age as integer
active as boolean, default: true

With validation constraints

accepts
email as text, is required, format: "email"
username as text, is required, min_length: 3, max_length: 20, pattern: "^[a-zA-Z0-9_]+$"
age as integer, is required, min: 13, max: 150
role as text, default: "member", choices: ["member", "admin", "moderator"]
score as number, range: [0.0, 1.0]

With UI hints

accepts
email_id as text, is required, description "Gmail message ID to process", label "Email"
intent as text, is required, description "What the user wants to do with this email"
max_length as integer, default: 500, description "Maximum response length in characters"

Full machine with accepts

machine email_triage
accepts
subject as text, is required
body as text, is required
sender as text
is_vip as boolean, default: false
responds with
priority as text
action as text
implements
ask classify, using: "anthropic:claude-haiku-4"
with task "Triage this email. Subject: ${input.subject}\nBody: ${input.body}\nVIP: ${input.is_vip}"
returns
priority as text
action as text
assuming
priority: "medium"
action: "review"

Governance

Input validation happens before the governance interpreter runs. If a required field is missing or a constraint is violated, the machine rejects the input with a validation error. No steps execute, no governance decisions are made, and no behavioral ledger entries are created for the failed invocation.

This means accepts serves as the first line of defense: type-safe, schema-validated input that reaches the steps is guaranteed to match the declared contract.

Translations

LanguageKeyword
Englishaccepts
Spanishacepta
Frenchaccepte
Germanakzeptiert
Japanese受け取る
Chinese接受
Korean받는다

See also

  • responds with - Output contract declaration
  • implements - Where steps use input values
  • verifies - Test cases that provide sample inputs via given
  • achieves - Goal examples that define input/output pairs