Tools

The tool registry and how to add custom tools

Tools

Tools are atomic actions agents can call. Each tool has:

  • Zod-validated input/output
  • A risk level (low, medium, high, critical)
  • Audit records with duration and payloads

Sample categories

CategoryExamples
Bankingcheck_balance, reconcile_account
Paymentsexecute_payment, create_standing_order
Investmentcalculate_var, rebalance_portfolio
Compliancerun_aml_check, flag_suspicious_transaction
Knowledgesearch_web, read_url

Add a custom tool

import { tool } from 'ai'
import { z } from 'zod'

export const myCustomTool = {
  id: 'my_custom_tool',
  riskLevel: 'low',
  tool: tool({
    description: 'Example custom tool',
    parameters: z.object({ input: z.string() }),
    execute: async ({ input }) => ({ ok: true, input }),
  }),
}

Register it in packages/ai/src/tools/registry.ts and include the ID in the ToolId union.