Watch
0
0
Fork
You've already forked hyperhive
0

swarm: set the fresh-session threshold per agent

This commit is contained in:
iris 2026-11-16 10:50:13 +01:00
commit 5175d3663e

View file

@ -42,6 +42,13 @@ pub struct InferenceSettings {
/// Absent keeps the harness's own watermark.
#[serde(default, skip_serializing_if = "Option::is_none")]
pub soft_context_percent: Option<u8>,
/// The percent of the model's context window above which a turn that finds
/// the prompt cache cold starts a fresh session instead of resuming, in the
/// same range as `soft_context_percent` and not above it when both are set
/// (the agent compacts at the soft limit, so the context would never reach a
/// higher threshold). Absent keeps the harness's own half.
#[serde(default, skip_serializing_if = "Option::is_none")]
pub fresh_session_percent: Option<u8>,
}
/// What `GET` answers for one agent.
@ -87,8 +94,9 @@ mod tests {
subagent_models: Some(vec!["haiku".to_owned()]),
max_subagents: Some(3),
soft_context_percent: Some(20),
fresh_session_percent: Some(10),
},
r#"{"model":"opus","effort":"xhigh","subagent_models":["haiku"],"max_subagents":3,"soft_context_percent":20}"#,
r#"{"model":"opus","effort":"xhigh","subagent_models":["haiku"],"max_subagents":3,"soft_context_percent":20,"fresh_session_percent":10}"#,
),
] {
assert_eq!(serde_json::to_string(&value).unwrap(), wire);