Flows in AI Assistants
A flow with the ai_tool trigger is a tool your AI assistant can use in a chat: book a visit, look up an order, take a payment, save a lead. The assistant collects the details the flow needs from the customer, calls the flow, and answers with what the flow tells it.
How a flow becomes a tool
- Inputs become questions. Each input with
askAi: true(the default) is something the assistant collects before it calls.requiredinputs must be collected. Anenuminput limits the answer to itsoptions, and adateinput arrives as ISO 8601 text. The input’sdescriptionis what the assistant reads, so say what to ask for and in what format. - The description says when. The assistant calls the tool when the chat matches the tool’s description. By default that is the flow’s
description. - The answer comes back. With
settings.answerMode: "wait"(the default), the assistant waits up tosettings.timeoutSecseconds (20 by default, up to 120) and reads the Reply to the AI step’s message before it answers. Keep these flows quick. With"background", the run is queued and the assistant only learns that it started. - Connect it. The flow does nothing until it is given to an assistant with Connect, or in the dashboard.
When you update the flow, its tool picks up the new inputs and answer mode at once. When you delete the flow, its tool is switched off, so the assistant stops calling it.
What the assistant hears back
| When | The assistant is told |
|---|---|
| The run finishes | The Reply to the AI step's message. With no message, the flow's result as text |
| The run reaches a Wait step | That the flow is in progress and will carry on by itself, plus any Reply to the AI message before the Wait |
| answerMode is background | That the flow started and the customer should be told it is being handled |
| A step fails | That the flow failed, to apologise without technical details, and to offer to try again or hand over to a person |
| The run takes longer than timeoutSec | That the flow took too long, to apologise and offer to try again |
| The flow is switched off | That this action is unavailable right now |
| The month's flow runs are used up | That the flow cannot run now, and to say a team member will follow up |
Write the reply for the assistant
Booked {{ steps.book.label }} for {{ input.name }}. Confirm the time and share the store address.Give a Flow to Assistants
Creates the flow’s tool the first time and adds it to each assistant you name. Calling it again reuses the same tool, switches it back on if it was off, and adds it to more assistants. Scope flows:write.
Connect Body
| Parameter | Type | Description |
|---|---|---|
| assistantIds | string[] | Assistant modelIds from GET /v2.0/assistants, up to 10 per call. Leave out to only create the tool |
| name | string | The tool name the assistant sees: lowercase letters, digits and _. Default: made from the flow name, such as book_a_store_visit. Used only when the tool is first created |
| description | string | When the assistant should call it. Default: the flow's description. Used only when the tool is first created |
curl -X POST "https://api.sendiee.com/v2.0/flows/6741a2b39d2b4e0011ac1102/connect" \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"assistantIds": ["kQ8z3cR7hV2bWa"],
"description": "Book a visit to the Kesari Loom store when a customer wants to see sarees in person."
}'{
"success": true,
"data": {
"tool": {
"_id": "6741b4c19d2b4e0011ac2201",
"toolId": "Bv7Kq2Lm9XzR4t",
"name": "book_a_store_visit",
"created": true
},
"assistants": [
{
"modelId": "kQ8z3cR7hV2bWa",
"name": "Kesari helper",
"added": true
}
]
}
}Connect Result
| Parameter | Type | Description |
|---|---|---|
| tool._id | string | The tool's id. Disconnect takes it as toolId. Get a flow lists it in assistantTools[].id |
| tool.toolId | string | The tool's short id |
| tool.name | string | The name the assistant sees |
| tool.created | boolean | true when the tool was made by this call |
| assistants | array | [{ modelId, name, added }]. added is false when the assistant already had the tool |
Errors
422 NOT_AI_TOOL: only a flow with theai_tooltrigger can be given to an assistant.403 LIMIT_EXCEEDED: the tool would be new and your plan’s tools are all in use. Remove a tool or upgrade. Reusing an existing tool does not count again.404 ASSISTANT_NOT_FOUND: one of theassistantIdsis not an assistant on this account. Nothing is changed.400 BAD_ASSISTANT_IDS:assistantIdsis not a list.404 NOT_FOUND: no flow with that id.
Take a Flow Off Assistants
With assistantIds, takes the flow’s tool off those assistants only and keeps it. Without, takes it off every assistant and deletes the tool, which frees a place in your plan’s tool limit. The flow itself stays. Scope flows:write.
Disconnect Body
| Parameter | Type | Description |
|---|---|---|
| toolId | string | The tool's id: assistantTools[].id from Get a flow, or tool._id from Connect |
| assistantIds | string[] | Assistant modelIds to take it off. Leave out to remove the tool entirely |
# Take it off one assistant, keep the tool
curl -X POST "https://api.sendiee.com/v2.0/flows/6741a2b39d2b4e0011ac1102/disconnect" \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{ "toolId": "6741b4c19d2b4e0011ac2201", "assistantIds": ["kQ8z3cR7hV2bWa"] }'
# Remove the tool from every assistant and delete it
curl -X POST "https://api.sendiee.com/v2.0/flows/6741a2b39d2b4e0011ac1102/disconnect" \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{ "toolId": "6741b4c19d2b4e0011ac2201" }'{
"success": true,
"data": {
"removed": false,
"takenFrom": 1
}
}{
"success": true,
"data": {
"removed": true
}
}400 BAD_TOOL_ID:toolIdis missing or not a valid id.400 BAD_ASSISTANT_IDS:assistantIdsis not a list.404 NOT_FOUND: that tool does not run this flow.
The assistant test chat runs practice runs
When you chat with an assistant in its test chat in the dashboard, the flows it calls run as practice runs. Steps that only read (a sheet lookup, a calendar check, a GET request) run for real, so the answers are real. Steps that send, write or charge are pretended: no message goes out, no row is added, no slot is booked, no payment link is made.
- Practice runs do not count toward your monthly flow runs.
- They share the limit of 60 test runs an hour per account. Over it, the assistant is told the flow was not run.
- They appear in run history with
mode: "dry"andstartedBy: "preview".
To check a flow on its own, without an assistant, use Test a flow.