Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions go/test/e2e/manifests/httproute-template.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
apiVersion: gateway.networking.k8s.io/v1
kind: HTTPRoute
metadata:
name: %s
namespace: kagent
spec:
parentRefs:
- name: proxy
namespace: kagent
rules:
- matches:
- headers:
- type: Exact
name: x-kagent-host
value: %s
backendRefs:
- name: %s
port: %d
17 changes: 17 additions & 0 deletions go/test/e2e/manifests/proxy-deny-policy.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
apiVersion: agentgateway.dev/v1alpha1
kind: AgentgatewayPolicy
metadata:
name: proxy-deny-test
namespace: kagent
spec:
targetRefs:
- group: gateway.networking.k8s.io
kind: Gateway
name: proxy
traffic:
authorization:
action: Deny
policy:
matchExpressions:
# Deny all requests - this matches everything
- "true"
143 changes: 143 additions & 0 deletions go/test/e2e/manifests/proxy-test-resources.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,143 @@
# Main Agent - uses tools through proxy gateway
apiVersion: kagent.dev/v1alpha2
kind: Agent
metadata:
name: proxy-test-agent
namespace: kagent
spec:
type: Declarative
declarative:
modelConfig: proxy-test-model-config
systemMessage: You are a test agent that uses tools through a proxy gateway.
deployment:
imagePullPolicy: Always
env:
- name: LOG_LEVEL
value: DEBUG
tools:
- type: Agent
agent:
name: target-agent-proxy-test
- type: McpServer
mcpServer:
apiGroup: kagent.dev
kind: MCPServer
name: everything-mcp-server
toolNames:
- get-sum
- type: McpServer
mcpServer:
kind: Service
name: test-mcp-service
toolNames:
- get-sum
---
# Gateway for proxy testing
apiVersion: gateway.networking.k8s.io/v1
kind: Gateway
metadata:
name: proxy
namespace: kagent
spec:
gatewayClassName: agentgateway
listeners:
- name: http
port: 8080
protocol: HTTP
---
# Service as MCP Tool - points to MCPServer backend
apiVersion: v1
kind: Service
metadata:
name: test-mcp-service
namespace: kagent
annotations:
kagent.dev/mcp-service-port: "3000"
kagent.dev/mcp-service-path: "/mcp"
kagent.dev/mcp-service-protocol: "streamable-http"
spec:
ports:
- name: mcp
port: 3000
targetPort: 3000
protocol: TCP
appProtocol: mcp
selector:
app.kubernetes.io/name: everything-mcp-server
---
# HTTPRoute for MCPServer
apiVersion: gateway.networking.k8s.io/v1
kind: HTTPRoute
metadata:
name: mcpserver-route
namespace: kagent
spec:
parentRefs:
- name: proxy
namespace: kagent
rules:
- matches:
- headers:
- type: Exact
name: x-kagent-host
value: everything-mcp-server.kagent
backendRefs:
- name: everything-mcp-server
port: 3000
---
# HTTPRoute for Service
apiVersion: gateway.networking.k8s.io/v1
kind: HTTPRoute
metadata:
name: service-route
namespace: kagent
spec:
parentRefs:
- name: proxy
namespace: kagent
rules:
- matches:
- headers:
- type: Exact
name: x-kagent-host
value: test-mcp-service.kagent
backendRefs:
- name: test-mcp-service
port: 3000
---
# Target Agent for agent-to-agent testing through proxy
apiVersion: kagent.dev/v1alpha2
kind: Agent
metadata:
name: target-agent-proxy-test
namespace: kagent
spec:
type: Declarative
declarative:
modelConfig: proxy-test-model-config
systemMessage: You are a target agent that responds to requests through the proxy.
deployment:
imagePullPolicy: Always
env:
- name: LOG_LEVEL
value: DEBUG
---
# HTTPRoute for Target Agent
apiVersion: gateway.networking.k8s.io/v1
kind: HTTPRoute
metadata:
name: target-agent-route
namespace: kagent
spec:
parentRefs:
- name: proxy
namespace: kagent
rules:
- matches:
- headers:
- type: Exact
name: x-kagent-host
value: target-agent-proxy-test.kagent
backendRefs:
- name: target-agent-proxy-test
port: 8080
216 changes: 216 additions & 0 deletions go/test/e2e/mocks/invoke_proxy_test.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,216 @@
{
"_comment": "Mock LLM responses for proxy test. Flow: User -> Controller -> proxy-test-agent (uses these mocks) -> Proxy -> Backend. The proxy-test-agent receives user messages and makes tool calls through the proxy gateway.",
"openai": [
{
"name": "agent_to_agent_request",
"match": {
"match_type": "contains",
"message": {
"content": "call the target agent",
"role": "user"
}
},
"response": {
"id": "chatcmpl-proxy-1",
"object": "chat.completion",
"created": 1677652288,
"model": "gpt-4.1-mini",
"choices": [
{
"index": 0,
"role": "assistant",
"message": {
"content": "",
"tool_calls": [
{
"id": "call_agent_1",
"type": "function",
"function": {
"name": "kagent__NS__target_agent_proxy_test",
"arguments": "{\"request\": \"hello from main agent\"}"
}
}
]
},
"finish_reason": "tool_calls"
}
]
}
},
{
"name": "agent_to_agent_response",
"match": {
"match_type": "contains",
"message": {
"content": "target agent response",
"role": "tool",
"tool_call_id": "call_agent_1"
}
},
"response": {
"id": "chatcmpl-proxy-2",
"object": "chat.completion",
"created": 1677652289,
"model": "gpt-4.1-mini",
"choices": [
{
"index": 0,
"message": {
"content": "Successfully called target agent through proxy. Response: target agent response",
"role": "assistant"
}
}
]
}
},
{
"name": "service_mcp_tool_request",
"match": {
"match_type": "contains",
"message": {
"content": "use the service tool to add 5 and 7",
"role": "user"
}
},
"response": {
"id": "chatcmpl-proxy-3",
"object": "chat.completion",
"created": 1677652290,
"model": "gpt-4.1-mini",
"choices": [
{
"index": 0,
"role": "assistant",
"message": {
"content": "",
"tool_calls": [
{
"id": "call_service_1",
"type": "function",
"function": {
"name": "get-sum",
"arguments": "{\"a\": 5, \"b\": 7}"
}
}
]
},
"finish_reason": "tool_calls"
}
]
}
},
{
"name": "service_mcp_tool_response",
"match": {
"match_type": "contains",
"message": {
"content": "12",
"role": "tool",
"tool_call_id": "call_service_1"
}
},
"response": {
"id": "chatcmpl-proxy-4",
"object": "chat.completion",
"created": 1677652291,
"model": "gpt-4.1-mini",
"choices": [
{
"index": 0,
"message": {
"content": "Successfully used service tool through proxy. Result: 12",
"role": "assistant"
}
}
]
}
},
{
"name": "mcpserver_tool_request",
"match": {
"match_type": "contains",
"message": {
"content": "use the mcp server",
"role": "user"
}
},
"response": {
"id": "chatcmpl-proxy-5",
"object": "chat.completion",
"created": 1677652292,
"model": "gpt-4.1-mini",
"choices": [
{
"index": 0,
"role": "assistant",
"message": {
"content": "",
"tool_calls": [
{
"id": "call_mcp_1",
"type": "function",
"function": {
"name": "get-sum",
"arguments": "{\"a\": 10, \"b\": 20}"
}
}
]
},
"finish_reason": "tool_calls"
}
]
}
},
{
"name": "mcpserver_tool_response",
"match": {
"match_type": "contains",
"message": {
"content": "30",
"role": "tool",
"tool_call_id": "call_mcp_1"
}
},
"response": {
"id": "chatcmpl-proxy-6",
"object": "chat.completion",
"created": 1677652293,
"model": "gpt-4.1-mini",
"choices": [
{
"index": 0,
"message": {
"content": "Successfully used MCP server through proxy. Result: 30",
"role": "assistant"
}
}
]
}
},
{
"name": "target_agent_request",
"match": {
"match_type": "contains",
"message": {
"content": "hello from main agent",
"role": "user"
}
},
"response": {
"id": "chatcmpl-target-1",
"object": "chat.completion",
"created": 1677652294,
"model": "gpt-4.1-mini",
"choices": [
{
"index": 0,
"message": {
"content": "target agent response: I received your message through the proxy!",
"role": "assistant"
}
}
]
}
}
]
}
Loading
Loading