Skip to content
Sefra

Pillar: typed intents

Typed intents

The governed unit is a named business operation with a schema, not a tool call or a shell command.

Read the intent guide

What goes wrong without it

  • An order for 10,000 units instead of 10 is a valid API call. A gateway that forwards calls has nothing to object to.
  • An API description says how to call an operation. It does not say which operations are risky, what facts a decision needs, or how to undo it.

How it works

Someone who knows the system writes one manifest per operation. It is the whole contract: what the agent may send, what a decision reads, what is called, how it is undone, and what the approver sees.

The manifest of procurement.create_purchase_order
intent: procurement.create_purchase_orderversion: 1description: Create a purchase order with an existing, active vendor, within the department's budget.effect: write…input_schema:  type: object  additionalProperties: false  required: [vendor_id, sku, quantity, unit_price_minor, currency, department]  properties:    vendor_id:        { type: string, pattern: "^v_[0-9]+$" }    sku:              { type: string, minLength: 1, maxLength: 64 }    quantity:         { type: integer, minimum: 1, maximum: 100000 }    unit_price_minor: { type: integer, minimum: 0, x-sefra-money: true }    currency:         { type: string, enum: [EUR, USD] }    department:       { type: string, minLength: 1, maxLength: 64 }…facts:  # null when the department has no budget (404).  budget:    connector: erp    method: GET    path: "/budgets/${input.department}"    timeout_ms: 2000…execute:  connector: erp  method: POST  path: /purchase-orders  body: { vendor_id: "${input.vendor_id}", sku: "${input.sku}", quantity: "${input.quantity}",          unit_price_minor: "${input.unit_price_minor}", currency: "${input.currency}",          department: "${input.department}" }  idempotency: { mode: header, header: Idempotency-Key }  success: [201]  output: { po_id: "${response.body.id}", total_minor: "${response.body.total_minor}" }compensate:  connector: erp  method: POST  path: "/purchase-orders/${output.po_id}/cancel"  idempotency: { mode: natural }  success: [200]  # Already cancelled (409) or gone (404) both mean undone.  already_undone: [404, 409]summary_template: "Create purchase order: ${input.quantity} x ${input.sku} from ${input.vendor_id}, unit price ${input.unit_price_minor} ${input.currency} (minor units), department ${input.department}"

Scroll sideways for long lines.

  1. 1Schema input_schema:Unknown properties are refused. Money is an integer in minor units, with a separate currency.
  2. 2Facts facts:What a decision reads from the system of record, through a declared read operation with a timeout.
  3. 3Execute execute:The one API call, made with Sefra's credentials. The idempotency mode says whether a retry is safe.
  4. 4Compensate compensate:The call that undoes it. A write with neither this block nor irreversible: true fails validation and never reaches a tool list.
  5. 5Summary summary_template:The line an approver reads, built from typed input fields only.

Discovery per identity

An intent without a grant behaves exactly like one that does not exist. Its tool is not listed, a direct call gets the protocol's unknown-tool error, and a plan that names it is rejected. Every submission is checked against the same grants, so hiding a tool and refusing its use cannot diverge.

MCP and a REST mirror

Each granted intent is one MCP tool, procurement-create_purchase_order. Callers that do not speak MCP use POST /v1/executions. Both adapters call the same submission pipeline.

Who may use which intents
grants:  - role: procurement_agent    intents: ["procurement.*"]

Scroll sideways for long lines.

What it does not do

  • Intents are written by people. This authoring is the main cost of adopting Sefra, and nothing generates a finished intent.
  • A schema decides shape, not risk. Risk is decided by a policy rule.
  • A value of the wrong type is refused with its path. It is never coerced.

How it behaves

Automated tests cover each of these behaviours.

  • A value of the wrong type, such as a quantity sent as a string, is refused with the field's path. Nothing reaches your system.
  • A well-formed order above the remaining budget is refused by a named rule, with the actual value and the limit.
  • Once corrected, the same request with the same key creates exactly one purchase order.
  • An agent without the grant does not see the tool, and calling it directly or naming it in a plan is refused.
  • A write without an idempotency key is refused. A read needs none.

What is planned

On our product plan, and listed on the status page with its current state.

  • OpenAPI draft importPlanned
  • Search modePlanned
  • MCP TasksPlanned

Start with a pilot

Stopping an agent is the easy half. Sefra also finishes the job.