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

Defining a tool

ToolParameter takes name, type, description, required (default true), and enumValues (default []).

Controlling the loop

Tool behaviour is set through LlmOptions:
Tools registered through tools.register are offered to every generation. Tools passed in options.tools apply to that call alone.

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 on 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.

Removing tools

Inspecting

A ready-made web search tool ships with the SDK: