Skip to content

fix: set appProtocol on agent Services for A2A discovery#1297

Open
syn-zhu wants to merge 1 commit intokagent-dev:mainfrom
syn-zhu:fix/agent-service-a2a-appprotocol
Open

fix: set appProtocol on agent Services for A2A discovery#1297
syn-zhu wants to merge 1 commit intokagent-dev:mainfrom
syn-zhu:fix/agent-service-a2a-appprotocol

Conversation

@syn-zhu
Copy link

@syn-zhu syn-zhu commented Feb 14, 2026

Summary

  • Set appProtocol: kgateway.dev/a2a on the Service port created for each Agent CR

Without appProtocol, AgentGateway's A2A plugin cannot discover agent Services.
This forces traffic through the kagent controller's passthrough proxy, which drops
HTTP headers (including traceparent), breaking distributed trace continuity.

With this one-line fix, AgentGateway can route directly to agent pods, preserving
all headers and enabling end-to-end tracing.

Test plan

  • Deploy agent, verify kubectl get svc <agent> -o jsonpath='{.spec.ports[0].appProtocol}' returns kgateway.dev/a2a
  • Verify AgentGateway A2A plugin discovers the Service
  • Send request with traceparent header through gateway, verify trace continuity in backend

Closes #1295

🤖 Generated with Claude Code

The kagent controller creates a Service for each Agent CR but does not set
appProtocol on the port. Without appProtocol: kgateway.dev/a2a, AgentGateway's
A2A plugin cannot discover agent Services, forcing traffic through the
controller's passthrough proxy which drops HTTP headers (including traceparent).

Set appProtocol: kgateway.dev/a2a on the agent Service port so AgentGateway
can route directly to agent pods, preserving all headers and enabling
end-to-end distributed tracing.

Closes kagent-dev#1295

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Copilot AI review requested due to automatic review settings February 14, 2026 01:01
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR updates the Agent manifest translation so that the Kubernetes Service created for each Agent CR sets an explicit appProtocol, enabling AgentGateway’s A2A plugin to discover and route directly to agent Services (preserving HTTP headers for distributed tracing).

Changes:

  • Set spec.ports[0].appProtocol: kgateway.dev/a2a on the per-Agent Service port.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +535 to +538
Name: "http",
Port: dep.Port,
TargetPort: intstr.FromInt(int(dep.Port)),
AppProtocol: ptr.To("kgateway.dev/a2a"),
Copy link

Copilot AI Feb 14, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Adding AppProtocol changes the serialized Service manifest; the golden test outputs under go/internal/controller/translator/agent/testdata/outputs/*.json currently expect the Service port to only have name/port/targetPort and will fail until they’re regenerated/updated to include appProtocol: "kgateway.dev/a2a" on the Service port(s).

Suggested change
Name: "http",
Port: dep.Port,
TargetPort: intstr.FromInt(int(dep.Port)),
AppProtocol: ptr.To("kgateway.dev/a2a"),
Name: "http",
Port: dep.Port,
TargetPort: intstr.FromInt(int(dep.Port)),

Copilot uses AI. Check for mistakes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Trace context (traceparent) not propagated from controller to agent pods

1 participant