Skip to content

From source to published artifact

A reusable capability block goes from a Python file to a published, immutable artifact in three commands. Each command reads what the previous one produced, checks it, and adds its own output:

flowchart LR
  S["billing.py<br/>your block"] --> G["xratu capability generate"]
  G --> B["xratu bake"]
  B --> P["xratu publish"]
  P --> C["The catalog<br/>a release other workflows reuse"]

This page follows one block, acme.billing with a Ledger class, through all three, and shows what each step produces. The rest of this section explains each part in detail.

The terms

Term What it is
Reusable capability block Your Python module and its SDK declarations. One module is one block.
Block pipeline xratu capability generate followed by xratu bake: everything the kernel needs, produced from the block before it runs.
Xratu capability interface (XCI) The typed list of a block's methods, their parameters, results, errors, effects and retry behaviour.
XCI source The block's interface definition as a file, billing.xci.json, kept beside the module.
Compiled interface The checked, final form of the interface, with its id, version and interface hash.
Interface hash The fingerprint of the interface contract, xci-sha256:….
Generated bindings Python and Rust code generated from the interface for each side of the block's boundary.
Dispatch module Generated code inside the capsule that checks each call and calls your method.
Interface seed Generation's record of the block: identity, compiled interface, method numbers, dependency intent, and the generated files with their digests.
Block manifest The governed description of the block: metadata, execution contracts, exports.
Block folder The folder you run generate and bake in. It holds one reusable capability block, which may span several files.
Xratu package The immutable artifact bake produces from a block: the package archive, the build record, and the block's capsule.
Package archive The content-addressed .xratu.tgz holding every file in the block folder.
xratufile The build record: the archive's identity, the execution plan, and every capsule's documents.
Execution capsule One block's executable artifact inside the package: its manifest, executable surface index and build input, over the package's file tree.
Capsule digest A capsule's identity, taken over the package's files plus the block's interface and dependency intent.
Executable surface index A capsule's map from each method number to the dispatch module that serves it.
Release One published version of a package, recorded by the control plane from its metadata.
Immutable runtime artifact A published, content-addressed artifact the data plane can fetch and verify. Each capsule in a release becomes one.
Publication attestation The control plane's signed statement over a capsule's digests: its manifest, file tree and archive blob digests.

Step 1: generate the block

xratu capability generate billing.py --module acme.billing --version 1.2.0 --out-dir .xratu/generated

Generation runs the XCI compiler over the block and writes everything the later steps need:

billing.py                                          your block
billing.xci.json                                    XCI source
python/acme/billing/ledger_guest.py                 Python binding
rust/acme/billing/ledger.rs                         Rust binding
capsule/acme/billing/ledger_adapter_dispatch.py     dispatch module
.xratu/generated/acme.billing_reusable_capability_block_interface_seed.json
.xratu/generated/acme.billing_reusable_capability_block_manifest.json
.xratu/generated/acme.billing_reusable_capability_block_adapter_manifest.json
.xratu/generated/acme.billing_reusable_capability_block_env_intent.json

ledger.rs is a typed Rust representation of the block's XCI contract: its records, method numbers and declarations as Rust types. It is not a translation of your Python code and not what runs it. The Rust kernel works from the sealed compiled interface, and your Python runs in the CPython provider.

flowchart LR
  B["billing.py"] --> X["XCI source<br/>billing.xci.json"]
  X --> CI["Compiled interface<br/>id, version, hash"]
  CI --> GB["Generated bindings<br/>Python, Rust"]
  CI --> D["Dispatch module"]
  CI --> SD["Interface seed<br/>method numbers, digests"]
  B --> M["Block manifest,<br/>adapter manifest,<br/>environment intent"]

Nothing is sealed yet. These are files in your block folder, and you can read every one of them. See Block generation output and Xratu capability interfaces.

Step 2: bake the package

xratu bake . --out-dir ../build

Bake runs on the block folder. It archives the folder, compiles the block's interface again to confirm nothing changed since generation, and builds the block's capsule:

