#[derive(Debug, Clone)]
pub(super) struct AgentSlot {
pub name: String,
pub provider_id: String,
pub model_name: String,
pub input_price: Option<f64>,
pub output_price: Option<f64>,
pub temperature: f32,
pub max_tokens: i32,
pub presence_penalty: f32,
pub persona: Option<String>,
pub context_window: Option<i32>,
pub reasoning_effort: Option<String>,
pub use_streaming: Option<bool>,
pub merge_system_prompt: Option<bool>,
pub unwrap_hallucinated_tool_calls: Option<bool>,
pub repair_invalid_escapes: Option<bool>,
pub json_mode: Option<bool>,
pub disable_native_tools: Option<bool>,
pub scratchpad_limit: Option<i32>,
pub capability_tags: Vec<String>,
pub description: Option<String>,
pub exec_command: Option<Vec<String>>,
}
impl AgentSlot {
pub(super) fn new(
name: String,
provider_id: String,
model_name: String,
input_price: Option<f64>,
output_price: Option<f64>,
) -> Self {
Self {
name,
provider_id,
model_name,
input_price,
output_price,
temperature: 0.7,
max_tokens: 4096,
presence_penalty: 1.5,
persona: None,
context_window: None,
reasoning_effort: None,
use_streaming: None,
merge_system_prompt: None,
unwrap_hallucinated_tool_calls: None,
repair_invalid_escapes: None,
json_mode: None,
disable_native_tools: None,
scratchpad_limit: None,
capability_tags: vec![],
description: None,
exec_command: None,
}
}
pub(super) fn apply_preset(&mut self) {
if let Some(preset) = PRESET_CONFIGS.iter().find(|p| p.name == self.name) {
self.persona = Some(preset.persona.to_string());
self.temperature = preset.temperature;
self.max_tokens = preset.max_tokens;
if let Some(cw) = preset.context_window {
self.context_window = Some(cw);
}
if let Some(re) = preset.reasoning_effort {
self.reasoning_effort = Some(re.to_string());
}
self.use_streaming = preset.use_streaming;
self.merge_system_prompt = preset.merge_system_prompt;
self.unwrap_hallucinated_tool_calls = preset.unwrap_hallucinated_tool_calls;
self.repair_invalid_escapes = preset.repair_invalid_escapes;
self.json_mode = preset.json_mode;
self.disable_native_tools = preset.disable_native_tools;
self.scratchpad_limit = preset.scratchpad_limit;
if !preset.capability_tags.is_empty() {
self.capability_tags = preset
.capability_tags
.iter()
.map(|s| (*s).to_string())
.collect();
}
if let Some(desc) = preset.description {
self.description = Some(desc.to_string());
}
}
}
}
pub(super) struct PresetConfig {
pub name: &'static str,
pub persona: &'static str,
pub temperature: f32,
pub max_tokens: i32,
pub context_window: Option<i32>,
pub reasoning_effort: Option<&'static str>,
pub use_streaming: Option<bool>,
pub merge_system_prompt: Option<bool>,
pub unwrap_hallucinated_tool_calls: Option<bool>,
pub repair_invalid_escapes: Option<bool>,
pub json_mode: Option<bool>,
pub disable_native_tools: Option<bool>,
pub scratchpad_limit: Option<i32>,
pub capability_tags: &'static [&'static str],
pub description: Option<&'static str>,
}
#[allow(clippy::too_many_arguments)]
pub(super) const fn default_preset(
name: &'static str,
persona: &'static str,
temperature: f32,
max_tokens: i32,
context_window: Option<i32>,
reasoning_effort: Option<&'static str>,
capability_tags: &'static [&'static str],
description: Option<&'static str>,
) -> PresetConfig {
PresetConfig {
name,
persona,
temperature,
max_tokens,
context_window,
reasoning_effort,
use_streaming: None,
merge_system_prompt: None,
unwrap_hallucinated_tool_calls: None,
repair_invalid_escapes: None,
json_mode: None,
disable_native_tools: None,
scratchpad_limit: None,
capability_tags,
description,
}
}
pub(super) const PRESET_CONFIGS: &[PresetConfig] = &[
default_preset(
"DEFAULT",
"You are a helpful, accurate, and thorough AI assistant. You answer user queries clearly and honestly. You critically evaluate requests before responding and double-check your reasoning for potential errors.",
0.7,
8096,
Some(131072),
Some("medium"),
&["general", "reasoning"],
Some("General-purpose helpful assistant"),
),
default_preset(
"REASON",
"You are a structured reasoning specialist. You break complex problems into logical steps, identify assumptions, and build rigorous arguments. You excel at analysis, planning, and decision-making under uncertainty.",
0.7,
12096,
Some(202800),
None,
&["reasoning", "analysis"],
Some("Structured reasoning & logical analysis"),
),
default_preset(
"CREATE",
"You are a creative problem-solver and generalist writer. You excel at brainstorming, drafting content, synthesizing information from multiple domains, and presenting ideas clearly. You balance thoroughness with conciseness.",
0.7,
12096,
Some(262144),
None,
&["creative", "writing"],
Some("Creative writing & brainstorming"),
),
default_preset(
"VERIFY",
"You are a detail-oriented fact-checker and quality reviewer. You verify claims, catch logical errors, ensure consistency, and stress-test arguments. You are the last line of defense before a final answer is delivered.",
0.5,
12096,
Some(131072),
None,
&["verification", "quality"],
Some("Fact-checking & quality review"),
),
];
#[allow(dead_code)]
pub(super) struct AgentPreset {
pub name: &'static str,
pub desc: &'static str,
pub ensemble: &'static str,
}
pub(super) const AGENT_PRESETS: &[AgentPreset] = &[
AgentPreset {
name: "DEFAULT",
desc: "general-purpose helpful assistant",
ensemble: "General",
},
AgentPreset {
name: "REASON",
desc: "structured reasoning & logical analysis",
ensemble: "General",
},
AgentPreset {
name: "CREATE",
desc: "creative writing & brainstorming",
ensemble: "General",
},
AgentPreset {
name: "VERIFY",
desc: "fact-checking & quality review",
ensemble: "General",
},
];
pub(super) const TESTED_MODELS: &[&str] = &[
"openai/gpt-oss-120b",
"moonshotai/Kimi-K2.5",
"Qwen/Qwen3-Coder-Next-FP8",
"essentialai/rnj-1-instruct",
"mistralai/Mistral-Small-24B-Instruct-2501",
"MiniMaxAI/MiniMax-M2.5",
"Qwen/Qwen3-Next-80B-A3B-Thinking",
"zai-org/GLM-4.7",
"meta-llama/Llama-Guard-4-12B",
];
pub(super) fn is_tested_model(id: &str) -> bool {
TESTED_MODELS.contains(&id)
}
pub(super) fn fmt_price(p: Option<f64>) -> String {
match p {
Some(0.0) => "free".to_string(),
Some(v) => format!("${:.2}", v),
None => "\u{2014}".to_string(),
}
}