Skip to content

Commit 253191a

Browse files
committed
review comments
Signed-off-by: Jet Chiang <pokyuen.jetchiang-ext@solo.io>
1 parent cc5c2ac commit 253191a

17 files changed

Lines changed: 41 additions & 78 deletions

File tree

go/api/config/crd/bases/kagent.dev_agents.yaml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7722,9 +7722,7 @@ spec:
77227722
type: string
77237723
type: array
77247724
required:
7725-
- id
77267725
- name
7727-
- tags
77287726
type: object
77297727
minItems: 1
77307728
type: array

go/api/config/crd/bases/kagent.dev_sandboxagents.yaml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5380,9 +5380,7 @@ spec:
53805380
type: string
53815381
type: array
53825382
required:
5383-
- id
53845383
- name
5385-
- tags
53865384
type: object
53875385
minItems: 1
53885386
type: array

go/api/v1alpha2/agent_types.go

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,6 @@ import (
2626
"k8s.io/apimachinery/pkg/runtime/schema"
2727
"k8s.io/apimachinery/pkg/types"
2828
"sigs.k8s.io/controller-runtime/pkg/client"
29-
30-
"trpc.group/trpc-go/trpc-a2a-go/server"
3129
)
3230

3331
// AgentType represents the agent type
@@ -529,7 +527,23 @@ type A2AConfig struct {
529527
Skills []AgentSkill `json:"skills,omitempty"`
530528
}
531529

532-
type AgentSkill server.AgentSkill
530+
// AgentSkill describes a specific capability or function of the agent.
531+
type AgentSkill struct {
532+
// ID is the unique identifier for the skill.
533+
ID string `json:"id,omitempty"`
534+
// Name is the human-readable name of the skill.
535+
Name string `json:"name"`
536+
// Description is an optional detailed description of the skill.
537+
Description string `json:"description,omitempty"`
538+
// Tags are optional tags for categorization.
539+
Tags []string `json:"tags,omitempty"`
540+
// Examples are optional usage examples.
541+
Examples []string `json:"examples,omitempty"`
542+
// InputModes are the supported input data modes/types.
543+
InputModes []string `json:"inputModes,omitempty"`
544+
// OutputModes are the supported output data modes/types.
545+
OutputModes []string `json:"outputModes,omitempty"`
546+
}
533547

