03 — Tools: side effects
3.1 Two kinds of tools
A tool's Tool trigger picks its kind:
- Agent decided (
options.llm_toolsentries): the agent chooses when to run them, like any LLM tool.{name, description, parameters, conditions, fulfillment: {<actions>}}—nameis the function name,descriptiontells the agent when to call it,parameters(Parameters) are JSON-schema properties the agent fills (their values become state variables), and the nestedfulfillmentmap holds the actions to run. - On an event (
fulfillmentarray entries): the engine fires them when the entry'stimingevent occurs and itsconditionshold.{timing, conditions, <action keys>}— action keys sit at the entry's top level.
A fulfillment entry whose only action is trigger is not a tool — it's an event transition (01-flow §1.6). An entry can combine trigger with other actions; it then acts as both.
"options": { "llm_tools": [{
"name": "check_wait_time", "description": "the contact asks how long the wait is",
"fulfillment": { "webhook": { "url": "https://api.example.com/wait" } }
}]}
3.2 Event timings
The timing values:
| Timing | Builder label | Fires when |
|---|---|---|
triggered | Goal triggered | the goal becomes the active goal (any start reason) |
triggered_once | Goal triggered (first time only) | like triggered, but only the first time ever |
performed | Goal attempted | the agent actually said the goal's message |
collected | Field is collected | an answer was collected for the goal (actively or passively) |
completed | Goal complete | the goal completes — never fires for a goal the flow stopped unfinished (01-flow §1.5) — the default when timing is absent |
Entries are evaluated in array order; for next-goal overrides the last one wins (01-flow §1.6). Some configs carry other timing values the builder UI doesn't edit — preserve them, and author with the five above (lookups/non-ui-fields.md).
The builder offers a goal only the timings that can fire for its shape, under the same labels for event tools and event transitions — author to the same rules:
collectedneeds avalue_type; on a choice it is labelled Choice selected and is the choice's natural default (02-dialogue §2.5).performedneedsmessages; a choice or container is never performed.triggered/triggered_oncenever apply to a choice (it is picked, not started).triggered_onceis also withheld from containers and hot-transfer goals: the engine re-enters a container on every goal scan, and the hot transfer is uninterruptible, so neither fires exactly once.completedis withheld from hot-transfer goals: its repeating hold sub-goal never completes, so the parent never does. Hang transfer follow-ups onperformed.
3.3 Actions
Any entry (event- or agent-based) may carry several actions; each key below is one action.
-
values— set state: a map of key → value written into call state, overwriting collected answers by goal name (an empty value clears and re-opens the goal). Both keys and values accept placeholders, including%self%/%parent%.values_silentis the same without triggering an acknowledgement.{ "timing": "collected", "values": { "stage": "qualified", "budget_usd": "{budget}" } }Gotcha: values apply to any goal with that name — duplicate names share one slot.
-
trigger— jump: start the named goal (falls back to matching a trigger phrase if no goal has the name; eligibility still applies). Use only when the target is not simply next in the flow. The special value%abort_goal%cancels the current goal instead of jumping. -
webhook(Call a webhook) — call your endpoint and act on the reply:- Request:
url(placeholders allowed),method(defaultPOST),body(map; placeholders; when omitted, POSTs the full call state — every variable and collected answer, plusgoal_name,goal_value,timing),headers,params,timeout(s, default 3),max_attempts(default 3, retried on 500s only). - Response: a JSON object whose keys are applied as actions —
values/values_silentwrite state,triggerjumps to a goal ("%abort_goal%"cancels the current one),acknowledge/exclusive_message/uxadjust the turn. Requests to private/internal addresses are blocked. mapping: use it when the endpoint doesn't reply in that action shape. It is a template for the action object: its keys are action keys (values,trigger, …) nested the way the action needs them, and each string leaf is a dot path into the reply ("$"takes the whole reply). The applied actions become only what the template builds; unmapped reply keys are dropped.
{ "timing": "completed", "webhook": { "url": "https://api.example.com/leads/{chat_id}" } }{"timing": "triggered","webhook": {"url": "https://api.example.com/abilities","method": "GET","mapping": { "values": { "abilities_count": "count", "first_ability": "results.0.name" } }}}Sets the
abilities_countvariable from the reply'scount. Gotcha:{ "count": "abilities_count" }is backwards and missingvalues; it builds an action namedcountand writes nothing.Gotcha: a slow endpoint stalls the turn — keep handlers fast or fire-and-forget.
- Request:
-
text_message(aliassms, Send a text message) — send an SMS:message(required, placeholders allowed);phone_number_fieldpicks which state field holds the target number (defaultphone= the contact);to_numberhard-codes a target (alerts to a fixed number);from_numberoverrides the sender (defaults to the agent's number).{ "timing": "collected", "text_message": { "message": "Hi {contact_name}, here's the link: {link}" } } -
voice_action— call control:hang_up(after the agent finishes speaking — the normal way to end),hang_up_immediately(cuts off speech; rare),speech_slow_down/speech_speed_up/speech_normal,speech_volume_up/speech_volume_down. -
call_result(Set contact state) — set the call outcome (§3.4). Usually paired withvoice_actionon the closing goal. -
Transfer —
new_call(hot transfer/merge) andforward_call(blind forward): full contract inflows/hot-transfer.md. -
CRM (e.g.
hubspot) — push collected values to the connected CRM; fields per integration.
"fulfillment": [
{ "timing": "performed", "voice_action": "hang_up", "call_result": "disqualified" }
]
3.4 Call results
A script may set exactly these four values:
| Value | Meaning | Effect |
|---|---|---|
qualified | contact matches the business requirement | usually set mid-call on the qualifying answer |
converted | contact completed the objective (booked, agreed, transferred) | ends the campaign for this contact as a success |
disqualified | contact doesn't fit | contact will not be attempted again |
do_not_call | contact asked not to be called | end the call and remove from the call list |
Set a result on every path that ends the call deliberately; an unset result leaves the contact eligible for retry per campaign rules.
The system assigns further values on its own (voicemail, ivr, no_answer, busy, wrong_number, contact_verified, callback_requested, …) — you may read them via %call_result% in conditions, but never set them.