Skip to main content
Tools are functions the AI model can call during execute(). The model reads the tool’s name, description, and input schema to decide when and how to call it. You define the logic; the model decides when to use it.

Creating a tool

Create a file anywhere under src/:
The input and output schemas use Zod. Use .describe() on each field so the model knows what to pass. The handler receives validated input and returns typed output.

Using tools in a conversation

Pass tools to execute() via the tools array:
The model decides which tools to call based on the conversation. It can call multiple tools across multiple iterations before responding.

Inline tools

You can define tools directly inside a handler without creating a separate file:
This is useful for tools that are only relevant to a single type of conversation.

Writing good descriptions

The description field is how the model decides when to use your tool. Be specific about what the tool does and when to use it:
Use .describe() on input fields for the same reason:

Signals

Tools can throw signals to influence the AI loop without returning a normal result.

ThinkSignal

A ThinkSignal throws context back into the model’s reasoning without producing a tool output. This is useful when a tool finds no results and you want the model to try a different approach:

Actions as tools

Actions are reusable functions that can be called from anywhere in your agent—conversations, workflows, other actions, or external API clients. Tools only work inside execute(), where the AI model decides when to call them based on the conversation. You can convert any action into a tool by calling its asTool() method and passing it into tools:
Check out our guide on building actions for more information.

Workflows as tools

Workflows are long-running background processes that can span multiple steps and run independently of the conversation. Converting a workflow to a tool lets the model kick one off:
Check out our guide on creating workflows for more information.

Calling actions from tools

Tools can call actions for reusable logic:
Last modified on April 27, 2026