Examples · learn/20-teams · 245 of 339
sub-agent
tin run examples/learn/20-teams/sub-agent.tin/// Look up the population of a city, in millions.
tool fn population(city: string): int => match city {
"Istanbul" => 16
"Tokyo" => 14
_ => 1
}
/// Knows facts about cities. Ask it one question at a time.
agent Researcher { model: "mock", tools: [population] }
agent Lead {
model: "mock"
system: "Delegate fact-finding to the Researcher."
tools: [Researcher] // an agent can be another agent's tool
on toolCall(name, input) => print(" {name} {input}")
}
fn main() {
print(Lead("ask the Researcher for the population of 'Istanbul'"))
}