Xratu capability interfaces¶
Every reusable capability block has an interface: the typed list of methods that workflows and other blocks can call, what each method takes and returns, and how it behaves when a call fails. Xratu calls it the Xratu capability interface, XCI. The kernel checks every call against it and routes each call by it; the interface is all the kernel knows about what a block offers.
You never assemble an interface by hand. You write the block in Python with its
SDK declarations, and the reusable capability block pipeline,
xratu capability generate followed by xratu bake, produces everything the
kernel needs from it. The rest of this section calls it the block pipeline.
From your block to the kernel¶
flowchart TB
B["billing.py<br/>your block and its SDK declarations"]
B --> G["xratu capability generate<br/>runs the XCI compiler"]
G --> O["Interface definition, compiled interface,<br/>generated bindings, dispatch module,<br/>manifest and interface seed"]
O --> K["xratu bake<br/>compiles again, checks, builds the package"]
K --> C["Xratu package<br/>with the block's execution capsule"]
C --> R["Kernel<br/>checks the interface hash, routes calls by method number"]
xratu capability generateruns the XCI compiler, which ships with the Xratu SDK. It writes the interface definition, the compiled interface, the generated Python and Rust bindings, the dispatch module, the block manifest and the interface seed.xratu bakeruns the compiler again, checks the result against what generation recorded, and builds the Xratu package: the block's archive with its execution capsule.- The kernel receives a block's capsule from the published package. It verifies the interface and runs calls against it, with no compiler and no access to your source.
What an interface is made of¶
Generation records the interface for a ledger block in its interface seed:
{
"reusable_capability_block_id": "acme.billing",
"interface_id": "acme.billing.Ledger",
"interface_version": "1.2",
"interface_hash": "xci-sha256:a5cb0b948204b50045fb7fada9a716fc25a6af6191087b9950911b9b219f03b6",
"exports": ["charge", "charge_status"],
"export_ordinals": {"charge": 7, "charge_status": 9}
}
- An identity.
acme.billing.Ledger: the block's module, followed by its class. - A version.
1.2, a major and a minor number. - Methods with permanent numbers. Callers and the kernel address
chargeas method 7. See Export ordinals. - A fingerprint. The interface hash changes whenever the contract a caller relies on changes. See Canonical interface hashing.
Each method also declares its typed parameters and result, how the result is delivered, its errors, and its effect and retry behaviour. See Records, variants, resources, and streams and Effect and retry declarations.
Why blocks have a typed interface¶
- Calls are checked before your code runs. A call with the wrong method number or the wrong arguments is refused at the block's boundary.
- Any caller can use the block. A workflow step, another block, or a block on another runtime provider calls the same methods through the same interface. See Language neutrality.
- Reuse is safe to judge. The version and hash tell a caller whether a new release still serves it. See Interface evolution and compatibility.