Skip to content
Latest (currently 2026.10.2) has the newest features, bug fixes, and CVE patches 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.

Agentgateway egress from an ambient mesh

Page as Markdown

Use agentgateway as an egress waypoint to enforce Layer 7 policies on traffic leaving your ambient mesh.

Note

This feature requires the following licenses. Contact your account representative to obtain valid licenses.

  • Your ambient mesh must be installed with the Solo distribution of Istio and an Enterprise-level license for Solo Enterprise for Istio.
  • A Solo Enterprise for agentgateway license.

You can deploy Solo Enterprise for agentgateway as an egress waypoint to apply L7 policies to traffic leaving your ambient mesh. This guide covers cases in which your application manages its own credentials and you want to control which service accounts can make outbound calls to an external API. The agentgateway waypoint enforces allow/deny policy on the traffic, but does not inject credentials or perform provider-aware routing.

If you want agentgateway to manage API credentials and perform provider-aware routing to LLM backends (the east-west equivalent of the standalone LLM provider guides), see the AI provider backends with agentgateway waypoint guide instead.

Before you begin

Install or upgrade Solo Enterprise for agentgateway with the Istio integration enabled. When Istio integration is enabled, the controller registers the enterprise-agentgateway-waypoint GatewayClass and provisions waypoint pods with Istio certificates from Istiod.

  • Install: Install the agentgateway control plane. Include --set istio.autoEnabled=true in the Helm install command to enable the Istio integration for all gateways cluster-wide.
  • Upgrade: Upgrade your installation to include the istio.autoEnabled=true setting. Update the version as needed.
    helm get values enterprise-agentgateway -n agentgateway-system -o yaml > values.yaml
    helm upgrade -i -n agentgateway-system enterprise-agentgateway oci://us-docker.pkg.dev/solo-public/enterprise-agentgateway/charts/enterprise-agentgateway \
    -f values.yaml \
    --set istio.autoEnabled=true \
    --version v2026.10.2

Install a Solo Enterprise for Istio ambient mesh

Install an ambient mesh that runs the Solo distribution of Istio 1.30 or later with an Enterprise-level Solo Enterprise for Istio license. To set up an ambient mesh, see the install guides for a single cluster or multicluster mesh.

Deploy an egress waypoint

  1. Set the workload namespace where your workloads run. All resources in this guide are created in this namespace.

    export NAMESPACE=<ns>
  2. Create a Gateway resource for the egress waypoint. Because egress targets are represented as ServiceEntries rather than Kubernetes Services, you must use istio.io/waypoint-for: all.

    kubectl apply -f - <<EOF
    apiVersion: gateway.networking.k8s.io/v1
    kind: Gateway
    metadata:
      name: egress-waypoint
      namespace: ${NAMESPACE}
      labels:
        istio.io/waypoint-for: all
    spec:
      gatewayClassName: enterprise-agentgateway-waypoint
      listeners:
      - name: mesh
        port: 15008
        protocol: HBONE
    EOF
  3. Verify that the egress waypoint pod is running and the Gateway is programmed.

    kubectl get pods -n ${NAMESPACE} -l gateway.networking.k8s.io/gateway-name=egress-waypoint
    kubectl get gateway egress-waypoint -n ${NAMESPACE}

    Example output:

    NAME                               READY   STATUS    RESTARTS   AGE
    egress-waypoint-757fdbb564-44nz2   1/1     Running   0          11s
    
    NAME              CLASS                              ADDRESS         PROGRAMMED   AGE
    egress-waypoint   enterprise-agentgateway-waypoint   172.20.235.25   True         23s

Register the external AI API

  1. Create a ServiceEntry for the external AI API, such as the OpenAI API. Your workloads send plain HTTP to port 80 and the targetPort: 443 setting sends the traffic on to port 443 of the API. Because the waypoint receives plain HTTP inside the mTLS tunnel, it can read each request and enforce HTTP policies, such as rules on the request method.

    Your agents must call the API with an http:// base URL, such as http://api.openai.com/v1. The ServiceEntry registers only port 80. A request to https://api.openai.com uses port 443, so it does not pass through the egress waypoint and the allow policy in this guide does not apply to it. This guide does not block port 443. To keep agents from calling the API directly, deny egress to port 443 from your agent workloads with a control outside the waypoint, such as a Kubernetes NetworkPolicy or a firewall rule.

    kubectl apply -f - <<EOF
    apiVersion: networking.istio.io/v1
    kind: ServiceEntry
    metadata:
      name: openai-api
      namespace: ${NAMESPACE}
    spec:
      hosts:
      - api.openai.com
      ports:
      - number: 80
        name: http
        protocol: HTTP
        targetPort: 443
      resolution: DNS
      location: MESH_EXTERNAL
    EOF
  2. Label the ServiceEntry to route traffic through the egress waypoint.

    kubectl label serviceentry openai-api \
      -n ${NAMESPACE} \
      istio.io/use-waypoint=egress-waypoint
  3. Apply an EnterpriseAgentgatewayPolicy that originates TLS from the waypoint to the external AI API. The waypoint opens its own TLS connection to api.openai.com and verifies the server certificate with the system’s trusted certificates.

    kubectl apply -f - <<EOF
    apiVersion: enterpriseagentgateway.solo.io/v1alpha1
    kind: EnterpriseAgentgatewayPolicy
    metadata:
      name: openai-tls
      namespace: ${NAMESPACE}
    spec:
      targetRefs:
      - kind: ServiceEntry
        group: "networking.istio.io"
        name: openai-api
      backend:
        tls:
          sni: api.openai.com
    EOF

