Your functions, callable by the agent. The agent runs in the cloud; the tool runs on your machine, with your network and your keys.
const { Driver, defineTool } = require('@crtrs/driver');
// Runs LOCALLY when the agent calls it: your network, your keys, your data.
const weather = defineTool({
name: 'get_weather',
description: 'Get the current weather for a city.',
params: [
{ name: 'city', description: "city name, e.g. 'Barcelona'" },
{ name: 'units', type: 'string', description: "'celsius' or 'fahrenheit'" },
],
call: (city = '', units = 'celsius') => fetchWeather(city, units),
});
const driver = new Driver({ tools: [weather] }); // reads DRIVER_API_KEY
const done = await driver.run('what should I wear in Barcelona today?');
console.log(done.result);How it works: when the agent calls your tool, the run parks, a tool_request arrives, the SDK runs your function and replies, and the run resumes. The cloud only sees what you return. params order is the positional arg order of call; type is inferred when omitted. Throwing fails that call, not the run: the failure is handed back to the agent to react to. Tools have 120 seconds to reply.