{
  "status": "baked",
  "archive": "../build/acme.billing-manifest-1.2.0-1de656841841.xratu.tgz",
  "bundle_digest": "9c8dc1d987eca10970c86629ca215315885382ed61e52576385caaff63a20cda",
  "file_count": 10,
  "capsule_count": 1,
  "capsules": ["sha256:40e4f7107cd51aaf3f71dfa261b1db2a8c4f7f2c50f5c92965f4dce90124d537"],
  "provider_requirement": {"kind": "cpython", "abi": "cp311", "min_version": "3.11.12"}
}

The result is one Xratu package:

flowchart LR
  P["Xratu package<br/>acme.billing-manifest 1.2.0"]
  P --> A["Package archive<br/>.xratu.tgz, every file in the block folder"]
  P --> X["xratufile<br/>build record"]
  P --> C["Execution capsule<br/>acme.billing"]
  C --> CM["Capsule manifest"]
  C --> SI["Executable surface index"]
  C --> BI["Build input"]
xratufile                                                     the build record
../build/acme.billing-manifest-1.2.0-1de656841841.xratu.tgz   the package archive
../build/acme.billing-manifest-1.2.0-capsules/
  acme.billing.manifest.json                                capsule manifest
  acme.billing.executable_surface_index.json                executable surface index
  acme.billing.build_input.json                             build input

A capsule is a view over the package, and holds no copy of its files: its manifest lists the package's file tree by hash, and adds the block's interface, entry point, dependency intent and provider requirement. A block that spans several files is still one block, with one package and one capsule. See Bake pipeline, Xratu package and Execution capsules.

Step 3: publish the release

xratu publish . --workspace payments

Publishing has two halves. The CLI uploads the package archive straight to your organization's artifact registry, with a short-lived credential your own data plane obtains from your cloud provider (an ASPTC; see Artifact registry and blob references). It also sends the control plane the release metadata: the archive's digests and the capsule's documents exactly as bake wrote them, with their digests. The capsule's entry:

{
  "reusable_capability_block_id": "acme.billing",
  "interface_id": "acme.billing.Ledger",
  "capsule_digest": "sha256:40e4f7107cd51aaf3f71dfa261b1db2a8c4f7f2c50f5c92965f4dce90124d537",
  "interface_hash": "xci-sha256:a5cb0b948204b50045fb7fada9a716fc25a6af6191087b9950911b9b219f03b6",
  "provider_requirement": {"kind": "cpython", "abi": "cp311", "min_version": "3.11.12"},
  "manifest_digest": "sha256:a8c696b2c5ac0db9cb80591cf27462a87a073b0da693af0c30d4be88674c20f7",
  "executable_surface_digest": "sha256:2da2c23b22d06090fabca1e969ff3714a1506e96ae4b7c6a7ddd06db4a5525e9"
}
flowchart TB
  P["xratu publish"]
  P -->|"package archive"| BL["Your artifact registry<br/>the package archive, by digest"]
  P -->|"metadata only"| R["Control plane<br/>release record"]
  R --> AT["Publication attestation<br/>signed over the capsule's digests"]
  AT -.->|"names the archive by digest"| BL

The control plane works from metadata alone. For each capsule it signs a publication attestation over digests from the release metadata: the capsule digest, the manifest digest, the file-tree digest and the archive's blob digest. The code and the archive bytes stay between the CLI, your registry and the data plane. Each capsule becomes an immutable runtime artifact: the data plane fetches the archive from your registry and checks it against the signed digests before any cell runs it. A release with no capsules, or with a capsule whose file tree disagrees with the archive's file hashes, is refused. See Publishing a release and Immutable runtime artifacts.

Where each part is explained

  1. The block and its interface: Reusable capability blocks, Xratu capability interfaces and the pages after it.
  2. What bake produces: Bake pipeline, Xratu package, Execution capsules, Capsule contents and Packages and capsules.
  3. Publishing and reuse: Publishing a release, Immutable runtime artifacts and Published artifact catalog.

What happens after publishing, when a project resolves a closure for each capsule and runs it in a cell, is covered in Dependencies & Runtime Composition.