Tenzro Testnet is live —request testnet TNZO
← Back to Tutorials

Verifiable Reasoning with Tenzro Cortex

AI InfrastructureAdvanced35 min

Cortex is Tenzro's verifiable deep-reasoning layer. It runs Recurrent Depth Transformer (RDT) models and Sparse Mixture-of-Experts (MoE) variants on top of the standard Tenzro inference plane, charges in TNZO by loop count rather than tokens alone, and issues Ed25519-signed receipts binding the output to weights_hash, runtime_hash, and worker_did.

What You'll Build

  • Register a Cortex worker for an RDT model
  • Run four reasoning tiers (fast / standard / deep / maximum) with loop-bounded billing
  • Inspect a signed reasoning receipt and verify the signature
  • Call Cortex from the CLI, Rust SDK, and Tauri desktop app

Prerequisites

Step 1: Understand the Tiers

Unlike token-billed transformers, RDTs expose an explicit depth knob. Cortex wraps that knob into four tiers with price bounds:

Tier        | Typical loops | Use case
------------|---------------|----------------------------------------
fast        | 2–4           | single-step classification, retrieval
standard    | 6–12          | single-hop Q&A, summarization
deep        | 14–24         | multi-step planning, code synthesis
maximum     | 28–32         | agentic tool-use loops, math/proof

The caller always provides n_loops_min, n_loops_max, and max_tnzo. The worker is free to stop early if it converges, but can never exceed the bounds.

Step 2: Register a Worker

A worker registration is an on-chain record linking a sidecar endpoint to a machine DID and an arch profile. Only DIDs with the right delegation scope can register.

// Register a Cortex worker (one-time, by an operator with a machine DID)
tenzro_cortexRegisterWorker({
  "model_id": "openmythos/rdt-dense-7b",
  "sidecar_url": "http://localhost:9500",
  "bearer_token": "op_tok_...",
  "arch": "rdt-dense",
  "max_loops": 32,
  "moe_experts": null,
  "experts_per_token": null,
  "attn_type": "gqa",
  "worker_did": "did:tenzro:machine:abc..."
})
  -> { worker_id: "worker-01HQ...", status: "active" }

For an RDT-MoE model, fill in moe_experts and experts_per_token. For a standard transformer served through the Cortex interface, set arch: "transformer" and leave the MoE fields null.

Step 3: List Workers

tenzro_cortexListWorkers({ "model_id": "openmythos/rdt-dense-7b" })
  -> {
    workers: [
      {
        worker_id: "worker-01HQ...",
        model_id: "openmythos/rdt-dense-7b",
        arch: "rdt-dense",
        max_loops: 32,
        attn_type: "gqa",
        status: "active",
        last_heartbeat: "2026-04-20T12:00:00Z"
      }
    ]
  }

Step 4: Run a Reasoning Request

Cortex input is passed as raw hex so any downstream tokenizer can decode it deterministically. The max_tnzofield is a hard cap — if the worker would exceed it, the request fails rather than silently burning budget.

tenzro_cortexReason({
  "model_id": "openmythos/rdt-dense-7b",
  "input_hex": "0x48656c6c6f2c20776f726c6421",
  "tier": "deep",            // "fast" | "standard" | "deep" | "maximum"
  "n_loops_min": 12,
  "n_loops_max": 24,
  "max_tnzo": "5.0"
})
{
  "output_hex": "0x...",
  "loops_used": 18,
  "experts_activated": null,
  "input_tokens": 42,
  "output_tokens": 128,
  "latency_ms": 842,
  "model_version": "openmythos/rdt-dense-7b@sha256:...",
  "weights_hash": "0xa1b2c3...",
  "runtime_hash": "0xd4e5f6...",
  "worker_did": "did:tenzro:machine:abc...",
  "tnzo_charged": "3.6",
  "receipt": {
    "receipt_id": "receipt-01HQ...",
    "issued_at": "2026-04-20T12:00:00Z",
    "signature": "base64(Ed25519(canonical(claims)))",
    "signer_did": "did:tenzro:machine:abc..."
  }
}

Step 5: CLI

# Register a worker
tenzro cortex register-worker \
  --model-id openmythos/rdt-dense-7b \
  --sidecar-url http://localhost:9500 \
  --bearer op_tok_... \
  --arch rdt-dense \
  --max-loops 32 \
  --attn-type gqa \
  --worker-did did:tenzro:machine:abc...

# List workers
tenzro cortex list-workers --model-id openmythos/rdt-dense-7b

# Run a reasoning request (hex input)
tenzro cortex reason \
  --model-id openmythos/rdt-dense-7b \
  --input-hex 0x48656c6c6f \
  --tier deep \
  --n-loops-min 12 --n-loops-max 24 \
  --max-tnzo 5.0

Step 6: Rust SDK

use tenzro_sdk::TenzroClient;

#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
    let client = TenzroClient::connect(Default::default()).await?;

    let result = client.cortex().reason(
        "openmythos/rdt-dense-7b",
        "0x48656c6c6f",
        tenzro_sdk::cortex::Tier::Deep,
        Some(12),
        Some(24),
        Some("5.0"),
    ).await?;

    println!("loops used:   {}", result.loops_used);
    println!("latency:      {} ms", result.latency_ms);
    println!("weights hash: {}", result.weights_hash);
    println!("receipt:      {}", result.receipt.receipt_id);

    Ok(())
}

Step 7: Verify the Receipt

Every Cortex response carries an Ed25519-signed receipt. Verification anchors the computation to a specific worker identity and weights/runtime pair:

use tenzro_crypto::signatures::verify;

// A Cortex receipt is an Ed25519-signed CBOR/JSON over the reasoning claims:
//   (receipt_id, worker_did, model_version, weights_hash, runtime_hash,
//    input_tokens, output_tokens, loops_used, tnzo_charged, issued_at)
//
// The signer_did resolves to the worker's machine identity via tenzro_resolveDidDocument.
let pubkey = client.identity().resolve_pubkey(&receipt.signer_did).await?;
let ok = verify(&pubkey, &receipt.canonical_bytes()?, &receipt.signature)?;
assert!(ok, "invalid Cortex receipt");

Combine with TEE. For the strongest guarantee, deploy the sidecar inside an Intel TDX or NVIDIA CC enclave. The receipt then rides alongside a TEE attestation: math correctness (RDT output → signed receipt) and hardware integrity (enclave attestation over the same session id).

What You Learned

Next Steps