needle-rs
Pure Rust and WebAssembly runtime for Cactus Compute's Needle tool-calling models: under 600 KB, runs in the browser, on the edge and in Python, no data leaves the device
Problem
AI tool calling usually means a paid API round trip or hundreds of megabytes of local model and runtime. Needle by Cactus Compute is a family of small transformers that map a query and a tool list to a JSON function call, small enough to run on the device if the runtime is small too.
Approach
A pure Rust runtime compiled to WebAssembly with one runtime dependency. Needle 3, 2 and 1 run from the same binary and the same API; the model generation is read from the file, not the file name. The same core ships as a browser and Node.js package, a Python wheel, a CLI and no_std embedded builds, with token-exact parity checks against the reference implementation.
Results
- Runtime under 600 KB of WebAssembly, about 200 KB over the wire with brotli.
- A full tool-calling agent in about 14 MB with Needle 2, or 36 MB with Needle 3.
- Optional int8 key/value cache cuts Needle 3’s cache memory from 8.8 MB to 2.3 MB at 512 tokens.
- Available on npm, PyPI and crates.io, with a live browser demo.
Stack
Technologies