Skip to main content
Register a tool and the function that runs it. The SDK owns the call-and-execute loop and detects the format the model expects.

The tools namespace

RunAnywhere.llm.tools carries register, unregister, and list.

Defining a tool

Controlling the loop

Tools registered through tools.register are offered to every generation. Tools passed in options.tools apply to that call alone.

Executors run in the main process

This is what Electron has over the browser and the phone. A tool executor here has the full Node API: the filesystem, child processes, the network with no CORS, and any native module you have installed.
That power cuts both ways. A model deciding which file to read is a model deciding which file to read. Validate the arguments, confine paths to a directory you chose, and never hand a tool a shell string the model composed.

Watching the calls happen

The stream reports tool activity, which is what lets you show “checking the weather…” rather than a stalled cursor:

Which models can do this

Tool calling needs a model with enough context to hold the tool definitions. The SDK gates on context length rather than a model allowlist, so any model with a large enough window can participate, though instruction-tuned models trained on tool use do it far more reliably. A desktop can afford a larger contextLength at load time, which helps here.