cleanup: remove model name string matching

model_context_window() now reads from config.api_context_window
instead of guessing from model name strings. is_anthropic_model()
replaced with backend == "anthropic" checks. Dead model field
removed from AgentDef/AgentHeader.

Co-Authored-By: Proof of Concept <poc@bcachefs.org>
This commit is contained in:
Kent Overstreet 2026-04-02 14:09:54 -04:00
parent 47c6694b10
commit 078dcf22d0
5 changed files with 15 additions and 32 deletions

View file

@ -39,7 +39,6 @@ pub struct AgentDef {
/// Steps — single-step agents have one entry, multi-step have several.
/// Steps are separated by `=== PROMPT ===` in the .agent file.
pub steps: Vec<AgentStep>,
pub model: String,
pub schedule: String,
pub tools: Vec<String>,
pub count: Option<usize>,
@ -60,8 +59,6 @@ struct AgentHeader {
agent: String,
#[serde(default)]
query: String,
#[serde(default = "default_model")]
model: String,
#[serde(default)]
schedule: String,
#[serde(default)]
@ -87,7 +84,6 @@ struct AgentHeader {
bail: Option<String>,
}
fn default_model() -> String { "sonnet".into() }
fn default_priority() -> i32 { 10 }
/// Parse an agent file: first line is JSON config, rest is the prompt(s).
@ -149,7 +145,6 @@ fn parse_agent_file(content: &str) -> Option<AgentDef> {
agent: header.agent,
query: header.query,
steps,
model: header.model,
schedule: header.schedule,
tools: header.tools,
count: header.count,

View file

@ -340,8 +340,8 @@ fn run_one_agent_inner(
};
let phases: Vec<&str> = agent_batch.steps.iter().map(|s| s.phase.as_str()).collect();
log(&format!("{} step(s) {:?}, {}KB initial, model={}, {}, {} nodes, output={}",
n_steps, phases, first_len / 1024, def.model, tools_desc,
log(&format!("{} step(s) {:?}, {}KB initial, {}, {} nodes, output={}",
n_steps, phases, first_len / 1024, tools_desc,
agent_batch.node_keys.len(), state_dir.display()));
let prompts: Vec<String> = agent_batch.steps.iter()