Counters
Dynamic counters are named integer values that an agent can use as short-term memory or to trigger actions such as call transfers. They are shared across all sub-agents that participate in a conversation and are implicitly initialized to 0 (zero), so the first increment_counter call sets the corresponding counter to 1.
For each tool, the Tool schema table describes the tool as it is exposed to the LLM. Where applicable, the Tool parameters table describes the optional parameters you can configure when adding the tool in the agent's Tools tab.
increment_counter
Increments a dynamic counter by 1 and returns the values of all dynamic counters.
Tool schema
Parameters the tool exposes to the LLM.
| Parameter | Type | Description |
|---|---|---|
counter_name
|
string | Name of the counter to increment. |
Tool parameters
Optional parameters you can configure when adding the tool in the agent's Tools tab.
| Parameter | Description |
|---|---|
| Counter name | Fixes the counter this tool increments, removing the need for the LLM to specify counter_name. |
The Counter name parameter is often combined with a custom tool name and description, for example:
Counter name: uncategorized
Custom tool name: uncategorized_intent
Custom tool description: Count number of uncategorized user intents.
Counters can also trigger a call transfer once they reach a threshold, via the increment_counter_call_transfer advanced configuration parameter.
Sample prompt
If user question does not belong to any known category,
increment dynamic counter "error_count".
set_counter
Sets a dynamic counter to a specific value.
Tool schema
Parameters the tool exposes to the LLM.
| Parameter | Type | Description |
|---|---|---|
counter_name
|
string | Name of the counter to set. |
value
|
integer | Value to set the counter to. |
Sample prompt
If user says that he is ready to wait, set the dynamic
counter "retry_counter" to 3.
get_counters
Returns the values of all dynamic counters. This tool takes no parameters.
Note: In most cases this tool is not needed, because the increment_counter and set_counter tools already return the values of all dynamic counters.