Tools: connect your own data
Let an AI step call your own API, search or booking system while it answers, and show the results as cards on your website chat.
What it does#
A tool is one API call or one Python script that an AI step may decide to run while it writes its answer: search your products, check prices or availability, look up an order, create a lead or a booking. You describe when to use it, and the AI picks the tool, fills in its inputs from the conversation, reads the result and answers. It can call several tools, one after another or at the same time, before it answers.
Tools belong to your account, not to one step. Write a tool once in the tools library and tick it in any AI step (an LLM step) of any AI flow in the account.
| Use | When |
|---|---|
| Tools on an AI step | The AI should decide whether and which call to make, and with what inputs: "flights to Rome in May", then "the cheapest hotel near the stadium". |
| HTTP step in a chatbot | The call always happens at a fixed point of the flow, with inputs you already collected. No AI decides. |
| Python step in an AI flow | Code that always runs at that point of the AI flow. |
Set it up#
- 1
Open the AI step
In the AI flow, double-click the LLM step that answers the customer. Pick a Claude or OpenAI GPT model under Model: tools work only with these.
- 2
Find Tools
Scroll to the Tools section. With no tools in the account yet, click Create a tool. Otherwise click Manage tools to open the tools library.
- 3
Write the tool
Click New tool. Fill in Name, When to use it and Inputs, choose Runs as: API call or Python, and write the Request or the Script. Click Save tool.
- 4
Add your keys
If the API needs a key, add it as a secret right in the editor (see Keys and secrets) and write
{{secret.NAME}}in the request. Never paste a key into the request itself. - 5
Test it
Under Test, fill in the Inputs and click Run test. The tool runs once for real, without the AI. Check the result and fix the tool until it is right.
- 6
Show the results as cards (optional)
Under Display, turn on Display as cards on the website chat and map the result's fields to the card. Run the test again to see How it looks on the website chat.
- 7
Tick it in the step
Back in the step, tick the tool (Let this step use name). A tool you create from the step is ticked for you. Preview the flow and ask something that needs the tool.
The tools library is shared by every AI step in the account: A change applies to live steps right away. Saving changes to an existing tool asks first: Live AI steps that use name change at once. Click Save anyway to save.
Every setting#
The AI step's Tools section
| Setting | What it does | Default | Limits / validation |
|---|---|---|---|
| Tool checkboxes (Let this step use name) | The tools this step may call. | None ticked | Up to 20 per step (A step can use up to 20 tools.). |
| Manage tools | Opens the tools library: list, create, edit, delete, test. | ||
| Tool calls per answer | How many rounds of "AI thinks, then calls tools" one answer may take. | 8 | Whole number 1-20. Empty = 8. |
| Seconds per answer | The time one answer may take, tools included. | 60 | Whole number 1-120. Empty = 60. |
| Built-in tools | Always available with tools: set_variable, get_variables, clear_memory (the AI's memory for this conversation). | Always on | Can't be removed or renamed. |
The tool editor
| Setting | What it does | Default | Limits / validation |
|---|---|---|---|
| Name | What the AI calls the tool, e.g. search_flights. | Empty | Starts with a lowercase letter; only a-z, 0-9 and _; up to 64. Unique in the account. Not set_variable, get_variables, clear_memory or guide. Can't be changed after the first save. |
| When to use it | The description the AI reads to decide when to call the tool. Say what it does, when to use it and what it returns. | Empty | Required, up to 1,024 characters. |
| Inputs | A JSON schema of what the AI must send. Describe each field: the AI fills them from the conversation. | One city text input | {"type": "object", "properties": {...}, "required": [...]}. Up to 30 inputs; names use letters, digits and _; each needs a type: string, number, integer, boolean, array or object. required may list only inputs in properties. Up to 8 KB. |
| Runs as | API call (an HTTP request) or Python (a script). | API call | |
| Request (API call) | The request as JSON: request plus the options below. | A GET to https://api.example.com/search with city | See The request. The url must start with https:// (or http://). |
| Script (Python) | def handler(o): that returns the tool's result. | A starter that returns the city | Must define handler; up to 100 KB. |
| Keys (Python) | Names of saved Python step keys the script reads as o.secrets['NAME'], separated by commas. | Empty | Each starts with a letter or _ and uses letters, digits and _. |
| Manage secrets | The account's secrets for {{secret.NAME}}, with their allowed hosts. | Only the account owner or an admin can save secrets. | |
| Takes action | The tool creates or sends something (a lead, a booking, a message). It runs once per conversation for the same input; asking again returns the first result. Shown with a Takes action badge. | Off | A tool that takes action can't reuse results. |
| Reuse results for (seconds) | The same call within this time returns the saved result without calling the API. | 0 (always call) | Whole number 0-3600. Disabled for tools that take action. |
| Also save the result as | Keeps the result in this conversation's memory under this name. | Empty | Starts with a letter or _; letters, digits and _; up to 64. |
| Status while it runs | The line the website chat shows while this tool runs, instead of Thinking (when answers stream in and Show what the AI is doing is on). | Empty | Up to 60 characters. {{field}} reads the call's inputs. |
| Display as cards on the website chat | Shows the result as cards. See Display as cards. | Off | Up to 3 groups of cards. |
The request#
An API-call tool uses the same request as the HTTP step, written as JSON. Only request is required.
| Key | What it does | Default | Limits |
|---|---|---|---|
request.method | GET, POST, PUT, PATCH, DELETE or HEAD. | GET | |
request.url | The address. May use inputs: https://api.example.com/orders/{{#args.order_id}}. | Starts with https:// (or http://). | |
request.query | [{"key", "value"}] added to the url. | ||
request.headers | [{"key", "value"}]. | ||
request.auth | {"type": "bearer", "token"}, {"type": "basic", "username", "password"} or {"type": "apiKey", "keyName", "keyValue", "in": "header" or "query"}. | none | |
request.body | {"type": "json", "json": "<JSON text>"}, {"type": "form", "form": [...]} or {"type": "raw", "raw": "..."}. | none | |
timeout_seconds | How long to wait for the API. | 20 | 1-30. |
retries | Tries again after a failure, inside the time limit. | 0 | 0-3. Only for GET and HEAD, or with safe_to_retry: true. |
result_path | Keep only this part of the JSON answer, e.g. data.results or items[0].price. | The whole answer | Fails with The answer has no '...' when the path isn't there. |
select | For a list: keep the first limit items and only these fields: {"fields": ["id", "price", "board=rooms[0].basis"], "limit": 200}. alias=path reads a nested value. | All items, all fields | 1-40 fields; limit 1-5000. Needs a list (point result_path at it). |
max_response_kb | The largest answer read. | 1024 (1 MB) | 1-102400. Above 1024 needs select (and a result_path like Data.hotels, without [index]): the answer is then read item by item, never whole. |
transform | Python run on the answer: {"code": "def handler(o): ...", "secrets": [...]}. o.inputs has response, args, vars and conversation. | None | Same rules as a Python tool. |
| Write | Inserts |
|---|---|
{{#args.city}} | The input city the AI sent. |
{{#vars.selected}} | A value saved in this conversation's memory. |
{{#conversation}} | The customer's conversation key (on WhatsApp their phone number; empty in previews and tests). |
{{secret.NAME}} | A saved secret. In the url, query, headers and auth only, never in the body. |
In a JSON body, a value that is exactly one placeholder keeps its type: "guests": "{{#args.guests}}" sends 2, not "2". An input the AI left out is sent as null.
A Python tool gets o.inputs["args"], o.inputs["vars"] and o.inputs["conversation"], and what handler returns is the tool's result. It runs in the same sandbox as the Python step.
Keys and secrets#
Open Manage secrets in the tool editor (it is the same list as the HTTP step's). Type a Secret name (e.g. CRM_TOKEN), paste the Value, and enter the Allowed hosts: the only places this secret may be sent, e.g. api.crm.com or *.crm.com. The request's host is suggested. Click Save secret, then write {{secret.CRM_TOKEN}} in a header, the query or auth.
- Saved values are never shown again, and a secret is only sent to its allowed hosts.
- A secret can't be part of the host name. Put it in a header, the query or the path.
- Only the account owner or an admin can save secrets; editors see the names and hosts.
- Python tools and transforms read Keys (saved Python step keys) by name as
o.secrets['NAME']. - Secret values are hidden from what the AI reads, from test results and from cards.
Tool definitions never hold secret values. The Agentim Assistant never asks you to paste a key into the chat: it asks you to add it here.
Test a tool#
Test runs the saved tool once, for real, with the inputs you type, without the AI. A new tool must be saved first (Save the tool to test it.). With unsaved changes, the test Runs the saved version.
- Inputs start with the schema's required inputs (or all of them), empty and of the right type.
- A tool that Takes action really does it: tick I understand this really runs (for example, it creates a lead). before Run test.
- The result line says Worked in N ms, Failed in N ms (code) or Answered from the saved result (no API call), and N characters, the AI sees up to 20,000.
- With Display as cards on, the test shows How it looks on the website chat with your current (even unsaved) card setting. No cards from this result means the list or the title fields don't match the result.
- After a test, the result's fields appear as chips under Fields (click to add): click one to add it to the field you are editing.
Display as cards#
On the website chat in the modern look, a tool's results can show as cards built from the result itself: the AI can't invent a price or a link on them. The AI is told the cards are on screen, so it writes a short answer instead of listing the results. WhatsApp and every other channel get the AI's text, as before.
| Setting | Key | What it does | Limits |
|---|---|---|---|
| List in the result | items | Where the list is, e.g. hotels or data.results. Empty = the whole result. An object there makes one card. | A field path. |
| Up to | limit | Cards from this group. | 1-6, default 4. |
| Title | title | The card's name, e.g. {{name}}. A card without a title is skipped. | Required; cut to 40 characters. |
| Price | price | e.g. €{{price}}. | Cut to 16. |
| Next to the price | period | e.g. {{nights}} nights. | Cut to 16. |
| Tag | tag | A small label, e.g. {{stars}}★. | Cut to 24. |
| Picture (https link) | image | The card's picture. | Only https links are used. |
| Picture is | image_style | A photo (full width) or A logo (whole, in a gray band). | photo or logo. |
| Icon when there is no picture | icon | Shown when the card has no picture, or it doesn't load: Plane, Hotel, City, Music, Ball, Car, Calendar, Star, Gift, Shop, Home, Map. | |
| Detail lines | features | Short lines under the title, e.g. {{room}}. Empty lines are left out. | Up to 6; each cut to 60. |
| Button text + Button link (https) | button | A button that opens the link in a new tab. | Both needed; text cut to 30; https only. |
| Choose sends | send | Adds a Choose button: a tap sends this text as the customer's message, e.g. {{name}} - {{price}}. | Cut to 80. |
| Quick reply per card | choices | A quick-reply chip under the answer, one per card. | Up to 4 chips; each cut to 40. |
| Highlight when true | highlight | Highlights the card when the field reads true, yes or 1. | |
| Card color | color | The card's border: a #RRGGBB code, or the first color name in the field ("Orange on the map" is orange). English and Hebrew color names. | |
| Show only when not empty | only_if | Leaves a card out when this reads empty, e.g. {{image_url}}. | |
| Filters | filters | Chips over the cards: Filter name and Shown when. A card is in a filter when its field reads true (not empty, false, no or 0). | Up to 4; name up to 20. |
| Status while it runs | status | See Every setting. | Up to 60. |
- Fields are
{{path}}templates:name,a.boritems[0].price. Plain text stays as it is. A list reads as "a, b". A template whose fields are all empty reads empty. Each field is up to 300 characters. - Add more cards adds a second or third group (for example flights, then hotels). Each tool's cards, and each group, are their own row: flights and hotels never mix in one row.
- An answer shows up to 6 cards. The AI ends its answer with a line such as
cards: 2, 3naming the cards that answer the question (cards: nonefor none). That line is removed before the customer sees the answer, and so are the cards' links and picture addresses if the AI wrote them in its text. - Cards from a later round replace earlier ones (the tickets of the event the AI found first); calls in the same round add up.
- On the chat, the cards sit after the answer's first paragraph, or at the end with Cards in answers set to At the end. Filters, Lowest price, the large picture card, Enlarge pictures and the words on cards are Chat experience settings.
How it runs#
AI reads
prompt, history, memory, today's date
AI calls tools
up to 4 at once
Results back
up to 20,000 characters each
Repeat or answer
Tool calls per answer, Seconds per answer
- What the AI gets. The step's System prompt (plus the step's other instructions), the step's Prompt as the customer's new message, the conversation so far as separate turns, the values saved in memory (up to 8,000 characters; the rest through
get_variables) and today's date (UTC). - The loop. The AI answers or asks for tool calls. Calls in one round run at the same time (up to 4 in parallel), the results go back, and the AI goes again until it answers without calling a tool. Each AI call can write up to 4,096 tokens.
- Limits. After Tool calls per answer rounds, or when Seconds per answer runs out, the customer gets the last text the AI wrote. If it wrote none, the step fails.
- Text only. With tools, the step answers with text: Answer with a schema isn't used.
- Results the AI reads are cut at 20,000 characters, with secrets hidden. A failed call gives the AI the error, its code and the HTTP status, so it can change course.
- No wasted calls. Identical calls in one round run once. A call that failed isn't run again with the same inputs in the same answer: the AI is told to change the inputs, use another tool, or offer a human.
- Takes action tools run once per conversation for the same inputs. A repeat returns
{"already_done": true, "result": ...}from the first run. - Reuse results keeps successful results for the set seconds, shared by all conversations. The key is the tool's definition (any change starts fresh), the inputs, and the memory or conversation only when the tool reads them.
- AI credits. Each AI call in the loop uses AI credits like any AI step, or runs on your own key if you connected one. See AI credits.
Memory. Each conversation has its own memory: values the AI saved with set_variable, results of tools with Also save the result as, and which Takes action calls already ran. It is kept for 72 hours.
| Built-in tool | What it does |
|---|---|
set_variable | Saves a value (e.g. what the customer chose) under a name (letters, digits, _). Shown to the AI on every later message; tools read it as {{#vars.name}}. |
get_variables | Returns everything saved in this conversation. |
clear_memory | Forgets everything saved, including which actions already ran. The AI uses it when the customer asks to start over. |
- On WhatsApp and the API, the conversation is the customer's phone (or session). On the website chat, each chat gets its own random id, so two visitors on the same network never share memory and a new chat starts empty.
- Previews and test runs use a memory that lasts for that run only: nothing is kept.
- Memory holds up to 50 values of up to 16 KB each, and the last 100 action records.
Supported models#
Tools work with Claude models (Anthropic) and OpenAI GPT models. With another model ticked tools show Tools work with Claude and OpenAI GPT models. Pick one of them above, or this step can't use its tools. With Set the model from a variable, the model is checked when the step runs.
Edge cases#
- Tool deleted or renamed. The step shows name isn't in this account's tools any more, so this step can't answer. Click Remove it from this step. Live chats fail until you do.
- The AI leaves out an input. In a JSON body it is sent as
null; in a url or header it is empty. Mark inputs it must send asrequired. - Huge answers. Up to 1 MB is read by default. For bigger lists use
selectwithresult_pathand raisemax_response_kb(up to 100 MB): only the selected fields of the firstlimititems are kept. - A result that isn't a list with
selectfails with select needs a list: point result_path at the list in the answer. - Same tool called twice at once with the same inputs runs once.
- Customer says "start over": the AI can call
clear_memory; after that, Takes action tools run again. - Cards outside the modern website chat: WhatsApp, the classic website look and the API get the AI's text only.
- Hebrew, emoji and other text in templates and status lines is kept as written. Color names are matched in English and Hebrew.
- A broken card picture gives way to the card's icon.
- Saving while someone else edits the same tool: Changed by someone else. Open it again and redo your change.
Errors and what you see#
Customers never see a raw error: they get a short fallback message in the bot's language. When you preview your own flow you see what went wrong.
| You see | Why | Fix |
|---|---|---|
| Tools work with Claude (Anthropic) and OpenAI GPT models. Change the model of the AI step ... | The step's model can't use tools. | Pick a Claude or GPT model. |
| The tool ... doesn't exist in this account. Create it under Tools or remove it from the AI step. | A ticked tool was deleted. | Recreate it, or untick it. |
| The tool ... is invalid: ... | A saved definition no longer passes the checks. | Open it in the library, fix it and save. |
| Tools aren't available on this server yet. | The server isn't set up for tools. | Contact support. |
| The AI step stopped before it wrote an answer (step or time limit). | The AI was still calling tools when a limit was reached. | Raise Tool calls per answer or Seconds per answer, or make the tool faster (select, Reuse results). |
| Test: Failed in N ms (missing-field) | result_path isn't in the answer. | Run the test without result_path and look at the real shape. |
| Test: Failed ... (missing-key) | The key ... isn't set for this account. | Add the Python step key, or fix its name in Keys. |
| Test: Failed ... (python-error) | The script raised an error or didn't return JSON. | Fix the script; the error text is shown. |
| Test: Failed ... (timeout) or a network code | The API was slow or unreachable. | Check the url, raise timeout_seconds (max 30). |
| A secret error | The secret is missing, or the host isn't one of its Allowed hosts. | Save the secret again with the right host. |
| Save: a problem next to a field | The definition breaks a rule in Every setting. | Follow the message. |
Build tools with the Assistant#
In the AI flow editor, ask the Assistant to connect your source, e.g. Connect our product search API and show the results as cards. It reads the tools guide, writes the tool (an HTTP request, or a short Python handler that reshapes the answer), and asks you to Confirm before it saves it. Then it runs a real test, fixes the tool until the result is right, and adds the tool's name to the answering step.
- Saving a tool always waits for your Confirm; Cancel saves nothing.
- The Assistant's tests never run a tool that Takes action. Test those yourself in the tool editor.
- For keys, it asks you to add them under Manage secrets and uses
{{secret.NAME}}. Don't paste keys into the chat. - For results the customer should see, it can add cards (title, price, picture or logo, icon, Choose sends, filters) and a status line.
API#
The dashboard, API keys and the MCP server use the same routes. On a server where tools are turned off, every route but the guide answers 403 feature-disabled. See the API reference.
| Method and path | Scope | What it does |
|---|---|---|
GET /v1/public/agent-tools/guide | ai_flows:read | How to write a tool, the built-in tools, step settings, limits, and enabled for your account. |
GET /v1/public/agent-tools | ai_flows:read | Your tools: name, description, kind, side_effect, revision, updated_at. |
GET /v1/public/agent-tools/{name} | ai_flows:read | One tool's full definition, its revision and updated_at. |
PUT /v1/public/agent-tools/{name} | ai_flows:write | Create (201) or replace (200). Replacing needs "expected_revision" (the one you read) or "confirm": true. |
DELETE /v1/public/agent-tools/{name} | ai_flows:publish | Body {"confirm": true}. AI steps that use it fail until it is back. |
POST /v1/public/agent-tools/{name}/test | ai_flows:read + builders:test | {arguments, vars?, conversation?, display?, confirm?}: one real call without the AI. |
- The test answers
{ok, result | error, code, ms, cached, result_chars, model_sees_chars}, withresult_preview(20,000 characters) instead ofresultwhen the result is bigger, anddisplay {cards, choices, status?}when the tool (or thedisplayyou send) shows cards. A tool withside_effectneeds"confirm": true. - Errors are problem+json:
invalid-name,invalid-tool(withproblems),revision-conflict(409),not-found(404),confirm-required,invalid-display,feature-disabled(403). - An AI step's tools are set on the node:
PATCH /v1/public/ai-flows/{id}/nodes/{node_id}withconfig.tools(up to 20 names) andconfig.tool_loop(max_steps1-20,turn_seconds1-120).
Limits#
| Limit | Value |
|---|---|
| Tools per account | 200 |
| Tools per AI step | 20 |
| Inputs per tool | 30 (schema up to 8 KB) |
| Description | 1,024 characters |
| Script | 100 KB |
| Tool calls per answer | 1-20 (default 8) |
| Seconds per answer | 1-120 (default 60) |
| Request timeout | 1-30 seconds (default 20), retries 0-3 |
| Answer read | 1 MB, up to 100 MB with select |
| Result the AI reads | 20,000 characters |
| Reuse results | 0-3600 seconds |
| Memory | 50 values, 16 KB each, kept 72 hours |
| Cards | 3 groups, 6 per group, 6 per answer, 4 quick replies, 4 filters |
Examples#
1. Product search with cards. A shop wants the AI to search its catalog.
- Tool
search_products, When to use it: Searches our products by words and an optional max price. Use it whenever the customer asks for a product, a price or what's in stock. Returns up to 20 products. - Inputs:
query(string, required),max_price(number). - Request: GET
https://shop.example.com/api/searchwith queryq = {{#args.query}},max = {{#args.max_price}}and a headerAuthorization: Bearer {{secret.SHOP_TOKEN}};result_path:products; Reuse results for 600. - Display: list
products(empty, if the result is the list), Title{{name}}, Price€{{price}}, Picture{{image}}, Detail line{{color}}, Choose sendsI'll take {{name}}, Filter On sale when{{on_sale}}. Status: Searching for {{query}}...
2. Create a lead once. Tool create_lead (POST to your CRM) with Takes action on and inputs name, phone, interest (all required). If the AI calls it twice with the same details in a conversation, the CRM gets one lead and the AI is told it was already done.
3. Travel offer in two rounds. Tools search_events (cards with icon Calendar) and search_hotels (cards with icon Hotel, picture as a photo, Highlight when true {{recommended}}). The AI finds the event first, saves the customer's choice with set_variable, then searches hotels for those dates; the hotel cards replace the event cards. Raise Seconds per answer to 90 if the hotel API is slow.
Build spec#
A tool definition as the API and the tools library store it (PUT /v1/public/agent-tools/search_hotels), and the AI step's fields on the LLM node.
{
"name": "search_hotels",
"description": "Searches hotels in a city for check-in and check-out dates. Use it when the customer asks where to stay. Returns hotels with price per stay.",
"input_schema": {
"type": "object",
"properties": {
"city": { "type": "string", "description": "City name, in English" },
"check_in": { "type": "string", "description": "YYYY-MM-DD" },
"check_out": { "type": "string", "description": "YYYY-MM-DD" }
},
"required": ["city", "check_in", "check_out"]
},
"executor": {
"kind": "http",
"request": {
"method": "GET",
"url": "https://api.example.com/hotels",
"query": [
{ "key": "city", "value": "{{#args.city}}" },
{ "key": "from", "value": "{{#args.check_in}}" },
{ "key": "to", "value": "{{#args.check_out}}" }
],
"headers": [{ "key": "X-Api-Key", "value": "{{secret.HOTELS_KEY}}" }]
},
"timeout_seconds": 20,
"result_path": "data.hotels",
"select": { "fields": ["name", "stars", "price", "photo", "link", "board=rooms[0].basis"], "limit": 50 }
},
"side_effect": false,
"cache_seconds": 600,
"save_as": "hotels",
"display": {
"status": "Searching hotels in {{city}}...",
"cards": [
{
"items": "",
"title": "{{name}}",
"tag": "{{stars}}★",
"price": "€{{price}}",
"period": "per stay",
"image": "{{photo}}",
"icon": "hotel",
"features": ["{{board}}"],
"button": { "label": "Details", "url": "{{link}}" },
"send": "{{name}} - €{{price}}",
"limit": 4
}
]
}
}{
"name": "order_status",
"description": "Looks up an order by its number. Use it when the customer asks where their order is.",
"input_schema": { "type": "object", "properties": { "order_id": { "type": "string" } }, "required": ["order_id"] },
"executor": {
"kind": "python",
"code": "def handler(o):\n order = o.inputs['args']['order_id']\n return {'order': order, 'status': 'shipped'}\n",
"secrets": ["CRM_API_KEY"]
},
"side_effect": false
}{
"tools": ["search_hotels", "order_status"],
"tool_loop": { "max_steps": 8, "turn_seconds": 60 }
}side_effect, cache_seconds, save_as and display are optional; cache_seconds must be 0 when side_effect is true. display is {"cards"?: [...], "status"?: "..."} with only the keys in Display as cards. An AI step without tools (or with an empty list) answers as before.