@@ -850,6 +850,43 @@ func generateCrewAIAgent(baseURL string) *v1alpha2.Agent {
850850 }
851851}
852852
853+ func generateAnthropicAgent (baseURL string ) * v1alpha2.Agent {
854+ return & v1alpha2.Agent {
855+ ObjectMeta : metav1.ObjectMeta {
856+ Name : "anthropic-test-agent" ,
857+ Namespace : "kagent" ,
858+ },
859+ Spec : v1alpha2.AgentSpec {
860+ Description : "An Anthropic agent with calculator and weather tools" ,
861+ Type : v1alpha2 .AgentType_BYO ,
862+ BYO : & v1alpha2.BYOAgentSpec {
863+ Deployment : & v1alpha2.ByoDeploymentSpec {
864+ Image : "localhost:5001/basic-anthropic:latest" ,
865+ SharedDeploymentSpec : v1alpha2.SharedDeploymentSpec {
866+ Env : []corev1.EnvVar {
867+ {
868+ Name : "ANTHROPIC_API_KEY" ,
869+ ValueFrom : & corev1.EnvVarSource {
870+ SecretKeyRef : & corev1.SecretKeySelector {
871+ LocalObjectReference : corev1.LocalObjectReference {
872+ Name : "kagent-anthropic" ,
873+ },
874+ Key : "ANTHROPIC_API_KEY" ,
875+ },
876+ },
877+ },
878+ {
879+ Name : "ANTHROPIC_BASE_URL" ,
880+ Value : baseURL ,
881+ },
882+ },
883+ },
884+ },
885+ },
886+ },
887+ }
888+ }
889+
853890func TestE2EInvokeOpenAIAgent (t * testing.T ) {
854891 // Setup mock server
855892 baseURL , stopServer := setupMockServer (t , "mocks/invoke_openai_agent.json" )
@@ -1043,6 +1080,56 @@ func TestE2EInvokeCrewAIAgent(t *testing.T) {
10431080 })
10441081}
10451082
1083+ func TestE2EInvokeAnthropicAgent (t * testing.T ) {
1084+ // Setup mock server
1085+ baseURL , stopServer := setupMockServer (t , "mocks/invoke_anthropic_agent.json" )
1086+ defer stopServer ()
1087+
1088+ // Setup Kubernetes client
1089+ cli := setupK8sClient (t , false )
1090+
1091+ agent := generateAnthropicAgent (baseURL )
1092+
1093+ // Create the agent on the cluster
1094+ err := cli .Create (t .Context (), agent )
1095+ require .NoError (t , err )
1096+ cleanup (t , cli , agent )
1097+
1098+ // Wait for agent to be ready
1099+ args := []string {
1100+ "wait" ,
1101+ "--for" ,
1102+ "condition=Ready" ,
1103+ "--timeout=1m" ,
1104+ "agents.kagent.dev" ,
1105+ agent .Name ,
1106+ "-n" ,
1107+ agent .Namespace ,
1108+ }
1109+
1110+ cmd := exec .CommandContext (t .Context (), "kubectl" , args ... )
1111+ cmd .Stdout = os .Stdout
1112+ cmd .Stderr = os .Stderr
1113+ require .NoError (t , cmd .Run ())
1114+
1115+ // Poll until the A2A endpoint is actually serving requests through the proxy
1116+ waitForEndpoint (t , agent .Namespace , agent .Name )
1117+
1118+ // Setup A2A client - use the agent's actual name
1119+ a2aURL := a2aUrl ("kagent" , "anthropic-test-agent" )
1120+ a2aClient , err := a2aclient .NewA2AClient (a2aURL )
1121+ require .NoError (t , err )
1122+
1123+ useArtifacts := true
1124+ t .Run ("sync_invocation_calculator" , func (t * testing.T ) {
1125+ runSyncTest (t , a2aClient , "What is 2+2?" , "4" , & useArtifacts )
1126+ })
1127+
1128+ t .Run ("streaming_invocation_weather" , func (t * testing.T ) {
1129+ runStreamingTest (t , a2aClient , "What is the weather in London?" , "Rainy, 52°F" )
1130+ })
1131+ }
1132+
10461133func TestE2EInvokeSTSIntegration (t * testing.T ) {
10471134 // Setup mock STS server
10481135 agentName := "test-sts"
0 commit comments