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
| Category | Examples |
|---|---|
| Banking | check_balance, reconcile_account |
| Payments | execute_payment, create_standing_order |
| Investment | calculate_var, rebalance_portfolio |
| Compliance | run_aml_check, flag_suspicious_transaction |
| Knowledge | search_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.