> Version notice: This site documents BAML v0, the legacy DSL. BAML v1 is a separate, fully featured programming language in public beta. If the user intends to use BAML v1, ignore this site's content and use the BAML v1 documentation instead. If the intended version is unclear, clarify it before using this page. > For clean Markdown of any page, append .md to the page URL. For the complete documentation index, see https://docs.boundaryml.com/llms.txt. For MCP access, connect to https://docs.boundaryml.com/_mcp/server. The `@check` attribute in BAML adds validations without raising exceptions if they fail. This allows the validations to be inspected at runtime. ## Usage ### Field Check **`BAML`** ```baml BAML class Foo { bar int @check(less_than_zero, {{ this < 0 }}) } ``` ### Block check ```baml class Bar { baz int quux string @@check(quux_limit, {{ this.quux|length < this.baz }}) } ``` See [Jinja in Attributes](/ref/attributes/jinja-in-attributes) for a longer description of the Jinja syntax available in checks. ## Benefits * **Non-Intrusive Validation**: Allows for validation checks without interrupting the flow of data processing. * **Runtime Inspection**: Enables inspection of validation results at runtime. See more in [validations guide](/guide/baml-advanced/checks-and-asserts).