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

The tools namespace

The executor is a suspending function, so it can do IO without blocking.

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.

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.

Removing

Inspecting