Skip to content

CREATORS-INDUSTRIES/driver-node

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

@crtrs/driver

Node client for Driver.

npm i @crtrs/driver
const { Driver } = require('@crtrs/driver');

const driver = new Driver({ apiKey: 'dr_...' }); // or DRIVER_API_KEY

driver.on('action', (ev) => console.log(ev.tool));

const done = await driver.run('what is https://creators.industries about?');
console.log(done.result);

Events: plan, plan_item_start, action, done, fatal. Types in index.d.ts.

Tools

Register local tools the agent can call. The agent runs in the cloud, but the tool runs on your machine — when the agent needs it, the client runs your function locally and sends the result back, then the run continues.

const { Driver, defineTool } = require('@crtrs/driver');

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'" }, // type inferred when omitted
  ],
  call: (city = '', units = 'celsius') => fetchWeather(city, units),
});

const driver = new Driver({ tools: [weather] });
const done = await driver.run('what should I wear in Barcelona today?');

params order is the positional arg order passed to call; type is inferred from the call signature when omitted. Subclass Tool instead of defineTool for full control. See examples/tool.js.

MIT

About

Node.js library for the Driver API.

Resources

License

Stars

0 stars

Watchers

0 watching

Forks

Releases

No releases published

Packages

 
 
 

Contributors