534548
const (
535549
AgentConditionTypeAccepted = "Accepted"

go/api/v1alpha2/zz_generated.deepcopy.go

Lines changed: 0 additions & 5 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

go/core/internal/a2a/a2a_handler_mux.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,6 @@ func (a *handlerMux) SetAgentHandler(
6060
card a2atype.AgentCard,
6161
tracing middleware,
6262
) error {
63-
// TODO(cleanup): Replace this protocol mux with the standard v1 handler stack once legacy clients/runtimes are unsupported.
6463
requestHandler := NewPassthroughRequestHandler(client, &card)
6564
legacyJSONRPCHandler := a2av0.NewJSONRPCHandler(requestHandler)
6665
v1JSONRPCHandler := a2asrv.NewJSONRPCHandler(requestHandler)

go/core/internal/a2a/a2a_registrar.go

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ import (
66
"net"
77
"net/http"
88
"reflect"
9-
"time"
109

1110
a2atype "github.com/a2aproject/a2a-go/v2/a2a"
1211
a2aclient "github.com/a2aproject/a2a-go/v2/a2aclient"
@@ -42,9 +41,6 @@ func NewA2ARegistrar(
4241
a2aBaseUrl string,
4342
sandboxA2ABaseURL string,
4443
authenticator auth.AuthProvider,
45-
_ int,
46-
_ int,
47-
_ time.Duration,
4844
) (*A2ARegistrar, error) {
4945
if clientRegistry == nil {
5046
return nil, fmt.Errorf("clientRegistry must not be nil")
@@ -170,7 +166,7 @@ func (a *A2ARegistrar) upsertAgentHandler(ctx context.Context, agent v1alpha2.Ag
170166
// Keep legacy fallback during rollout so old agent pods continue to serve traffic.
171167
filterInterfacesByVersion(card.SupportedInterfaces, a2atype.ProtocolVersion("0.3")),
172168
a2aclient.WithJSONRPCTransport(httpClient),
173-
// TODO(cleanup): Remove the compat transport after legacy runtimes are unsupported.
169+
// TODO(0.11.0): Remove the compat transport after legacy runtimes are unsupported.
174170
a2aclient.WithCompatTransport(
175171
a2atype.ProtocolVersion("0.3"),
176172
a2atype.TransportProtocolJSONRPC,
@@ -204,19 +200,22 @@ func (a *A2ARegistrar) upsertAgentHandler(ctx context.Context, agent v1alpha2.Ag
204200
return nil
205201
}
206202

203+
// debugHTTPClient returns nil in normal operation, letting the a2aclient SDK apply its
204+
// default 3-minute request timeout. In debug mode it overrides the dial target so all
205+
// A2A traffic is redirected to a fixed address (e.g. a local proxy).
207206
func debugHTTPClient() *http.Client {
208207
debugAddr := env.KagentA2ADebugAddr.Get()
209-
if debugAddr != "" {
210-
client := new(http.Client)
211-
client.Transport = &http.Transport{
208+
if debugAddr == "" {
209+
return nil
210+
}
211+
return &http.Client{
212+
Transport: &http.Transport{
212213
DialContext: func(ctx context.Context, network, addr string) (net.Conn, error) {
213214
var zeroDialer net.Dialer
214215
return zeroDialer.DialContext(ctx, network, debugAddr)
215216
},
216-
}
217-
return client
217+
},
218218
}
219-
return &http.Client{}
220219
}
221220

222221
func (a *A2ARegistrar) a2aRouteURL(agent v1alpha2.AgentObject) string {

go/core/internal/a2a/client_interceptors.go

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,10 @@ import (
1010
"k8s.io/apimachinery/pkg/types"
1111
)
1212

13+
// staticHeadersInterceptor injects agent-level static headers (e.g. API keys, tenant IDs)
14+
// into every outgoing A2A call. Headers are fixed at construction time so they are never
15+
// re-resolved per request, which makes the interceptor safe for concurrent calls.
16+
// Currently this is only used for testing in invoke_api_test.go
1317
type staticHeadersInterceptor struct {
1418
a2aclient.PassthroughInterceptor
1519
headers map[string]string
@@ -28,6 +32,11 @@ func (s *staticHeadersInterceptor) Before(ctx context.Context, req *a2aclient.Re
2832
return ctx, nil, nil
2933
}
3034

35+
// upstreamAuthInterceptor applies per-request auth when the controller proxies an A2A call
36+
// to a managed agent. Auth must be evaluated per request because the session principal is only
37+
// available in the call context, not at agent registration time. It also propagates W3C
38+
// TraceContext so distributed traces span across the controller→agent hop without agents
39+
// needing to handle propagation themselves.
3140
type upstreamAuthInterceptor struct {
3241
a2aclient.PassthroughInterceptor
3342
authProvider auth.AuthProvider

go/core/internal/controller/translator/agent/utils.go

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ func GetA2AAgentCard(agent v1alpha2.AgentObject) *a2atype.AgentCard {
4040
card.Skills = append(card.Skills, a2atype.AgentSkill{
4141
ID: skill.ID,
4242
Name: skill.Name,
43-
Description: derefString(skill.Description),
43+
Description: skill.Description,
4444
Tags: skill.Tags,
4545
Examples: skill.Examples,
4646
InputModes: skill.InputModes,
@@ -50,10 +50,3 @@ func GetA2AAgentCard(agent v1alpha2.AgentObject) *a2atype.AgentCard {
5050
}
5151
return &card
5252
}
53-
54-
func derefString(s *string) string {
55-
if s == nil {
56-
return ""
57-
}
58-
return *s
59-
}

go/core/internal/httpserver/handlers/sessions.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -355,7 +355,7 @@ func (h *SessionsHandler) HandleListTasksForSession(w ErrorResponseWriter, r *ht
355355

356356
log.Info("Successfully retrieved session tasks", "count", len(tasks))
357357

358-
// TODO(cleanup): Remove legacy API conversion after legacy wire support is no longer supported.
358+
// TODO(0.11.0): Remove legacy API conversion after legacy wire support is no longer supported.
359359
switch wireVersion {
360360
case utils.A2AWireVersionLegacy:
361361
legacyTasks := make([]any, 0, len(tasks))

go/core/internal/httpserver/handlers/tasks.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ func (h *TasksHandler) HandleGetTask(w ErrorResponseWriter, r *http.Request) {
4545
}
4646

4747
log.Info("Successfully retrieved task")
48-
// TODO(cleanup): Remove legacy API conversion after legacy wire support is no longer supported.
48+
// TODO(0.11.0): Remove legacy API conversion after legacy wire support is no longer supported.
4949
// Currently this will return either legacy or v1 task depending on the wire version
5050
var data any
5151
switch wireVersion {
@@ -76,7 +76,7 @@ func (h *TasksHandler) HandleCreateTask(w ErrorResponseWriter, r *http.Request)
7676
}
7777

7878
task := a2a.Task{}
79-
// TODO(cleanup): Remove legacy API conversion after legacy wire support is no longer supported.
79+
// TODO(0.11.0): Remove legacy API conversion after legacy wire support is no longer supported.
8080
switch wireVersion {
8181
case utils.A2AWireVersionLegacy:
8282
legacyTask := protocol.Task{}

0 commit comments

Comments
 (0)