Action Execution (Tools)

Actions are the core of Voxide. By registering a function, you give the AI "hands" to manipulate your web application.

#The Anatomy of an Action

Every action requires a unique name, a clear description (which the AI reads), parameter definitions, and a handler function.

typescript
ai.register({
toggleTheme: {
description: "Switch the website theme between dark and light mode.",
params: { mode: { type: "string", required: true } },
handler: ({ mode }) => {
setTheme(mode);
return { status: "success" };
}
}
});
Dangerous Actions
If an action modifies a database or costs money, add dangerous: true. The SDK will automatically pause execution and prompt the user to click "Confirm" in the widget UI before running the handler.