Repository navigation
Description
Summary
As of 0.10.0 the Agent CRD defaults spec.declarative.runtime to go, so any agent that omits the field runs on the Go ADK. The Go runtime does not implement spec.declarative.context.compaction — for long-running tool-using agents that field is what bounds session history growth. An operator upgrading to 0.10.0 without an explicit runtime therefore loses compaction, and the only signal is a status condition that no UI or printer column surfaces.
Evidence (all at tag v0.10.0, commit ae008d1e)
-
gois the CRD default —kagent.dev_agents.yaml:13236default: go(same atkagent.dev_sandboxagents.yaml:10893). Notego/api/v1alpha2/agent_types.go:325-336(EffectiveDeclarativeRuntime) still documents and implements a Python fallback, which is unreachable for objects created through the API. -
Compaction is unimplemented on Go —
go/core/internal/controller/reconciler/reconciler.go:946-948:// Context compression: Not yet implemented in Go runtime if decl.Context != nil && decl.Context.Compaction != nil { unsupported = append(unsupported, "context compression/compaction (not implemented in Go runtime)") }
grep -rn Compaction go/adkreturns zero functional hits, while the controller compiles the config regardless (translator/agent/compiler.go:265-302) — the field is delivered to the runtime and dropped. -
The gap is soft-failed —
reconciler.go:341-350setsUnsupportedFeatures=True; the agent still reconciles Accepted and serves traffic, just without compaction. Good that a signal exists; it is invisible in the UI and inkubectl get agents.
Scope
-
Implement
context.compactionin the Go runtime. The upstream primitives are not in place yet — ingoogle/adk-go, #298 "ADR-010: Native SDK Session History Compaction" (design) and #1001 "Add EventCompaction support to EventActions and compaction filtering in contents_processor.go" (implementation) are both open as of 2026-09-07; see also discussion #589. Either consume that work when it lands, or implement session-history compaction kagent-side for the Go runtime. -
Publish an authoritative runtime parity matrix in the docs, generated from or cross-checked against
validateRuntimeFeatures, and replace "most features supported" in the CRD description with a link to it. -
Make degradation harder to miss — surface
UnsupportedFeatureson the agent card / UI and inkubectl get agentsprinter columns, and consider an opt-in strict mode that fails reconciliation rather than ignoring the field. Givengois now the default, this is the difference between a visible upgrade note and a silent regression. -
Close the smaller deltas or drop the fields — file upload is Go-only ("Python ADK agents do not yet support file attachments"), and
executeCodeBlocksis inert on both runtimes pendinggoogle/adk-python#3921while still being an accepted API field.
Acceptance criteria
- An agent with
runtime: goandcontext.compactionset demonstrably compacts session history (test or trace evidence), andUnsupportedFeaturesis not raised for it. - Docs carry a parity matrix that matches
validateRuntimeFeatures. - Until item 1 ships, the compaction-on-Go gap is stated in the docs where
runtimeis described, not only in the reconciler.
Metadata
Metadata
Assignees
Labels
Type
Projects
- StatusShow more project fieldsBacklog
Activity
go-faustino commentedon Sep 9, 2026
The upstream dependency this depends on has landed, which I think changes the shape of item 1 considerably.
google/adk-goshipped native compaction in v2.3.0 (2026-08-31). There is now asession/compactionpackage providingSlidingWindowEventCompactor,TokenThresholdEventCompactorandNewLLMSummarizer, along withsession.EventCompaction, theinternal/compactioninternalmachinery, runner integration, and anexamples/compactionrecallworked example. I checked the tags directly:session/compactionis present atv2.3.0and absent at bothv2.1.0andv2.2.0.So the "upstream primitives are not in place yet" note in the issue body, accurate when written, is now out of date — google/adk-go#298 and #1001 were resolved by that release even though the issues appear to still be open.
kagent
v0.10.1pinsgoogle.golang.org/adk/v2 v2.1.0, one release behind the one that carries this.Why this matters for the two earlier attempts
Both prior PRs were auto-closed by stalebot rather than rejected:
EventCompactionin google/adk-go first, and that afterwards "implementing proper marker-based compaction in kagent would be pretty straightforward". That precondition is now met.adk/pkg/compaction, +1008/-18 with tests, closed with no human review comments.Given v2.3.0, the #2025 approach is largely obsolete: there is no longer a reason to carry a port of the algorithm inside kagent when the SDK implements it.
Suggested shape
The compactor knobs map closely onto the existing CRD surface, so most of the translation layer already exists and is already delivered to the runtime:
spec.declarative.context.compactioncompactionInterval+overlapSizeSlidingWindowEventCompactortokenThresholdTokenThresholdEventCompactorsummarizer.modelConfig+summarizer.promptTemplateNewLLMSummarizerAgentContextConfigis already compiled bytranslator/agent/compiler.goand delivered inconfig.json; the Go runtime simply never reads it. So the work looks like: bump the adk-go dependency, construct the compactor and summarizer fromcfg.ContextConfigat agent/runner setup, and drop theunsupportedbranch inreconciler.go.The dependency bump across two minor versions of the core ADK is probably the bulk of the risk rather than the wiring itself — I have not assessed that changelog.
Happy to help with the implementation or testing if it would be useful — please say if someone is already on it.
feat(adk): honour context compaction in the Go runtime (kagent-dev#2790)
feat(adk): honour context compaction in the Go runtime (kagent-dev#2790)
feat(models): add prompt caching for the Anthropic provider (promptCa…