Tutorial — Agents
Reason with Tenzro Cortex
Cortex is the on-network reasoning layer. A reasoning request runs a chat model under explicit cost, loop, and deadline ceilings, and returns the answer together with the trace and the spend receipt.
- Level
- Intermediate
- Time
- ~15 min
- Prerequisites
- Machine DID, chat model loaded
- Stack
- TypeScript
01
Submit a one-shot reasoning request
The simplest entry point — pick a model, give it a question, and a tier.
import { TenzroClient } from "tenzro-sdk";
const client = new TenzroClient({ endpoint: "https://rpc.tenzro.network" });
const reply = await client.cortex.reason(
"qwen-3-0.6b",
"How many TEE-attested validators were active in the last epoch?",
"standard",
);
console.log(reply);02
Reason with explicit budget and loop caps
For production runs, use the full request shape to bound spend, loops, and deadline.
const reply = await client.cortex.reasonWithRequest({
model_id: "qwen-3-0.6b",
input: "Summarize the last 5 governance proposals.",
tier: "standard",
min_loops: 1,
max_loops: 5,
max_cost_tnzo: "0.05",
deadline_ms: 30_000,
});03
Grant a memory entry
Agent memory persists across requests; recall happens with vector kNN, BM25, or hybrid RRF.
const record = await client.memory().grant({
agent_did: "did:tenzro:machine:...",
text: "alice prefers Qwen 3 for code review",
source: "Controller",
});
console.log(record.id);04
Discover available workers
Cortex workers register on the network; list them locally or via the gossip-learned set.
const local = await client.cortex.listWorkers();
const remote = await client.cortex.listRemoteWorkers();
console.log({ local, remote });Related