Examples · learn/21-concurrency · 249 of 339
budget
tin run examples/learn/21-concurrency/budget.tinagent Fast { model: "mock" }
fn main() {
// give an agent call a time budget; the answer is an Option
match spawn Fast.ask("summarise this") |> within(2s) {
Some(text) => print(text)
None => print("too slow, using the cached summary")
}
}