Skip to content

feat: Dedicated subagents via subAgent.agentRef over the A2A gateway (restores kagent#2952 API; completes #12 for declarative Agents) - #32

Open
pboers1988 wants to merge 2 commits into
planeodev:planeo/v1.0.1from
workfloworchestrator:feat/dedicated-agentref
Open

pboers1988 wants to merge 2 commits into
planeodev:planeo/v1.0.1from
workfloworchestrator:feat/dedicated-agentref

Conversation

@pboers1988

Copy link
Copy Markdown

What

The planeo carry (#12, kagent.planeo.dev/agent-refs) authorizes an actor to call a declared same-namespace peer through the A2A gateway. A declarative Agent still gets no tool to make that call: the translator never writes ADKAgentConfig.remote_agents. The Go ADK reads the field (go/adk/pkg/agent/agent.go:106), but nothing in go/core sets it.

We checked this with a compile probe on planeo/v1.0.1 (af68fec). An inline Agent annotated with agent-refs: telemetry-agent compiles to an agent config with only model, description, instruction, stream, session_db_url. The same holds when the annotation is on the referenced AgentTemplate.

This PR closes that gap by following upstream's own deferred API instead of adding a new one.

change
API Restores tools[].subAgent.agentRef exactly as kagent-dev#2952 shipped it before kagent-dev#3007 deferred it: exactly one of templateRef / agentRef, a same-namespace LocalObjectReference, the same CEL rules and messages. CRDs regenerated.
translator A Dedicated binding compiles to a remote-A2A tool pointing at <controlPlaneUrl>/agents/<ns>/<agent>/.well-known/agent-card.json, with a 30m timeout and isolate_sessions: false. Self-reference is rejected. An agentRef inside a Shared child template is rejected, because the delegator only reads the calling Agent's own template. Binding names are unique across Shared and Dedicated bindings.
runtimeauth PeerDelegator.declares also accepts an agentRef binding on the caller's own template (inline or referenced) as the declaration. kagent.planeo.dev/agent-refs keeps working unchanged.
external A2A (optional) The annotation kagent.surf.net/remote-agents lists external A2A servers (URL entries only) that are not kagent Agents. It only wires the tool. The origin must be granted by an EgressPolicy in spec.egressPolicyRefs, otherwise compilation fails with a validation error. Controller-origin and IP-literal URLs are rejected. Happy to drop this part if you'd rather not carry it.

Manifest shape:

spec:
  template:
    inline:
      tools:
        - subAgent:
            name: telemetry_agent
            description: Query network telemetry.
            agentRef: {name: telemetry-agent}

Tests

  • CGO_ENABLED=0 go test ./api/... ./core/internal/translator/... ./core/internal/runtimeauth/... ./core/internal/a2agateway/... ./core/internal/egress/... passes, and go vet ./core/... ./api/... is clean.
  • The CEL admission cases ran against envtest: agentRef only, templateRef only, both, neither, empty name.
  • The go/core/internal/controller failures TestRuntimeRevisionGC* and TestUnresolvedPoolReleasesAbandonedRevision also fail on unpatched af68fecd.

Residual risk (not changed here)

The delegated call runs as the session owner's full user principal. A prompt-injected caller could therefore list, read and cancel the owner's other sessions on that peer, and the peer never opts in. We plan to harden this on our side with two changes:

  • a delegation-scoped principal: send, plus only the child sessions the delegation created
  • a peer opt-in annotation

We'd like to align with you on the shape (and on kagent-dev#3642) before sending it.

Refs: kagent-dev#3642, kagent-dev#2952, kagent-dev#3007, #12

🤖 Generated with Claude Code

pboers1988 and others added 2 commits November 25, 2026 08:39
…(restores the kagent#2952 API deferred in kagent-dev#3007; SURF carry on planeo/v1.0.1)

- api: restore SubAgentToolBinding.agentRef (exactly one of templateRef/agentRef,
  same namespace), CRDs regenerated.
- translator: Dedicated bindings compile to ADK remote_agents pointing at the
  controller gateway (<controlPlaneUrl>/agents/<ns>/<agent>/.well-known/agent-card.json,
  30m timeout, sessions not isolated); self-reference and agentRef inside a Shared
  child are rejected.
- translator: kagent.surf.net/remote-agents annotation for external A2A servers
  (url entries only, egress origins added; controller origin and IP literals rejected).
- runtimeauth: PeerDelegator also accepts an agentRef binding on the caller's own
  template as the peer declaration; planeo's kagent.planeo.dev/agent-refs keeps working.

Upstream: kagent-dev#3642

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: Peter Boers <peter.boers@surf.nl>
… instead of granting egress

The kagent.surf.net/remote-agents annotation only wires the remote-A2A tool.
It no longer adds its origins to the compiled egress, which let anyone who can
annotate an Agent open egress to any HTTP(S) origin. Compilation now fails with
a validation error unless each external origin is granted by an EgressPolicy in
the Agent's spec.egressPolicyRefs. Dedicated agentRef bindings are unchanged
(controller origin already granted).

ExternalRemoteAgents returns only the configs. The resolved policy origins reach
Build through HarnessInput.EgressGrants; egress.Covers matches exact and
leftmost-label wildcard origins.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: Peter Boers <peter.boers@surf.nl>
@github-actions github-actions Bot added the enhancement New feature or request label Nov 25, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant