Skip to main content

🤖 AI tools

Tags: Android

What are AI tools?

AI tools allow you to create deep integrations between your app / website and Kai (our AI bot). A few use-cases might include:

  • A banking app allowing to initiate transactions
  • Performing a password reset directly in the messenger
  • Canceling orders
  • ...

The possibilities are almost endless. The following example shows how to add a new AI tool allowing users to initiate bank transactions directly inside Kai.

Ticket custom data

Specify AI tools

// Creating parameters
GleapAiToolParameter amountParameter = new GleapAiToolParameter(
"The amount of money to send. Must be positive and provided by the user.",

String[] possibleEnumValues = {"Alice", "Bob"};

GleapAiToolParameter contactParameter = new GleapAiToolParameter(
"The contact to send money to.",

GleapAiToolParameter[] params = {amountParameter, contactParameter};

// Creating the AI tool with the parameters
GleapAiTool transactionTool = new GleapAiTool(
"Send money to a given contact.",
"The transfer got initiated but not completed yet. The user must confirm the transfer in the banking app.",

GleapAiTool[] tools = {transactionTool};

// Set the available tools using the static method

Perform actions

Implement the setAiToolExecutedCallback callback to get notified when a tool should be executed.

Gleap.getInstance().setAiToolExecutedCallback(new AiToolExecutedCallback() {
public void aiToolExecuted(JSONObject jsonObject) {
try {
String toolName = jsonObject.getString("name");
JSONObject params = jsonObject.getJSONObject("params");

// {"name":"send-money","params":{"amount":"20","contact":"alice"}}
} catch (JSONException e) {
throw new RuntimeException(e);