Skip to content

Agent Mesh

api: add the a2a service type

Tomas Tormo62e5f457d23f
diff --git a/api/network.go b/api/network.go
index 53afa43a..ec6a86bf 100644
--- a/api/network.go
+++ b/api/network.go
@@ -171,6 +171,9 @@ const (
// ServiceTypeStringInference is the string identifier for Inference services.
ServiceTypeStringInference = "inference"
+
+ // ServiceTypeStringA2A is the string identifier for A2A (Agent2Agent) services.
+ ServiceTypeStringA2A = "a2a"
)
// ParseServiceType converts a string identifier (e.g. from JSON or REST) to the ServiceType protobuf enum.
@@ -180,6 +183,8 @@ func ParseServiceType(s string) (ServiceType, error) {
return ServiceType_SERVICE_TYPE_MCP, nil
case ServiceTypeStringInference:
return ServiceType_SERVICE_TYPE_INFERENCE, nil
+ case ServiceTypeStringA2A:
+ return ServiceType_SERVICE_TYPE_A2A, nil
default:
return ServiceType_SERVICE_TYPE_UNSPECIFIED, fmt.Errorf("invalid service type: %s", s)
}
@@ -192,6 +197,8 @@ func ServiceTypeToString(t ServiceType) (string, error) {
return ServiceTypeStringMCP, nil
case ServiceType_SERVICE_TYPE_INFERENCE:
return ServiceTypeStringInference, nil
+ case ServiceType_SERVICE_TYPE_A2A:
+ return ServiceTypeStringA2A, nil
default:
return "", fmt.Errorf("invalid or unspecified service type")
}
diff --git a/api/network_test.go b/api/network_test.go
index 6e40187f..b33b40f9 100644
--- a/api/network_test.go
+++ b/api/network_test.go
@@ -99,3 +99,20 @@ func TestParseServiceTarget(t *testing.T) {
})
}
}
+
+func TestServiceTypeA2ARoundTrip(t *testing.T) {
+ st, err := ParseServiceType("a2a")
+ if err != nil {
+ t.Fatalf("ParseServiceType(a2a): %v", err)
+ }
+ if st != ServiceType_SERVICE_TYPE_A2A {
+ t.Fatalf("ParseServiceType(a2a) = %v, want SERVICE_TYPE_A2A", st)
+ }
+ s, err := ServiceTypeToString(st)
+ if err != nil {
+ t.Fatalf("ServiceTypeToString: %v", err)
+ }
+ if s != ServiceTypeStringA2A {
+ t.Fatalf("ServiceTypeToString = %q, want %q", s, ServiceTypeStringA2A)
+ }
+}
diff --git a/api/sam.pb.go b/api/sam.pb.go
index deed7a67..8bf34004 100644
--- a/api/sam.pb.go
+++ b/api/sam.pb.go
@@ -93,6 +93,7 @@ const (
ServiceType_SERVICE_TYPE_UNSPECIFIED ServiceType = 0
ServiceType_SERVICE_TYPE_MCP ServiceType = 1
ServiceType_SERVICE_TYPE_INFERENCE ServiceType = 2
+ ServiceType_SERVICE_TYPE_A2A ServiceType = 3
)
// Enum value maps for ServiceType.
@@ -101,11 +102,13 @@ var (
0: "SERVICE_TYPE_UNSPECIFIED",
1: "SERVICE_TYPE_MCP",
2: "SERVICE_TYPE_INFERENCE",
+ 3: "SERVICE_TYPE_A2A",
}
ServiceType_value = map[string]int32{
"SERVICE_TYPE_UNSPECIFIED": 0,
"SERVICE_TYPE_MCP": 1,
"SERVICE_TYPE_INFERENCE": 2,
+ "SERVICE_TYPE_A2A": 3,
}
)
@@ -3073,11 +3076,12 @@ const file_api_sam_proto_rawDesc = "" +
"\x1dENROLLMENT_STATUS_UNSPECIFIED\x10\x00\x12\x1d\n" +
"\x19ENROLLMENT_STATUS_PENDING\x10\x01\x12\x1e\n" +
"\x1aENROLLMENT_STATUS_APPROVED\x10\x02\x12\x1e\n" +
- "\x1aENROLLMENT_STATUS_REJECTED\x10\x03*]\n" +
+ "\x1aENROLLMENT_STATUS_REJECTED\x10\x03*s\n" +
"\vServiceType\x12\x1c\n" +
"\x18SERVICE_TYPE_UNSPECIFIED\x10\x00\x12\x14\n" +
"\x10SERVICE_TYPE_MCP\x10\x01\x12\x1a\n" +
- "\x16SERVICE_TYPE_INFERENCE\x10\x02B\x1bZ\x19github.com/google/sam/apib\x06proto3"
+ "\x16SERVICE_TYPE_INFERENCE\x10\x02\x12\x14\n" +
+ "\x10SERVICE_TYPE_A2A\x10\x03B\x1bZ\x19github.com/google/sam/apib\x06proto3"
var (
file_api_sam_proto_rawDescOnce sync.Once
diff --git a/api/sam.proto b/api/sam.proto
index 458cd895..a368199c 100644
--- a/api/sam.proto
+++ b/api/sam.proto
@@ -103,6 +103,7 @@ enum ServiceType {
SERVICE_TYPE_UNSPECIFIED = 0;
SERVICE_TYPE_MCP = 1;
SERVICE_TYPE_INFERENCE = 2;
+ SERVICE_TYPE_A2A = 3;
}
message ServiceInfo {