Frontend tools let your AI agent execute actions directly inside your app — initiating a transfer, resetting a password, cancelling an order, etc.
Define the tool under AI agents → your agent → Settings → Tools → Add tool → Frontend tool. Its name, description, parameters and execution mode live there. Your app registers the matching runtime handler. See the linked help guide for the current setup. Frontend tools setup guide
Register a tool handler
Register the handler for a dashboard-defined Frontend tool. Use the tool's runtime name shown in the tool editor.
Gleap.RegisterAgentTool("send-money", async parameters =>
{
var amount = parameters["amount"];
var contact = parameters["contact"];
// Run your own logic here.
await BankingService.InitiateTransferAsync(amount, contact);
// Return a string or any JSON-serializable object — the AI waits for this response.
return "The transfer was initiated. The user must confirm it in the banking app.";
});Handler contract
The handler receives the parameters configured in the dashboard, filled with the values the AI collected. Values arrive as plain CLR types (
string,long,double,bool, nestedIReadOnlyDictionary/IReadOnlyList, ornull).Return a string, or any JSON-serializable object (objects are serialized to JSON). The result is sent back to the AI, which uses it to reply.
Async handlers are fully supported — the handler returns
Task<object?>, and the AI waits for it. For a synchronous handler, returnTask.FromResult<object?>(result).Exceptions thrown by the handler are caught and reported to the AI automatically.
If no handler is registered for a tool, the AI is informed so it can respond accordingly.
Execution modes
Set per tool in the dashboard:
Auto— the handler runs immediately when the AI calls the tool.Ask before final execution— the AI adds a confirmation button to its reply; the handler only runs after the user confirms.
Migrating from SetAiTools
Gleap.SetAiTools(...) and the AITool / AIToolParameter types have been removed. Tools declared via SetAiTools could only return a static response to the AI — Frontend tools execute real code and return live results. Define your tools on the AI agent in the dashboard and register their handlers via Gleap.RegisterAgentTool(name, handler) instead.

