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
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

### Added

- `agent.platformPrompt.egressNote` (`false` by default): appends the network access note, a `## Network access (set by the platform)` section naming the origins of `agent.egress` and the toolchain registries, to the Agent's `spec.template.systemPrompt`, after `agent.systemMessage`. agent-manager sets it on every agent on a coding Harness instead of writing the note into `agent.systemMessage`, so the person's prompt stays their own and a chart release updates the wording on every agent. A note found inside `agent.systemMessage` (a line that is its heading, and the paragraph after it up to the next blank line, in any line endings) is replaced by the chart's note at the end of the prompt, with or without the flag: an agent whose values carry the note agent-manager wrote before keeps exactly one note, in the chart's wording, when its release moves to this chart version (giantswarm/giantswarm#38803).

- `spec.template.systemPrompt` is rendered as a quoted string instead of a `|-` block, so a prompt whose first line is indented renders instead of failing; trailing line breaks are still dropped.

- `agent.egressPolicyRefs` (empty by default): names of EgressPolicies in the agent's namespace, rendered into the Agent's `spec.egressPolicyRefs` as `{name}` entries beside `spec.egress`. The chart copies none of a policy's rules. At most 16 unique resource names; the schema refuses anything else, naming the entry. Needs a kagent line that serves `egresspolicies.api.kagent.dev` (giantswarm/kagent-upstream#620).

- `agent.egress` accepts `tls://<host>:<port>` entries: TLS that the egress gateway forwards without decrypting it, matched on the SNI server name, for a database or message broker that speaks TLS from its first byte. Same host rules as an HTTP(S) origin, and a port is required. The schema and the render refuse an entry without a port, with a path or on an IP address, naming it. Needs the kagent line from 1.21.0, whose Agent accepts `tls://` in `spec.egress` (giantswarm/kagent-upstream#740); an older kagent refuses the Agent (giantswarm/agent#58).
Expand Down
11 changes: 10 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -259,7 +259,16 @@ agent:
agent's own spec, not a separate approval.
- An agent on a coding Harness (a runtime other than `kagent`) gets its origins
from the platform's per-Harness list, which agent-manager writes into
`agent.egress`; another origin is refused there.
`agent.egress`; another origin is refused there. agent-manager also sets
`agent.platformPrompt.egressNote`, and the chart appends a `## Network
access (set by the platform)` section to the system prompt that names those
origins and tells the agent that a refusal is policy, not an outage. The
section is the chart's, not part of `agent.systemMessage`: a chart release
updates its wording on every agent. A note found inside `systemMessage` (a
line that is the heading, and the paragraph after it) is replaced by the
chart's, with or without the flag, so values that still carry one render the
current note once. `extraAgentSpec.systemPrompt` replaces the whole prompt,
the note included.

**Picking an EgressPolicy.** A tenant's admins can bundle origins, and the
credential header the gateway adds to them, into an `EgressPolicy` in the
Expand Down
6 changes: 4 additions & 2 deletions helm/agent/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,15 +14,17 @@ What an agent can reach and how to add a host (`agent.egress`): [What an agent c

| Key | Type | Default | Description |
|-----|------|---------|-------------|
| agent | object | `{"description":"","displayName":"","egress":[],"egressPolicyRefs":[],"harness":"kagent","iconUrl":"","name":"","systemMessage":"You are a helpful agent.\n"}` | Identity and prompt of the agent. |
| agent | object | `{"description":"","displayName":"","egress":[],"egressPolicyRefs":[],"harness":"kagent","iconUrl":"","name":"","platformPrompt":{"egressNote":false},"systemMessage":"You are a helpful agent.\n"}` | Identity and prompt of the agent. |
| agent.name | string | `""` | Technical resource name (DNS-1123) of the Agent and of its RemoteMCPServer. Defaults to the Helm release name. |
| agent.displayName | string | `""` | Human-friendly name, Unicode allowed. Rendered as the ui.giantswarm.io/display-name annotation on the Agent. Size-limited so it cannot become a description. |
| agent.description | string | `""` | Rendered into the Agent's spec.template.description. It shares the compiled agent config's size budget with the system prompt (see systemMessage), so keep it to a few sentences. |
| agent.iconUrl | string | `""` | Fully qualified URL of the agent's avatar icon. Rendered as the ui.giantswarm.io/icon-url annotation on the Agent (the template has no icon field); the Dev Portal reads it. Populated by the agent-creation flows with the canonical avatar URL. |
| agent.systemMessage | string | `"You are a helpful agent.\n"` | The agent's system prompt. Rendered into the Agent's spec.template.systemPrompt. At most 20000 characters; move long reference material into a skill. A prompt heavy in `<`, `>` or `&` can still exceed the runtime limit under this cap, and the Agent then reports why. |
| agent.systemMessage | string | `"You are a helpful agent.\n"` | The agent's system prompt. Rendered into the Agent's spec.template.systemPrompt, followed by the sections of `platformPrompt`. At most 20000 characters, the platform's sections not counted; move long reference material into a skill. A prompt heavy in `<`, `>` or `&` can still exceed the runtime limit under this cap, and the Agent then reports why. A line `## Network access (set by the platform)` and the paragraph after it are the platform's: the chart takes them out and appends its own network access note instead, as `platformPrompt.egressNote` does. |
| agent.harness | string | `"kagent"` | Name of the platform Harness that runs the agent, in the agent's namespace. Rendered into the Agent's spec.harnessRef.name; the Agent selects its Harness, no label and no Harness-side selector is involved. The platform ships the `kagent` Harness (the Go ADK runtime); an Agent whose Harness does not exist reports `ResolvedRefs=False` and never becomes Ready. |
| agent.egress | list | `[]` | Origins the agent may reach besides the destinations its revision compiles (the model, its MCP servers, its skill and plugin sources, telemetry), such as `https://github.com:443`, `https://proxy.golang.org` or `tls://db.example.com:5432`. Rendered into the Agent's spec.egress. An origin is `http(s)://<host>[:port]` with no path, or `tls://<host>:<port>` with a required port: TLS that the egress gateway forwards without decrypting it, matched on the SNI server name (a database or message broker that speaks TLS from the first byte, not STARTTLS). The host may have `*` as its leftmost label (`https://*.githubusercontent.com` matches one label, such as raw.githubusercontent.com) and a wildcard needs two labels under it, so nothing opens a whole top-level domain or every host. At most 64 origins. The chart refuses anything else, naming the entry. |
| 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. |
| 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. |
Expand Down
38 changes: 36 additions & 2 deletions helm/agent/templates/_helpers.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -171,6 +171,41 @@ Description of the agent's RemoteMCPServer: names the agent and its toolset.
{{- printf "muster MCP gateway of agent %s (%s)" (include "agent.name" .) (ternary (printf "toolset %s" $toolset) "implicit full access" (ne $toolset "")) -}}
{{- end -}}

{{- /*
agent.systemPrompt is systemMessage followed by the sections of
agent.platformPrompt. A network access note inside systemMessage (a line that
is the note's heading, and the paragraph after it up to the next blank line)
is replaced by the chart's: the prompt carries the note once, in the chart's
wording, whether or not agent.platformPrompt.egressNote is set.
*/ -}}
{{- define "agent.systemPrompt" -}}
{{- $prompt := .Values.agent.systemMessage -}}
{{- $egressNote := dig "platformPrompt" "egressNote" false .Values.agent -}}
{{- $own := regexReplaceAll `(?m)\s*^[ \t]*## Network access \(set by the platform\)[ \t]*\r?$(?:\n[ \t]*\r?$)*(?:\n[^\r\n]*\S[^\r\n]*\r?$)*` $prompt "" -}}
{{- if ne $own $prompt -}}
{{- $prompt = regexReplaceAll `\A(?:[ \t]*\r?\n)+` $own "" -}}
{{- $egressNote = true -}}
{{- end -}}
{{- if $egressNote -}}
{{- $prompt = regexReplaceAll `\s+\z` $prompt "" -}}
{{- $note := include "agent.egressNote" . -}}
{{- $prompt = ternary $note (printf "%s\n\n%s" $prompt $note) (eq $prompt "") -}}
{{- end -}}
{{- regexReplaceAll `\n+\z` $prompt "" -}}
{{- end -}}

{{- /*
agent.egressNote tells a coding agent what its sandbox reaches, so a refused
request reads as policy rather than as an outage. A Session's toolchains bring
origins of their own, which differ per Session, so the note names them by
place.
*/ -}}
{{- define "agent.egressNote" -}}
## Network access (set by the platform)

Besides your model and your tools, your sandbox reaches only {{ with .Values.agent.egress }}these origins: {{ join ", " . }}, and {{ end }}the registries of the toolchains mounted under /opt/kagent/tools. A request to any other host is refused by the egress policy and shows up as a failed command or tool call (connection refused, reset or 403). It is not transient: do not retry it or work around it; say which host the task needs.
{{- end -}}

{{- /*
agent.egress.validate mirrors the Agent CRD's rule for spec.egress (HTTP(S)
origins and tls:// origins with a port) so a bad origin fails the render naming
Expand Down Expand Up @@ -286,8 +321,7 @@ description: {{ . | quote }}
{{- end }}
modelConfig:
name: {{ .Values.modelConfig.name | quote }}
systemPrompt: |-
{{- .Values.agent.systemMessage | nindent 2 }}
systemPrompt: {{ include "agent.systemPrompt" . | toJson }}
{{- with .Values.skills }}
skills:
{{- include "agent.skills" $ | nindent 2 }}
Expand Down
Loading
Loading