Skip to content
Review the docs for the 2.3 LTS version of Solo Enterprise for agentgateway.

For the complete documentation index, see llms.txt. Markdown versions of all docs pages are available by appending .md to any docs URL.

Connect to an agent

Page as Markdown

With agentgateway, you can route to agent-to-agent (A2A) servers and expose their tools securely.

Before you begin

Install the Solo Enterprise for agentgateway control plane by following the quick start guide.

Step 1: Deploy an A2A server

Deploy an A2A server that you want agentgateway to proxy traffic to. Notice that the Service uses the appProtocol: kgateway.dev/a2a setting. This way, Solo Enterprise for agentgateway configures the agentgateway proxy to use the A2A protocol.

kubectl apply -f- <<EOF
apiVersion: apps/v1
kind: Deployment
metadata:
  name: a2a-agent
  labels:
    app: a2a-agent
spec:
  selector:
    matchLabels:
      app: a2a-agent
  template:
    metadata:
      labels:
        app: a2a-agent
    spec:
      containers:
        - name: a2a-agent
          image: gcr.io/solo-public/docs/test-a2a-agent:latest
          ports:
            - containerPort: 9090
---
apiVersion: v1
kind: Service
metadata:
  name: a2a-agent
spec:
  selector:
    app: a2a-agent
  type: ClusterIP
  ports:
    - protocol: TCP
      port: 9090
      targetPort: 9090
      appProtocol: kgateway.dev/a2a
EOF

Step 2: Route with agentgateway

Create an HTTPRoute resource that routes incoming traffic to the A2A server. The route matches the /myagent path so that the A2A server has a unique address on the gateway, and rewrites the path to / so that requests reach the A2A server, which listens on the root path.

kubectl apply -f- <<EOF
apiVersion: gateway.networking.k8s.io/v1
kind: HTTPRoute
metadata:
  name: a2a
spec:
  parentRefs:
  - name: agentgateway-proxy
    namespace: agentgateway-system
  rules:
  - matches:
    - path:
        type: PathPrefix
        value: /myagent
    filters:
    - type: URLRewrite
      urlRewrite:
        path:
          type: ReplacePrefixMatch
          replacePrefixMatch: /
    backendRefs:
      - name: a2a-agent
        port: 9090
EOF

Step 3: Verify the connection

  1. Get the agentgateway address.

    export INGRESS_GW_ADDRESS=$(kubectl get gateway agentgateway-proxy -n agentgateway-system -o=jsonpath="{.status.addresses[0].value}")
    echo $INGRESS_GW_ADDRESS
    kubectl port-forward deployment/agentgateway-proxy -n agentgateway-system 8080:80
  2. As a user, send a request to the A2A server. As an assistant, the agent echoes back the message that you sent.

    curl -X POST http://$INGRESS_GW_ADDRESS/myagent \
      -H "Content-Type: application/json" \
        -v \
        -d '{
      "jsonrpc": "2.0",
      "id": "1",
      "method": "tasks/send",
      "params": {
        "id": "1",
        "message": {
          "role": "user",
          "parts": [
            {
              "type": "text",
              "text": "hello gateway!"
            }
          ]
        }
      }
      }' | jq
    curl -X POST http://localhost:8080/myagent \
      -H "Content-Type: application/json" \
        -v \
        -d '{
      "jsonrpc": "2.0",
      "id": "1",
      "method": "tasks/send",
      "params": {
        "id": "1",
        "message": {
          "role": "user",
          "parts": [
            {
              "type": "text",
              "text": "hello gateway!"
            }
          ]
        }
      }
      }' | jq

    Example output:

    {
      "jsonrpc": "2.0",
      "id": "1",
      "result": {
        "id": "1",
        "message": {
          "role": "assistant",
          "parts": [
            {
              "type": "text",
              "text": "hello gateway!"
            }
          ]
        }
      }
    }

Cleanup

You can remove the resources that you created in this guide.
kubectl delete Deployment a2a-agent --ignore-not-found
kubectl delete Service a2a-agent --ignore-not-found
kubectl delete HTTPRoute a2a --ignore-not-found
kubectl delete EnterpriseAgentgatewayBackend a2a-backend --ignore-not-found