← Marketplace
Metering & Billing Loop
FREE TEMPLATEA self-contained usage-metering loop: a periodic meter feeds a ledger script, a balance view tracks spend, and a credit gate pauses the worker at the low-water mark.
This template is free. Launching requires $20 of prepaid credit on your account — a one-time top-up, not a refundable deposit: it stays on your account and isn't returned to your card. If we introduce ongoing charges for running boxes, we'll tell you before they apply to you.
Sign in to launch. The template's free; launching requires $20 of prepaid account credit (non-refundable).
Swarm file (blueprint body)
# lifecycle.swarm.toml — the METERING LOOP as a declarative swarm config. # Infrastructure-as-code for the internal lifecycle loop (no external money/AWS): # # [METER trigger] ──▶ [LEDGER script] ──▶ (BALANCE View) ◀── [CREDIT-GATE script] ──▶ [WORKER] # periodic usage debit ×markup balance balance ≤ low-water? paused # → halt # # Node KIND is from template_id; wire KIND is DERIVED from endpoint kinds: # meter→ledger Trigger→Script = Comms (the metering event feed) # ledger→balance Script→Dataset = DataAccess (write the running balance) # gate→balance Script→Dataset = DataAccess (read the balance) # gate→worker Script→Agent = Comms (the halt/pause signal) # # The script modules (yoke_ledger.wasm, yoke_credit_gate.wasm) are attached at # provision time (SetScriptModule) — grid layout is declarative; bytes are not. [[agents]] id = "meter" name = "METER" gx = 2 gy = 3 width = 2 height = 2 template_id = "builtin-loader" # cron Trigger: periodic usage rollup [[agents]] id = "ledger" name = "LEDGER" gx = 6 gy = 3 width = 2 height = 2 template_id = "builtin-script" [[agents]] id = "balance" name = "BALANCE" gx = 6 gy = 6 width = 2 height = 2 template_id = "builtin-dataset" # the balance View both scripts share [[agents]] id = "gate" name = "CREDIT-GATE" gx = 10 gy = 3 width = 2 height = 2 template_id = "builtin-script" [[agents]] id = "worker" name = "WORKER" gx = 10 gy = 6 width = 2 height = 2 # no template_id → an Agent: the thing that gets paused when credit runs out [[wires]] from = "meter" to = "ledger" [[wires]] from = "ledger" to = "balance" [[wires]] from = "gate" to = "balance" [[wires]] from = "gate" to = "worker"