knoten / builtin / ai / aidependencies / tools
Calculator
Evaluate arithmetic expressions.
Dieser Inhalt ist noch nicht in deiner Sprache verfügbar.
Give an AI agent a calculator, so it computes numbers exactly instead of guessing.
What it does
Section titled “What it does”Calculator is a tool for an agent, not a step in the flow. It has no output port: you connect it to the Tools slot of a Tools Agent, and the agent’s model can call it whenever it needs a result.
The model sends a math expression such as (1299 * 0.8) + 4.99 and gets the result back as text. If the expression can’t be read, the tool answers “I don’t know how to do that.” and the model carries on. It only computes: no approval is needed and nothing outside the run is touched.
When to use it
Section titled “When to use it”- The agent must add up prices, apply a discount or a tax rate, or convert units from data it read.
- Answers must be exact: language models often get long arithmetic wrong.
For a fixed calculation you already know, skip the agent and use an expression in a regular node, for example {{ $input.price * 1.2 }}.
Inputs and settings
Section titled “Inputs and settings”This node has no settings.
There is nothing to configure. The model writes the expression on each call.
Outputs
Section titled “Outputs”This node has no output port. It plugs into a slot on another node instead of passing items along.
- Tools slot of Tools Agent
The result goes back to the model, not to the next node. You see it in the agent’s steps output, and the final answer in its response.
Dependencies and credentials
Section titled “Dependencies and credentials”None. This node needs no connection and has no slots for other nodes.
Example workflow
Section titled “Example workflow”- Get All Text reads your shopping cart page, with Output field name
text. - Tools Agent with Prompt
Add up the item prices in this cart and apply a 15% discount: {{ $input.text }}, a Chat OpenAI model in Model, and Calculator connected to Tools. - Display Markdown shows
{{ $input.response }}.
Common issues
Section titled “Common issues”- The agent does the math itself and gets it wrong. Tell it in the Prompt or the System message to “use the calculator tool for every calculation”.
- The tool answers “I don’t know how to do that.” The model sent something that isn’t a plain math expression, such as text with currency signs or words. Ask it to send numbers and operators only.
- The Calculator is never called. Some small or on-device models handle tools poorly. Try a larger model.
Related nodes
Section titled “Related nodes”- Tools Agent: the agent this tool plugs into.
- Think: let the agent plan multi-step work before calculating.
- Tool Selection: how an agent chooses between its tools.