Restrict which agents can call the API

Apply an EnterpriseAgentgatewayPolicy to allow only specific service accounts to make calls to the external AI API. The policy denies all traffic by default, so any workload not listed in matchExpressions receives a 403 directly from the waypoint — before the request reaches OpenAI. This 403 (rather than a 401 from the upstream API) confirms the waypoint is intercepting and enforcing policy on the traffic.

  1. Set the service account of your agent workload.

    export AGENT_SERVICE_ACCOUNT=<your_agent_sa>
  2. Apply an EnterpriseAgentgatewayPolicy. The following example allows POST requests from a single agent service account.

    kubectl apply -f - <<EOF
    apiVersion: enterpriseagentgateway.solo.io/v1alpha1
    kind: EnterpriseAgentgatewayPolicy
    metadata:
      name: openai-allow-agent-only
      namespace: ${NAMESPACE}
    spec:
      targetRefs:
      - kind: ServiceEntry
        group: "networking.istio.io"
        name: openai-api
      traffic:
        authorization:
          action: Allow
          policy:
            matchExpressions:
            - 'source.identity.namespace == "${NAMESPACE}" && source.identity.serviceAccount == "${AGENT_SERVICE_ACCOUNT}" && request.method == "POST"'
    EOF

    To allow multiple agents, add an expression for each service account.

            matchExpressions:
            - 'source.identity.namespace == "${NAMESPACE}" && source.identity.serviceAccount == "agent-a" && request.method == "POST"'
            - 'source.identity.namespace == "${NAMESPACE}" && source.identity.serviceAccount == "agent-b" && request.method == "POST"'
  3. Deploy an unauthorized test pod that runs under the default service account.

    kubectl run curl-unauth -n ${NAMESPACE} --image=curlimages/curl --restart=Never -- sleep 3600
  4. Deploy an authorized test pod that runs under the agent service account.

    kubectl run curl-auth -n ${NAMESPACE} --image=curlimages/curl \
      --restart=Never --overrides="{\"spec\":{\"serviceAccountName\":\"${AGENT_SERVICE_ACCOUNT}\"}}" \
      -- sleep 3600
  5. Verify that the waypoint enforces the policy by sending a request from the unauthorized pod. The waypoint returns a 403 before the request reaches OpenAI.

    kubectl exec -n ${NAMESPACE} curl-unauth -- \
      curl -s -o /dev/null -w "%{http_code}" -X POST http://api.openai.com/v1/chat/completions \
      -H "content-type: application/json" \
      -d '{"model": "gpt-4o-mini", "messages": [{"role": "user", "content": "Hello"}]}'
  6. Confirm that the authorized pod can reach OpenAI. The request carries no API key, so OpenAI returns a 401. This 401 comes from OpenAI, so it confirms that the waypoint allowed the request.

    kubectl exec -n ${NAMESPACE} curl-auth -- \
      curl -s -o /dev/null -w "%{http_code}" -X POST http://api.openai.com/v1/chat/completions \
      -H "content-type: application/json" \
      -d '{"model": "gpt-4o-mini", "messages": [{"role": "user", "content": "Hello"}]}'
  7. Verify that the in-mesh segment of the traffic (from your workload to the egress waypoint) uses mTLS. For more information about this command, see the CLI reference.

    istioctl ztunnel-config connections --workload-namespace ${NAMESPACE}

    The PROTOCOL column shows HBONE for inbound connections to the egress waypoint pod, confirming that workload-to-waypoint traffic is mutually authenticated over HBONE.

    Example output:

    WORKLOAD                                          DIRECTION   LOCAL              REMOTE           REMOTE TARGET         PROTOCOL   CONN ID
    egress-waypoint-757fdbb564-44nz2.<ns>              Inbound     10.0.0.10:15008    10.0.0.3:54210   api.openai.com:80     HBONE      1a2b3c4d

Note

To capture per-request observability, you can configure access logging for the agentgateway waypoint. Access logs are not enabled by default. For configuration steps, see the Solo Enterprise for agentgateway documentation.

Cleanup

If you no longer need them, you can remove all resources that you created in this guide.

kubectl delete pod curl-unauth curl-auth -n ${NAMESPACE}
kubectl delete enterpriseagentgatewaypolicy openai-allow-agent-only openai-tls -n ${NAMESPACE}
kubectl delete serviceentry openai-api -n ${NAMESPACE}
kubectl delete gateway egress-waypoint -n ${NAMESPACE}