ai-agent 0.13.4

Idiomatic agent sdk inspired by the claude code source leak
Documentation
//! Status notice helper utilities.

use crate::utils::token_estimation::rough_token_count_estimation;

pub const AGENT_DESCRIPTIONS_THRESHOLD: u32 = 15_000;

/// Calculate cumulative token estimate for agent descriptions
pub fn get_agent_descriptions_total_tokens(
    active_agents: &[crate::tools::agent::AgentDefinition],
) -> u32 {
    if active_agents.is_empty() {
        return 0;
    }

    active_agents
        .iter()
        .filter(|a| a.source != "built-in")
        .map(|agent| {
            let description = format!("{}: {}", agent.agent_type, agent.when_to_use);
            rough_token_count_estimation(&description) as u32
        })
        .sum()
}