feat(agents): add per-agent stream params overrides for cache tuning (#17470) (thanks @rrenamed)

This commit is contained in:
Peter Steinberger
2026-02-23 18:19:08 +00:00
parent be6f0b8c84
commit 160bd61fff
5 changed files with 91 additions and 1 deletions

View File

@@ -61,6 +61,79 @@ describe("resolveExtraParams", () => {
expect(result).toBeUndefined();
});
it("returns per-agent params when agentId matches", () => {
const result = resolveExtraParams({
cfg: {
agents: {
list: [
{
id: "risk-reviewer",
params: { cacheRetention: "none" },
},
],
},
},
provider: "anthropic",
modelId: "claude-opus-4-6",
agentId: "risk-reviewer",
});
expect(result).toEqual({ cacheRetention: "none" });
});
it("merges per-agent params over global model defaults", () => {
const result = resolveExtraParams({
cfg: {
agents: {
defaults: {
models: {
"anthropic/claude-opus-4-6": {
params: {
temperature: 0.5,
cacheRetention: "long",
},
},
},
},
list: [
{
id: "risk-reviewer",
params: { cacheRetention: "none" },
},
],
},
},
provider: "anthropic",
modelId: "claude-opus-4-6",
agentId: "risk-reviewer",
});
expect(result).toEqual({
temperature: 0.5,
cacheRetention: "none",
});
});
it("ignores per-agent params when agentId does not match", () => {
const result = resolveExtraParams({
cfg: {
agents: {
list: [
{
id: "risk-reviewer",
params: { cacheRetention: "none" },
},
],
},
},
provider: "anthropic",
modelId: "claude-opus-4-6",
agentId: "main",
});
expect(result).toBeUndefined();
});
});
describe("applyExtraParamsToAgent", () => {