Tin

Examples · learn/23-replay · 265 of 339

regression.test

run: --replay tests/tapes/agents-05-claude.json

examples/learn/23-replay/regression.test.tintin run examples/learn/23-replay/regression.test.tin
// run: --replay tests/tapes/agents-05-claude.json
/// Add two integers and return the sum.
tool fn add(a: int, b: int): int => a + b

/// Multiply two integers and return the product.
tool fn multiply(a: int, b: int): int => a * b

agent Calculator {
  system: "You are a calculator. Use the tools for all arithmetic. Reply with just the number."
  tools: [add, multiply]
  on toolCall(name, input) => print("  call {name} {input}")
}

test "the calculator still uses its tools" {
  let answer: int = Calculator("What is (17 + 25) * 3?")
  assertEq(answer, 126)
  assert(Calculator.turns() >= 1)
}