Decide who submits
When. Before anything is filed with the tenant, the person must confirm — and perhaps answer a few questions, or be signed in as the room's owner.
Steps
- The model never submits: Core hands the confirmation to the person's screen, never to the model. There is nothing to write for that.
- Write the submit guard (
submit_guard), asked once before anything is sent: aform(what the submit needs:$submit.<field>in its calls) andconfirm: true(an explicit yes). - To keep the submit to the room's owner, add
submitted_by: [{who: owner}], and a way to sign in: a provider instation.identity.providers(Sign in with a code). The selection asks the person to sign in before the button. - A playbook may have its own
submit_guard, with the same keys; inside it, the strictersubmitted_bywins. - Check the config.
The example
who-submits.yaml
# Who submits: the model never submits; the person confirms with their own click. The submit guard
# says what is asked before anything is sent (a form, a confirmation), and `submitted_by` keeps the
# submit to the room's owner — the person signed in with a one-time code. Replace api.example.com
# by the API.
station:
id: print-shop
name: Print Shop
identity:
providers:
email:
mechanism: otp
verifies: email # the field of the submit guard's form below
type: email
via: tenant
send: sendVerificationCode
check: checkVerificationCode
global:
language: en
currency: EUR
locale: en-GB
domain:
domain_type: retail
entity_name: print
entity_name_plural: prints
voice:
tone: professional
persona: "a printer who knows every paper and format"
rules:
- "Never say an order is placed before the submit returned it."
apis:
- name: printer
openapi_url: https://api.example.com/openapi.json
base_url: https://api.example.com
operations:
- {id: listProducts, access: read}
- {id: placeOrder, access: write}
- {id: sendVerificationCode, access: write}
- {id: checkVerificationCode, access: write}
auth: {type: none}
profiles:
everyone:
when: "true"
grants: [printer.listProducts, printer.placeOrder]
skills:
- name: products
cognitive:
objective: show the prints, for the person to choose theirs
invoke: {method: listProducts}
kinds: {print: {}}
present:
fields:
name: {from: name, type: text, role: title}
price: {from: price, type: price, role: billed}
submit:
- name: order
mode: request
tool: placeOrder
args:
body.items: "$selection[kind=print]"
body.email: "$submit.email"
body.delivery_note: "$submit.delivery_note"
body.idempotency_key: "$action.key"
line: {product_id: "$line.ref", quantity: "$line.quantity"}
render: {component: cards}
submit_guard:
form: # asked once, before anything is sent
email: {type: email, required: true, label: "E-mail for the invoice", identifies: true}
delivery_note: {type: text, multiline: true, label: "Delivery note"}
confirm: true # an explicit yes from the person
submitted_by: [{who: owner}] # only the room's owner, signed in, submits
The pitfalls
owneris the onlywho: an agent, an approver or a role does not exist yet.submitted_bywith no way to sign in refuses the station: no submit could ever pass.- A write operation is called by a submit only, never by a skill's
invoke. - A submit guard's form is asked about no card:
value: "$fields.<field>"is for a select guard's form only. multilineis for atype: textfield.- Hiding a tool from the model is not authorisation: who may submit is written here.
What Core says, and the fix
Each sentence below is Core's own, as it answers today (a test keeps them true):
- "
who: agentis not available — onlyowner" — fix:submitted_by: [{who: owner}], or nosubmitted_by(any person in the room submits with their own click). - "only the room's owner may submit, and nothing here can sign anyone in — no submit could ever pass" — fix: declare a provider in
station.identity.providers. - "a write is reserved: it would change the tenant's record with no submit and no person confirming it" — fix: call the write in a
submit, and read with areadoperation. - "a submit guard's form is asked about no card" — fix: drop
valuefrom the submit guard's form. - "
multilineis for atype: textfield, nottype: email" — fix:multilineon a text field only.
Reference: The submit guard, Who submits, The submit.