Skip to content
Sefra

For platform teams

For the team that installs and operates it

You install Sefra, write the intents and rules for your systems, activate them as a versioned bundle, and operate it. The writing is the real cost, and this page says how much is known about it.

What you install

Sefra runs in your network. Nothing phones home: operational telemetry goes only to the collector you configure.

Sefra
One binary or container, with an agent listener and an operator listener.
PostgreSQL 18
The only datastore Sefra owns. Run sefra migrate first, as the owner of the tables.
Temporal
The durable execution engine. Validated today in a single-server deployment. Clustered deployments are planned.
Your identity provider
It issues OAuth tokens to agents and signs people in. Roles come from its claims.
A secret manager
Connector credentials are read at run time, from a file or a secret manager. OpenBao is the one tested.
A service account per system
With exactly the operations your intents call: execute, undo, probes and fact reads.

Planned:

High availabilityPlanned

What you write

Three files for one operation: the intent, the rule and its test. These are from the starter procurement library, which you copy and adapt.

An intent
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.

A rule
# procurement.large_order: a finance approver, not the requester, approves# orders from the first threshold.require_approval contains {  "rule": "procurement.large_order",  "message": sprintf("Order total %d minor units is at least %d.", [order_total, approval_threshold_minor[input.input.currency]]),  "approver": {"role": approver_role},  "distinct_from_requester": true,} if {  is_order  order_total >= approval_threshold_minor[input.input.currency]}

Scroll sideways for long lines.

Its test, on both sides of the threshold
test_large_order_at_the_threshold if {  # 17 x 120000 = 2,040,000; the threshold is 2,000,000.  approvals(order_of(17)) == {"procurement.large_order"}}…test_large_order_not_below_the_threshold if {  # 16 x 120000 = 1,920,000.  count(approvals(order_of(16))) == 0}

Scroll sideways for long lines.

What writing intents costs

Intents have to be written by someone who knows the system, including how to undo each operation. An API description cannot tell Sefra which operations are risky, which facts a decision needs or what the reversal is.

  • Effort depends on the system. Customer deployments have not started, so we do not publish an estimate. We scope the work with you during the pilot.
  • Expect the first real run to take the most time. Reading a system's real errors, idempotency and undo behaviour is the work. On Stripe, for example, the live API refused two parameters we had planned to send. Have someone review each bundle too, because a schema that is too open can still pass its tests.

Drafting from an API description is planned, and a person still writes the undo, facts and summary:

OpenAPI draft importPlanned

How a bundle is activated

A bundle is identified by its digest. Executions already accepted finish under the bundle they were accepted under. Going back is activating the earlier digest.

CommandWhat it does
sefra bundle test ./bundleValidates schemas and runs the policy tests. Needs nothing running.
sefra policy replay --bundle ./bundleLists past decisions whose effect would change under the candidate.
sefra bundle upload ./bundleStores the candidate under its digest without activating it, for a CI job.
sefra bundle apply ./bundleValidates again and activates in one step, recorded in the audit trail.

What you operate

Day to day, from the command line or the operator console.

CommandWhat it does
sefra approvals listWhat you may decide. People also decide on the approval page.
sefra executions settle-stepSettles a step whose outcome is unknown, after you looked at the system.
sefra executions retry-compensationRuns failed compensations again once the cause is fixed.
sefra control suspend | disable | pauseRefuses one principal, one intent, or all submissions and forward steps, without a bundle change. Undo still runs, and a pause rolls running plans back.
sefra audit verifyRecomputes the hash chain and names the first broken link.
sefra drainExits 0 only when nothing is in flight, before an upgrade.

The adoption steps

In order. Step 8 is the one that makes the control real.

  1. 0PrerequisitesA container platform, PostgreSQL, an identity provider, an agent that speaks MCP, and a scoped service account in each target system.
  2. 1DeployRun Sefra, its database and Temporal inside your network.
  3. 2Register connectorsFor each system: base URL, how Sefra authenticates, timeouts and a concurrency cap. The credentials belong to Sefra.
  4. 3Define intentsA name and input schema, the facts a decision needs, the call that executes, the call that undoes it or an explicit irreversible flag, and a summary for approvers.
  5. 4Write policies and testsRules in Rego that deny or require approval by a role. Grants and rate limits are plain configuration files.
  6. 5Publish a bundleIntents, policies, grants and limits live in git. Every decision records the digest it was made under.
  7. 6Connect identityRoles in the token decide which intents an agent sees and which approvals a person may give.
  8. 7Connect approvalsPoint the signed webhook at a receiver in your network.
  9. 8Point the agent at Sefra and remove its direct accessAdd the MCP endpoint, then revoke the agent's own credentials for the target systems. Until this is done, the agent can still go around the gateway.
  10. 9OperateApprovers decide, operators are alerted when an undo cannot complete, policy changes go through code review, and the record is verified and exported.

Start with a pilot

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