Tin

Examples · learn/21-concurrency · 249 of 339

budget

examples/learn/21-concurrency/budget.tintin run examples/learn/21-concurrency/budget.tin
agent 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")
  }
}