Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .abs/main.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,4 @@ replace-chart-version-with-git: true
generate-metadata: true
chart-dir: ./helm/agent
destination: ./build
helm-template-extra-values: [./helm/agent/ci/ci-values.yaml]
4 changes: 2 additions & 2 deletions .ats/main.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@
# smoke test_smoke.py: a release with tests/ats/values-smoke.yaml (every
# field the chart maps, a public git skill pinned to a commit)
# reaches Ready and its RemoteMCPServer is accepted; a release
# with the chart's default values reaches Ready with its
# RemoteMCPServer.
# with the chart's default values and the required
# modelConfig.name reaches Ready with its RemoteMCPServer.
# functional test_chat_only.py: toolset ["preset:none"] reaches Ready with no
# RemoteMCPServer. test_fail_fast.py: the readiness wait answers
# in seconds, with the reason, for an Agent whose Harness does
Expand Down
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [Unreleased]

### Changed

- **BREAKING** Chart 3.0: `modelConfig.name` is required and has no default (it was `default-model-config`). The values schema refuses a release without a name, or with one that is not a valid Kubernetes object name. The chart looks nothing up: set `modelConfig.name` before upgrading, to the namespace's default model (the ModelConfig annotated `agent-platform.giantswarm.io/is-default-model-config: "true"`) or another ModelConfig in the agent's namespace. A release that already sets it upgrades unchanged (giantswarm/agent#124).

### Removed

- Chart 2.0: the `kagent.dev/v1alpha3 AgentTemplate` and the admission label `agent-platform.giantswarm.io/harness`. The chart renders one `api.kagent.dev/v1alpha3 Agent` instead (see Changed); `Harness.spec.allowedAgentTemplates` no longer exists in the API, so no label selects a Harness. An upgrade of a 1.x release replaces the `AgentTemplate` with an `Agent` of the same name. The chart installs only on a platform that serves `api.kagent.dev` (kagent-dev/kagent#2952).
Expand Down
6 changes: 3 additions & 3 deletions Makefile.custom.mk
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,11 @@ APPLICATION := agent

.PHONY: helm-lint
helm-lint: ## Lint the chart.
helm lint helm/agent
helm lint helm/agent --values helm/agent/ci/ci-values.yaml

.PHONY: helm-template
helm-template: ## Render the chart with defaults.
helm template agent helm/agent
helm-template: ## Render the chart with defaults and the required modelConfig.name.
helm template agent helm/agent --values helm/agent/ci/ci-values.yaml

# Prerequisite-only, no recipe: make merges it into the generated helm-test
# rule, which keeps its recipe (the helm-unittest run) and gains the lint.
Expand Down
19 changes: 18 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,14 +43,20 @@ It never touches:
becomes Ready;
- **`ModelConfig`** CRs and the `Secret`s they reference (LLM credentials) —
platform-owned, provisioned per tenant namespace. The chart wires the agent
to one **by name** (`modelConfig.name`, default `default-model-config`).
to one **by name** (`modelConfig.name`, required, no default). The
namespace's default model is the ModelConfig annotated
`agent-platform.giantswarm.io/is-default-model-config: "true"`; the chart
looks nothing up, so name it (or another ModelConfig) explicitly.

## Usage

Install with whatever you already use for Helm charts (Argo CD, Flux
`HelmRelease`, `helm install`). A minimal values file yields a working agent:

```yaml
modelConfig:
name: claude-sonnet # a ModelConfig in the agent's namespace; required

agent:
displayName: "SRE Assistant" # Unicode, becomes the ui.giantswarm.io/display-name annotation
description: Helps the SRE team triage incidents.
Expand Down Expand Up @@ -379,6 +385,17 @@ fail with a legible error before anything hits the cluster.
Upgrades are values changes plus a re-apply; uninstalling the release removes
the agent. Pin the chart version for reproducibility.

## Migrating from 2.x

Chart 3.0 drops the default of `modelConfig.name` (it was
`default-model-config`, a ModelConfig installations no longer ship). The value
is required: the values schema refuses a release without it. Set it to the
namespace's default model, the ModelConfig annotated
`agent-platform.giantswarm.io/is-default-model-config: "true"`
(`kubectl get modelconfigs -n <namespace> -o jsonpath='{.items[?(@.metadata.annotations.agent-platform\.giantswarm\.io/is-default-model-config=="true")].metadata.name}'`),
or to any other ModelConfig in the namespace. A release that already sets
`modelConfig.name` upgrades unchanged.

## Migrating from 1.x

Chart 2.0 renders the kagent API that ships the `Agent` kind
Expand Down
4 changes: 2 additions & 2 deletions helm/agent/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@ What an agent can reach and how to add a host (`agent.egress`): [What an agent c
| agent.egressPolicyRefs | list | `[]` | Names of EgressPolicies in the agent's namespace whose origins (and credential headers) the agent may also reach, such as `github` or `go-modules`. Rendered into the Agent's spec.egressPolicyRefs as `{name}` entries; the chart copies none of a policy's rules, so a change to the policy reaches the agent from its next Session without an upgrade of this release. At most 16 unique names. A name with no EgressPolicy in the namespace keeps the Agent from becoming Ready (ResolvedRefs=False). |
| agent.platformPrompt | object | `{"egressNote":false}` | Sections the platform appends to the system prompt, after `systemMessage`. The platform (agent-manager) sets them, not the agent's author: the chart owns their wording, so a chart release updates them on every agent, and an edit of `systemMessage` neither shows nor removes them. |
| agent.platformPrompt.egressNote | bool | `false` | Append the network access note: a `## Network access (set by the platform)` section that names the origins of `egress` and the registries of the toolchains mounted under /opt/kagent/tools, and tells the agent that a request to any other host is refused by policy, not an outage to retry. agent-manager sets it on every agent on a coding Harness (any runtime but kagent's). |
| modelConfig | object | `{"name":"default-model-config"}` | Which platform-provisioned ModelConfig the agent uses, referenced by name. kagent resolves it in the agent's own namespace. The chart never creates or mutates a ModelConfig, and tenants never handle LLM credentials. |
| modelConfig.name | string | `"default-model-config"` | Name of the platform-provisioned ModelConfig in the agent's namespace. Rendered into the Agent's spec.template.modelConfig.name. |
| modelConfig | object | `{"name":""}` | Which platform-provisioned ModelConfig the agent uses, referenced by name. kagent resolves it in the agent's own namespace. The chart never creates or mutates a ModelConfig, and tenants never handle LLM credentials. |
| modelConfig.name | string | `""` | Required. Name of the platform-provisioned ModelConfig in the agent's namespace, rendered into the Agent's spec.template.modelConfig.name. The chart has no default and looks nothing up: name the namespace's default model, the ModelConfig annotated `agent-platform.giantswarm.io/is-default-model-config: "true"`, or another ModelConfig in the namespace. |
| context | object | `{"compaction":{"compactionInterval":null,"enabled":true,"eventRetentionSize":4,"overlapSize":null,"summarizer":{"modelConfig":"","promptTemplate":""},"tokenThreshold":24000}}` | Kept for the values of existing releases; rendered into nothing. Context compaction moved from the agent's template to the platform Harness (kagent-dev/kagent#2790; Harness.spec.kagent.compaction, set by the platform as kagent.harness.compaction), where it applies to every agent the Harness admits. The kagent line from 1.1.0 has no spec.context on the AgentTemplate, and a template that carries it is refused at admission. Everything under this key is ignored. |
| context.compaction | object | `{"compactionInterval":null,"enabled":true,"eventRetentionSize":4,"overlapSize":null,"summarizer":{"modelConfig":"","promptTemplate":""},"tokenThreshold":24000}` | Compaction keeps the prompt bounded as a turn grows. Without it every tool result stays in the history verbatim and every later model call of the turn re-reads all of it: a status question that lists pods and events grows from 6 k to 60 k input tokens in ten calls, waits 9-19 s for the first token of every call after a large listing, and pays for the whole history on every call. The default is tail retention, the strategy that bounds a long tool loop: before a model call whose prompt has passed `tokenThreshold`, the runtime replaces everything but the last `eventRetentionSize` events and the turn's own question with one rolling summary (the previous summary is folded into the next, so the history is one summary plus a raw tail). A summary is a model call too — on the agent's own model unless `summarizer` names another — and it reads the events it replaces once, so a turn under the threshold pays nothing and a turn over it pays one summary per crossing instead of re-reading the whole history on every call; what leaves the raw tail survives only as the summary describes it (values and the registered tool names verbatim, per the runtime's default prompt). |
| context.compaction.enabled | bool | `true` | Render spec.context.compaction. `false` renders no spec.context at all: the agent keeps every word of a long turn verbatim and pays for re-reading it. |
Expand Down
8 changes: 8 additions & 0 deletions helm/agent/ci/ci-values.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# ct lint case: the default values plus the required modelConfig.name,
# toolset unset (implicit full access).
# ct lints each ci/*-values.yaml in place of the bare defaults, so the
# default shape needs its own case. The check-values-schema workflow merges
# this file (by its name) over values.yaml before validating against the
# schema, and app-build-suite renders the chart with it (.abs/main.yaml).
modelConfig:
name: demo-model
3 changes: 0 additions & 3 deletions helm/agent/ci/default-values.yaml

This file was deleted.

2 changes: 2 additions & 0 deletions helm/agent/ci/toolset-none-values.yaml
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# ct lint case: an agent without tools, toolset exactly ["preset:none"].
toolset:
- preset:none
modelConfig:
name: demo-model
2 changes: 2 additions & 0 deletions helm/agent/ci/toolset-selectors-values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,5 @@
toolset:
- preset:read-only
- workflow:incident-triage
modelConfig:
name: demo-model
2 changes: 1 addition & 1 deletion helm/agent/tests/__snapshot__/agent_test.yaml.snap
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ renders the default values (golden):
name: kagent
template:
modelConfig:
name: default-model-config
name: demo-model
systemPrompt: You are a helpful agent.
tools:
- mcp:
Expand Down
30 changes: 29 additions & 1 deletion helm/agent/tests/agent_test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,10 @@ templates:
release:
name: demo
namespace: demo-ns
# modelConfig.name has no default; every test names a model unless it tests
# the refusal.
set:
modelConfig.name: demo-model
tests:
- it: renders the default values (golden)
asserts:
Expand Down Expand Up @@ -49,7 +53,7 @@ tests:
path: spec.template.plugins
- equal:
path: spec.template.modelConfig.name
value: default-model-config
value: demo-model
- equal:
path: spec.template.systemPrompt
value: You are a helpful agent.
Expand Down Expand Up @@ -284,6 +288,30 @@ tests:
- failedTemplate:
errorPattern: 'agent[./]platformPrompt'

- it: refuses a release without modelConfig.name
set:
modelConfig:
name: null
asserts:
- failedTemplate:
errorPattern: "/modelConfig': missing property 'name'"

- it: refuses an empty modelConfig.name
set:
modelConfig:
name: ""
asserts:
- failedTemplate:
errorPattern: "/modelConfig/name': minLength"

- it: refuses a modelConfig.name that is not a Kubernetes object name
set:
modelConfig:
name: Claude Sonnet
asserts:
- failedTemplate:
errorPattern: "/modelConfig/name': .*does not match pattern"

- it: references the ModelConfig by name
set:
modelConfig:
Expand Down
4 changes: 4 additions & 0 deletions helm/agent/tests/remotemcpserver_test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,10 @@ templates:
release:
name: demo
namespace: demo-ns
# modelConfig.name has no default and the values schema refuses a release
# without it, whatever template is rendered.
set:
modelConfig.name: demo-model
tests:
- it: renders the default values (golden)
asserts:
Expand Down
9 changes: 7 additions & 2 deletions helm/agent/values.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -384,12 +384,17 @@
"modelConfig": {
"type": "object",
"description": "Which platform-provisioned ModelConfig the agent uses, referenced by name. kagent resolves it in the agent's own namespace. The chart never creates or mutates a ModelConfig, and tenants never handle LLM credentials.",
"required": [
"name"
],
"additionalProperties": false,
"properties": {
"name": {
"type": "string",
"description": "Name of the platform-provisioned ModelConfig in the agent's namespace. Rendered into the Agent's spec.template.modelConfig.name.",
"minLength": 1
"description": "Required. Name of the platform-provisioned ModelConfig in the agent's namespace, rendered into the Agent's spec.template.modelConfig.name. The chart has no default and looks nothing up: name the namespace's default model, the ModelConfig annotated `agent-platform.giantswarm.io/is-default-model-config: \"true\"`, or another ModelConfig in the namespace.",
"maxLength": 253,
"minLength": 1,
"pattern": "^[a-z0-9]([-a-z0-9]*[a-z0-9])?(\\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*$"
}
}
},
Expand Down
12 changes: 8 additions & 4 deletions helm/agent/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -105,10 +105,14 @@ agent:
# kagent resolves it in the agent's own namespace. The chart never creates or
# mutates a ModelConfig, and tenants never handle LLM credentials.
modelConfig:
# @schema type:string;minLength:1
# -- Name of the platform-provisioned ModelConfig in the agent's namespace.
# Rendered into the Agent's spec.template.modelConfig.name.
name: default-model-config
# @schema type:string;minLength:1;maxLength:253;pattern:^[a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*$;required:true
# -- Required. Name of the platform-provisioned ModelConfig in the agent's
# namespace, rendered into the Agent's spec.template.modelConfig.name. The
# chart has no default and looks nothing up: name the namespace's default
# model, the ModelConfig annotated
# `agent-platform.giantswarm.io/is-default-model-config: "true"`, or another
# ModelConfig in the namespace.
name: ""

# -- Kept for the values of existing releases; rendered into nothing. Context
# compaction moved from the agent's template to the platform Harness
Expand Down
7 changes: 5 additions & 2 deletions tests/ats/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -558,8 +558,11 @@ def assert_all_conditions_true(entry: Dict[str, Any], generation: int) -> None:

def install_release(helm: Helm, chart_archive: Path, release: str, values: Optional[Path] = None, sets: Optional[List[str]] = None) -> None:
"""`helm install` of a release of the chart under test into the Harness's
namespace. No --wait: the chart renders custom resources only, and the
readiness that matters is asserted by wait_agent_ready."""
namespace, bound to the ModelConfig the kagent release renders
(modelConfig.name has no default). No --wait: the chart renders custom
resources only, and the readiness that matters is asserted by
wait_agent_ready."""
sets = [f"modelConfig.name={MODEL_CONFIG}", *(sets or [])]
helm.install(release, str(chart_archive), KAGENT_NAMESPACE, values=[values] if values else None, sets=sets, wait=False, timeout="2m")


Expand Down
11 changes: 6 additions & 5 deletions tests/ats/test_smoke.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@
resolves the Harness, is compiled and booted into a golden snapshot (the
skill is materialised on the way), and the agent's RemoteMCPServer is
accepted with no failed condition.
* `ats-defaults` with the chart's default values — the smallest release an
operator can install. Ready too, with its RemoteMCPServer (the default
toolset binds muster).
* `ats-defaults` with the chart's default values and the required
modelConfig.name: the smallest release an operator can install. Ready
too, with its RemoteMCPServer (the default toolset binds muster).

Ready means compiled and bootable on the platform's runtime; no
model is called (the provider key is a placeholder).
Expand All @@ -31,6 +31,7 @@
FIRST_BOOT_TIMEOUT_S,
HARNESS,
KAGENT_NAMESPACE,
MODEL_CONFIG,
TOOLSET_HEADER,
Kube,
agent_generation,
Expand Down Expand Up @@ -67,7 +68,7 @@ def test_smoke_release_reaches_ready_with_a_git_skill(kube: Kube, release: Calla
assert annotations["ui.giantswarm.io/display-name"] == "ATS Smoke Agent"
assert annotations["ui.giantswarm.io/icon-url"] == "https://avatars.example.com/ats-smoke.svg"
assert annotations["giantswarm.io/scenario"] == "smoke"
assert spec["modelConfig"] == {"name": "default-model-config"}
assert spec["modelConfig"] == {"name": MODEL_CONFIG}
assert spec["description"] == "Exercises the chart's field mapping on the platform's runtime."
assert spec["systemPrompt"] == "You are the chart's smoke test. Be brief."
# context.compaction in the values renders nothing: compaction lives on the
Expand Down Expand Up @@ -104,7 +105,7 @@ def test_default_values_reach_ready_with_a_remotemcpserver(kube: Kube, release:
agent = kube.get(AGENTS, DEFAULTS_RELEASE, namespace=KAGENT_NAMESPACE)
assert agent
assert agent["spec"]["harnessRef"] == {"name": HARNESS}
assert agent["spec"]["template"]["modelConfig"] == {"name": "default-model-config"}
assert agent["spec"]["template"]["modelConfig"] == {"name": MODEL_CONFIG}
assert "context" not in agent["spec"]["template"]
assert agent["spec"]["template"]["tools"] == [{"mcp": {"server": {"kind": "RemoteMCPServer", "name": DEFAULTS_RELEASE}}}]

Expand Down
Loading