Skip to content

Tool approval

Arivie exposes a configurable tool-approval policy through ArivieConfig.limits.requireToolApproval. When a policy is active, the agent pauses before calling a gated tool and emits a suspension that the host app can resolve.

  • Destructive SQL — require human confirmation before any execute_<source> call in production.
  • Regulated environments — gate all tool calls by default, then explicitly allow safe tools like compile_metric.
  • Per-user policies — vary approval by user role or permissions.
import { defineArivie } from "@arivie/core";
defineArivie({
// ...
limits: {
// Gate every tool call
requireToolApproval: true,
// Gate only these tools
requireToolApproval: {
tools: ["execute_postgres", "mastra_workspace_write_file"],
},
// Gate everything except safe tools
requireToolApproval: {
exceptTools: ["compile_metric"],
},
// Custom predicate: (toolName, args, requestContext?) => boolean
requireToolApproval: (toolName, _args) => {
if (toolName === "compile_metric") return false;
return toolName.startsWith("execute_");
},
},
});

The function form receives the tool name, its arguments, and an optional request context, so you can vary policy by role, environment, or request metadata.

Arivie forwards the policy to Mastra’s native requireToolApproval option on the Agent. When the agent hits a gated tool, Mastra emits a suspension that the host app resolves by approving or denying the call. See the Mastra tool suspension docs for the exact runtime shape.

The limits config also enforces hard ceilings:

FieldEffect
rowsPerQueryMax rows returned per execute_<source> call
queryTimeoutMsSQL statement timeout
tokensPerRequestMax tokens per agent turn
tokensPerUserPerMonthMonthly token budget per user
maxStepsMax agent steps per turn

These are enforced inside @arivie/agent tools, not advisory.