Get started with lmtorch
Run a small tensor program with LMScript and the latest lmtorch release. The compiler downloads the matching native host when it is missing.
Overview
First install the compiler, then run the self-contained tensor sum program below.
Install the compiler
Install Node.js 24.15 or newer, then install the LMScript compiler from npm.
npm install -g @lmctl-ai/lmctl
Run a checked example
Save this program as tensor-sum.lms in an empty working directory. It creates a two-by-two tensor, checks its sum, and prints the result.
p = _lmcode_ cli="lmtorch" install="github:lmctl-ai/lmtorch@v0.5.1";
let values = torch.tensor("[[1.0, 2.0], [3.0, 4.0]]");
let total = values.sum().item();
out.check(total == 10.0, "sum must be 10");
out.set("shape", values.shape()).set("sum", total);
end _lmcode_
savedsl(p, "tensor-sum.dslb");
run = system ${dsl_cli(p)} --lmcode tensor-sum.dslb;
if (run.code != 0) { println(str(run.stderr)); exit(run.code); }
result = json_parse(run.stdout).result;
println(f"shape {result.shape}, sum {result.sum}");
Run it with lmscript tensor-sum.lms. A successful run prints the shape and sum. The out.check call stops the run if the expected value is wrong.
Run with an agent team
The solo quickrun seeds one Lead and asks it to compute and verify a tensor result. The trio seeds a Lead, Coder, and Reviewer, then passes the assignment, implementation, and review through those members in order.
lmctl quickrun https://lmctl.com/tools/lmtorch/lmtorch_solo.lms
lmctl quickrun https://lmctl.com/tools/lmtorch/lmtorch_trio.lms
These team scripts require configured provider accounts. The defaults are Codex for Lead and Reviewer, and Antigravity for Coder. Review the solo source or trio source before running. Each run creates a new teamfile and prints commands for resuming its Lead terminal. Add --seed-only to seed the team without sending the task prompt.
Learn more
Browse the examples book, read the API guide, or see the full API reference.