AI checks
Write a rule in plain words on the agent, opt a screen into it by id, and let Baseera check the record against your knowledge, with sources, caching and a cost cap.
Some rules are code: the total equals the sum of the lines. Others are policy: late fees may not exceed 5%, payment terms must match the customer's contract. An AI check is the second kind. You write it in the dashboard, the agent evaluates the record against it using its knowledge, and the result shows on the field like any other flag.
Define a check
Open the agent, then Immersive mode, then AI checks and Add check.
Prop
Type
An example instruction:
Check the line items against the late fee policy in the knowledge base.
If any line charges a late fee above the policy limit, fail the check and say which line.An agent can have up to 25 AI checks. The editor shows each problem next to its field: a duplicate id, a missing instruction, or "A check that can block the finish must have the blocking severity."
Saving writes to the agent's draft: "Saved to the draft. It goes live when you publish it on Deploy." AI checks are part of the agent's configuration, so every change is a new version, and the runtime reads the latest published one. Members who may not change agents can view the list but not edit it.
Opt in from the screen
A screen runs only the AI checks it names. List their ids in aiChecks:
useBaseeraImmersive({
entity: { type: "invoice", ref: invoice.id },
fields: [/* ... */],
checks: [/* your own checks */],
aiChecks: ["policy-conflict"],
finish: { label: "Send invoice", action: ({ receipt }) => sendInvoice(invoice.id, receipt) },
});Other ids defined on the agent are ignored for this screen. An id you list that the agent does not define simply returns no result. Checks that need your app's code stay in your app. AI checks live on the agent.
The agent needs a provider key and a model to run them. Without them the request fails with agent_not_configured or provider_key_missing, and the record keeps working with your own checks only. See Provider keys.
When they run
- When the record opens.
- After a pause of 1.5 seconds with no field change. A burst of typing makes one run.
- One request at a time. If values changed while a run was in flight, the next run starts after it.
- After a server signal marks the record's cached results stale, the next time the record is opened.
One model call evaluates every check that is due. When the agent has knowledge attached, the model may search it up to 3 times per run. The record's fields and the passages it finds are given to the model as untrusted data.
AI checks are advisory in the browser: if a run fails, what is on screen stays as it is and the next change tries again. They never raise an error to the person.
What the person sees
A failing AI check appears in the review panel with an AI badge, in the field it names, with the message (1 to 300 characters) and the knowledge passages it relied on, as a title and section. A source has no link: a check has no message to open it from.
- It shows as a warning, or as blocking when the check can block the finish.
- It cannot be acknowledged. It clears when the record stops breaking the rule.
- A check that passes shows nothing.
A result from the model that breaks the rules is dropped and recorded in the trace as ai_check_invalid: an unknown or repeated id, an empty or long message, a field that is not declared, or a source the run never found. The check then has no result. That is not the same as failing, and Baseera does not guess one.
Caching
A result is cached per session, record, check, agent version and a hash of the record's field values. The same values return the cached result without a model call. Change a value, publish a new version of the agent, or send a server signal, and the check runs again.
Cost and run caps
Each run is a model call on the agent's own provider key. To keep it predictable:
| Cap | Value |
|---|---|
| Runs per record per session | 20 |
| Minimum time between two runs | 5 seconds |
| Search steps per run | 3 |
Past the cap the answer carries the latest cached results and "capped": true. Inside the interval it carries them and retryAfterMs, and the SDK waits and asks again. Token use of each run is recorded as ai_check usage, so it shows in the agent's usage. See Spending limits.
Blocking the finish
An AI check never holds the Finish button unless its definition has Can block finish on, which needs the blocking severity. Then:
- While its latest result fails, the check counts in
openBlocking, and the person needs an override with a reason that covers its id. - The runtime enforces this itself. When the latest stored result for the record fails, recording the finish needs an override that covers the id, whatever the browser reported.
blocksFinishon the result tells the SDK, and your own UI, that this check is one of those.
A warning-level AI check never holds a finish, even when you set blockOnWarnings. Only your own checks count toward that setting.
See Finish and overrides for the override flow.
In the trail
A result that changes from passing to failing, or back, is written to the record's trail by the runtime as check_raised or check_resolved with the source ai. The browser cannot send that source. See Trail and webhook.
Next steps
Fields and checks
Declare a record's fields and your own checks: field kinds, labels in Arabic and English, severities, when checks run, acknowledging, and what is sent to the model.
Drafts and fixes
How a value gets into a field: a fix on a check, applyCheckFix, the model's ui.prefillDraft tool, the draft shown in the field, approval and rejection.