Step 4 / 5

Give the agent tools

Register functions the model can call.

A tool is a named function with a schema. AgentsKit runs it when the model decides to.

import { defineTool } from '@agentskit/tools'

export const getWeather = defineTool({
  name: 'get_weather',
  description: 'Get current weather for a city',
  schema: { city: 'string' },
  async execute({ city }) { return { city, tempC: 22 } },
})
Try it live
Loading playground…