Examples · learn/16-tools · 215 of 339
events
tin run examples/learn/16-tools/events.tin/// Add two integers.
tool fn add(a: int, b: int): int => a + b
/// Multiply two integers.
tool fn times(a: int, b: int): int => a * b
agent Calculator {
model: "mock"
tools: [add, times]
// handlers run while the agent loop runs
on toolCall(name, input) => print(" call {name} {input}")
on toolResult(name, output, ok) => print(" result {name}: {output}")
}
fn main() {
print(Calculator("times 6 and 7"))
}