Building
Defining tools
Give an agent typed, permissioned access to your data and services.
A tool is a typed, permissioned function. Register it once and every agent can call it, traced automatically.
import { defineTool, z } from '@trace/runtime';
export const refund = defineTool({
name: 'issue_refund',
scope: ['billing:write'],
input: z.object({ id: z.string(), amount: z.number() }),
run: async ({ id, amount }) => stripe.refunds.create({ payment_intent: id, amount }),
});
Scopes
Scopes are how you keep agents inside the lines. A tool with billing:write can only be called by an agent granted that scope, and the grant shows up in the trace.