pub fn pick(
agents: &[AgentSpec],
want: Option<&str>,
available: &dyn Fn(&AgentSpec) -> bool,
) -> Result<AgentSpec>Expand description
Choose the agent that will conduct the interview.
available is a parameter rather than a call to which so the order
below is assertable on a machine with none of these CLIs installed, which is
every CI runner.
The order, and why:
- An explicit
--agentalways wins, and is an error rather than a fallback when it is unusable. The operator naming a leader has a reason, and silently interviewing them with a different model would waste the conversation. - Otherwise a
AgentKind::Claudeseat, ahead of the roster order. It is the only one of the three CLIs magi can address before the first turn (seecrate::agent’s session table), so it is the only one that can be handed the briefing as an argument and come up already knowing what the interview is for - with the others the operator has to point them at the briefing themselves. For the one command whose whole value is a smooth conversation, that difference decides it. - Otherwise the first runnable agent in roster order, because the roster order is the operator’s own stated preference and magi has nothing better to go on.