Examples · learn/19-capabilities · 239 of 339
reach.caps
run: --reach charge
tin run examples/learn/19-capabilities/reach.caps.tin// run: --reach charge
/// Look up a price, in cents.
tool fn price(item: string): int => 300
/// Charge a card. A person approves every charge.
guarded tool fn charge(card: string, cents: int): string => "charged {cents} to {card}"
agent Menu { model: "mock", tools: [price] }
agent Till {
model: "mock"
tools: [Menu, charge]
on toolCall(name, input) => print(" {name} {input}")
}
fn main() {
print(Menu("price of 'tea'"))
print(Till("charge 'visa' 300"))
}