requires mashin
requires mashin
Declare the minimum Mashin language version required to compile and run this machine. If the runtime’s language version is lower than the declared requirement, compilation fails with a clear error rather than producing confusing parse or runtime failures from unsupported syntax.
This is a pre-machine directive: it appears before the machine keyword, at the top of the file (alongside written in if present).
When to use
Use requires mashin when your machine uses syntax or features introduced in a specific language version. This is especially important for:
- Machines published to the registry (krates) that will be consumed by users on different runtime versions
- Machines using recently added syntax (e.g.,
definesadded in 0.28.0,has agencyadded in 0.25.0) - Shared libraries or templates that need to communicate their minimum requirements
For machines used only within your own project, requires mashin is optional since you control the runtime version. For published krates, it is recommended.
Syntax
requires mashin ">=0.28.0"The version string follows semver conventions. Supported operators:
| Operator | Example | Meaning |
|---|---|---|
>= | ">=0.28.0" | This version or newer |
> | ">0.27.0" | Strictly newer than this version |
~> | "~>0.28" | Compatible with 0.28.x (any patch version) |
| (bare) | "0.28.0" | Exactly this version |
Examples
Basic version requirement
requires mashin ">=0.28.0"
machine data_transformer defines normalize(text) => text.trim().toLowerCase()
accepts input as text, is required
implements compute result {normalized: normalize(input.input)}With locale directive
When both written in and requires mashin are present, either can come first. Both are pre-machine directives:
written in frenchrequires mashin ">=0.27.0"
machine classificateur accepte message en tant que texte, est requis
implemente calcule resultat {traite: vrai}Published krate with version requirement
requires mashin ">=0.25.0"
machine my_agent "My Agent"
has agency
achieves goal "Assist users with their tasks"
accepts request as text, is required
responds with response as text
implements ask handle, using: "anthropic:claude-sonnet-4-6" with task "Handle this request: ${input.request}" returns response as textImplementation status
The requires mashin directive is parsed and compiled, but the runtime does not currently enforce version compatibility at execution time. Version checking happens at parse time: if the parser encounters requires mashin with a version higher than the current parser’s language version, it emits a compilation error.
Governance
requires mashin has no governance implications. It is a compile-time constraint, not a runtime behavior. No ledger events are produced.
Translations
| Language | Keyword |
|---|---|
| English | requires mashin |
| Spanish | requiere mashin |
| French | requiert mashin |
| German | erfordert mashin |
| Japanese | mashin必須 |
| Chinese | 需要mashin |
| Korean | 마신 필요 |
See also
- uses - Dependency declarations (machine-level, vs. this language-level)
- written in - Locale directive (also a pre-machine directive)