Tin

Examples · learn/16-tools · 217 of 339

first-tool

examples/learn/16-tools/first-tool.tintin run examples/learn/16-tools/first-tool.tin
/// Add two integers.
tool fn add(a: int, b: int): int => a + b

agent Calculator {
  model: "mock"
  system: "Use the tools for every calculation."
  tools: [add]
}

fn main() {
  print(add(2, 3))                       // a tool fn is still an ordinary function
  print(Calculator("please add 19 and 23"))
}