Skip to content

armgit / ax

Public Imported from GitHub
0

Agent Executor (AX) is Google's open agentic orchestration runtime

Go

Remove ununsed axepp (#182)

Jaana Dogane7d5e2c8c6da
diff --git a/Makefile b/Makefile
index d81ca53..2808b86 100644
--- a/Makefile
+++ b/Makefile
@@ -69,14 +69,10 @@ ax-server-image:
@echo "Building ax-server container image with ko..."
ko build --base-import-paths ./cmd/ax
-axepp-image:
- @echo "Building axepp container image with ko..."
- ko build --base-import-paths ./cmd/axepp
-
ax-shell-image:
# Used to debug ax servers within a cluster.
@echo "Building ax shell container image with ko using busybox..."
KO_DOCKER_REPO=$(KO_DOCKER_REPO)/ax-shell KO_DEFAULTBASEIMAGE=busybox:1.36 ko build --base-import-paths ./cmd/ax
# Build all container images
-images: ax-image axepp-image ax-shell-image
+images: ax-image ax-shell-image
diff --git a/cmd/axepp/main.go b/cmd/axepp/main.go
deleted file mode 100644
index a045820..0000000
--- a/cmd/axepp/main.go
+++ /dev/null
@@ -1,202 +0,0 @@
-
-// Copyright 2026 Google LLC
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-// Command axepp is an Envoy External Processing (ext_authz) plugin for the ax server.
-// Intercepts Exec and DeleteConversation gRPC requests to
-// extract conversation IDs and safely initiate session/actor resumption.
-package main
-
-import (
- "context"
- "crypto/tls"
- "crypto/x509"
- "flag"
- "fmt"
- "log/slog"
- "net"
- "os"
-
- "github.com/agent-substrate/substrate/pkg/proto/ateapipb"
- corepb "github.com/envoyproxy/go-control-plane/envoy/config/core/v3"
- authv3 "github.com/envoyproxy/go-control-plane/envoy/service/auth/v3"
- "github.com/google/ax/proto"
- gapistatus "google.golang.org/genproto/googleapis/rpc/status"
- "google.golang.org/grpc"
- "google.golang.org/grpc/codes"
- "google.golang.org/grpc/credentials"
- "google.golang.org/grpc/status"
- protov2 "google.golang.org/protobuf/proto"
-)
-
-var (
- port = flag.Int("port", 50051, "The port for the gRPC authorization server to listen on")
- axPort = flag.String("ax-port", "8494", "The port where the AX server is listening on")
- grpcServerCredBundle = flag.String("grpc-server-cred-bundle", "", "File with the server TLS credential bundle.")
- actorTemplateNamespace = flag.String("actor-template-namespace", "ax", "The Actor Template namespace to use for resuming sessions.")
- actorTemplateName = flag.String("actor-template-name", "ax-template", "The Actor Template name to use for resuming sessions.")
-)
-
-type authServer struct {
- sc ateapipb.ControlClient
-}
-
-func runSession(ctx context.Context, sc ateapipb.ControlClient, sessionID string) (*authv3.CheckResponse, error) {
- slog.InfoContext(ctx, "About to call CreateActor", slog.Any("actor-id", sessionID))
- if _, err := sc.CreateActor(ctx, &ateapipb.CreateActorRequest{
- ActorId: sessionID,
- ActorTemplateNamespace: *actorTemplateNamespace,
- ActorTemplateName: *actorTemplateName,
- }); err != nil {
- if status.Code(err) != codes.AlreadyExists {
- slog.ErrorContext(ctx, "CreateActor error", slog.Any("error", err))
- return &authv3.CheckResponse{
- Status: &gapistatus.Status{Code: int32(codes.Unavailable), Message: err.Error()},
- }, nil
- }
- }
-
- slog.InfoContext(ctx, "About to call ResumeActor", slog.Any("actor-id", sessionID))
- resp, err := sc.ResumeActor(ctx, &ateapipb.ResumeActorRequest{
- ActorId: sessionID,
- })
- if err != nil {
- slog.InfoContext(ctx, "ResumeActor error", slog.Any("error", err))
- return &authv3.CheckResponse{
- Status: &gapistatus.Status{Code: int32(codes.Unavailable), Message: err.Error()},
- }, nil
- }
-
- destinationIP := resp.GetActor().GetAteomPodIp()
- destrinationAddr := net.JoinHostPort(destinationIP, *axPort)
- slog.InfoContext(ctx, "Redirecting request to backend", slog.String("address", destrinationAddr))
-
- var headers []*corepb.HeaderValueOption
-
- headers = append(headers, &corepb.HeaderValueOption{
- Header: &corepb.HeaderValue{
- Key: "x-backend-ip",
- Value: destrinationAddr,
- },
- })
-
- return &authv3.CheckResponse{
- Status: &gapistatus.Status{Code: int32(codes.OK)},
- HttpResponse: &authv3.CheckResponse_OkResponse{
- OkResponse: &authv3.OkHttpResponse{
- Headers: headers,
- },
- },
- }, nil
-}
-
-func route(ctx context.Context, sc ateapipb.ControlClient, body []byte, req protov2.Message, pathName string, extractor func() string) (*authv3.CheckResponse, error) {
- if len(body) <= 5 {
- return nil, fmt.Errorf("body too short for path %s", pathName)
- }
-
- payload := body[5:]
- if err := protov2.Unmarshal(payload, req); err != nil {
- return nil, fmt.Errorf("failed to unmarshal request for path %s: %w", pathName, err)
- }
- conversationID := extractor()
- slog.InfoContext(ctx, "Extracted conversation ID", slog.String("path", pathName), slog.String("conversation_id", conversationID))
- if conversationID == "" {
- return nil, fmt.Errorf("empty conversation ID extracted for path %s", pathName)
- }
- return runSession(ctx, sc, conversationID)
-}
-
-func (s *authServer) Check(ctx context.Context, req *authv3.CheckRequest) (*authv3.CheckResponse, error) {
- httpReq := req.GetAttributes().GetRequest().GetHttp()
- path := httpReq.GetPath()
-
- slog.InfoContext(ctx, "axepp Check received request", slog.String("method", httpReq.GetMethod()), slog.String("path", path))
-
- defaultResp := &authv3.CheckResponse{
- Status: &gapistatus.Status{Code: int32(codes.OK)},
- HttpResponse: &authv3.CheckResponse_OkResponse{
- OkResponse: &authv3.OkHttpResponse{},
- },
- }
-
- body := httpReq.GetRawBody()
-
- switch path {
- case "/ax.ControllerService/Exec":
- var execReq proto.ExecRequest
- resp, err := route(ctx, s.sc, body, &execReq, path, func() string { return execReq.GetConversationId() })
- if err != nil {
- slog.ErrorContext(ctx, "EPP routing failed", slog.String("path", path), slog.Any("error", err))
- }
- return resp, err
- case "/ax.ConversationService/DeleteConversation":
- var delReq proto.DeleteConversationRequest
- resp, err := route(ctx, s.sc, body, &delReq, path, func() string { return delReq.GetConversationId() })
- if err != nil {
- slog.ErrorContext(ctx, "EPP routing failed", slog.String("path", path), slog.Any("error", err))
- }
- return resp, err
- }
- return defaultResp, nil
-}
-
-func main() {
- flag.Parse()
-
- slog.SetDefault(slog.New(slog.NewJSONHandler(os.Stdout, nil)))
-
- scAddress := "api.ate-system.svc:443"
- clientTLSConfig := &tls.Config{
- InsecureSkipVerify: true,
- }
-
- if *grpcServerCredBundle != "" {
- bundleBytes, err := os.ReadFile(*grpcServerCredBundle)
- if err != nil {
- slog.Error("Failed to read bundle", slog.Any("error", err))
- os.Exit(1)
- }
- certPool := x509.NewCertPool()
- if ok := certPool.AppendCertsFromPEM(bundleBytes); ok {
- clientTLSConfig.RootCAs = certPool
- }
- }
-
- clientCreds := credentials.NewTLS(clientTLSConfig)
- conn, err := grpc.NewClient(scAddress, grpc.WithTransportCredentials(clientCreds))
- if err != nil {
- slog.Error("did not connect to substrate control", slog.Any("error", err))
- os.Exit(1)
- }
- defer conn.Close()
-
- sc := ateapipb.NewControlClient(conn)
-
- lis, err := net.Listen("tcp", fmt.Sprintf(":%d", *port))
- if err != nil {
- slog.Error("Failed to listen", slog.Int("port", *port), slog.Any("error", err))
- os.Exit(1)
- }
-
- s := grpc.NewServer()
- as := &authServer{sc: sc}
- authv3.RegisterAuthorizationServer(s, as)
-
- slog.Info("ax Envoy Authorization Service (ext_authz) listening", slog.Any("address", lis.Addr()))
- if err := s.Serve(lis); err != nil {
- slog.Error("Failed to serve gRPC server", slog.Any("error", err))
- os.Exit(1)
- }
-}
diff --git a/go.mod b/go.mod
index de994c6..e64a114 100644
--- a/go.mod
+++ b/go.mod
@@ -6,13 +6,11 @@ require (
charm.land/huh/v2 v2.0.3
charm.land/lipgloss/v2 v2.0.3
github.com/agent-substrate/substrate v0.0.0-20260622205654-fe93d160a1df
- github.com/envoyproxy/go-control-plane/envoy v1.37.0
github.com/google/uuid v1.6.0
github.com/jackc/pgx/v5 v5.10.0
github.com/spf13/cobra v1.10.2
golang.org/x/oauth2 v0.36.0
google.golang.org/genai v1.43.0
- google.golang.org/genproto/googleapis/rpc v0.0.0-20260406210006-6f92a3bedf2d
google.golang.org/grpc v1.81.0
google.golang.org/protobuf v1.36.12-0.20260120151049-f2248ac996af
gopkg.in/yaml.v3 v3.0.1
@@ -38,9 +36,7 @@ require (
github.com/charmbracelet/x/windows v0.2.2 // indirect
github.com/clipperhouse/displaywidth v0.11.0 // indirect
github.com/clipperhouse/uax29/v2 v2.7.0 // indirect
- github.com/cncf/xds/go v0.0.0-20260202195803-dba9d589def2 // indirect
github.com/dustin/go-humanize v1.0.1 // indirect
- github.com/envoyproxy/protoc-gen-validate v1.3.3 // indirect
github.com/felixge/httpsnoop v1.0.4 // indirect
github.com/go-logr/logr v1.4.3 // indirect
github.com/go-logr/stdr v1.2.2 // indirect
@@ -59,7 +55,6 @@ require (
github.com/mitchellh/hashstructure/v2 v2.0.2 // indirect
github.com/muesli/cancelreader v0.2.2 // indirect
github.com/ncruces/go-strftime v1.0.0 // indirect
- github.com/planetscale/vtprotobuf v0.6.1-0.20240319094008-0393e58bdf10 // indirect
github.com/remyoudompheng/bigfft v0.0.0-20230129092748-24d4a6f8daec // indirect
github.com/rivo/uniseg v0.4.7 // indirect
github.com/spf13/pflag v1.0.10 // indirect
@@ -75,6 +70,7 @@ require (
golang.org/x/sys v0.45.0 // indirect
golang.org/x/text v0.37.0 // indirect
google.golang.org/api v0.274.0 // indirect
+ google.golang.org/genproto/googleapis/rpc v0.0.0-20260406210006-6f92a3bedf2d // indirect
modernc.org/libc v1.70.0 // indirect
modernc.org/mathutil v1.7.1 // indirect
modernc.org/memory v1.11.0 // indirect
diff --git a/go.sum b/go.sum
index 62b9539..9d79a77 100644
--- a/go.sum
+++ b/go.sum
@@ -52,8 +52,6 @@ github.com/clipperhouse/displaywidth v0.11.0 h1:lBc6kY44VFw+TDx4I8opi/EtL9m20WSE
github.com/clipperhouse/displaywidth v0.11.0/go.mod h1:bkrFNkf81G8HyVqmKGxsPufD3JhNl3dSqnGhOoSD/o0=
github.com/clipperhouse/uax29/v2 v2.7.0 h1:+gs4oBZ2gPfVrKPthwbMzWZDaAFPGYK72F0NJv2v7Vk=
github.com/clipperhouse/uax29/v2 v2.7.0/go.mod h1:EFJ2TJMRUaplDxHKj1qAEhCtQPW2tJSwu5BF98AuoVM=
-github.com/cncf/xds/go v0.0.0-20260202195803-dba9d589def2 h1:aBangftG7EVZoUb69Os8IaYg++6uMOdKK83QtkkvJik=
-github.com/cncf/xds/go v0.0.0-20260202195803-dba9d589def2/go.mod h1:qwXFYgsP6T7XnJtbKlf1HP8AjxZZyzxMmc+Lq5GjlU4=
github.com/cpuguy83/go-md2man/v2 v2.0.6/go.mod h1:oOW0eioCTA6cOiMLiUPZOpcVxMig6NIQQ7OS05n1F4g=
github.com/creack/pty v1.1.24 h1:bJrF4RRfyJnbTJqzRLHzcGaZK1NeM5kTC9jGgovnR1s=
github.com/creack/pty v1.1.24/go.mod h1:08sCNb52WyoAwi2QDyzUCTgcvVFhUzewun7wtTfvcwE=
@@ -62,10 +60,6 @@ github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc h1:U9qPSI2PIWSS1
github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/dustin/go-humanize v1.0.1 h1:GzkhY7T5VNhEkwH0PVJgjz+fX1rhBrR7pRT3mDkpeCY=
github.com/dustin/go-humanize v1.0.1/go.mod h1:Mu1zIs6XwVuF/gI1OepvI0qD18qycQx+mFykh5fBlto=
-github.com/envoyproxy/go-control-plane/envoy v1.37.0 h1:u3riX6BoYRfF4Dr7dwSOroNfdSbEPe9Yyl09/B6wBrQ=
-github.com/envoyproxy/go-control-plane/envoy v1.37.0/go.mod h1:DReE9MMrmecPy+YvQOAOHNYMALuowAnbjjEMkkWOi6A=
-github.com/envoyproxy/protoc-gen-validate v1.3.3 h1:MVQghNeW+LZcmXe7SY1V36Z+WFMDjpqGAGacLe2T0ds=
-github.com/envoyproxy/protoc-gen-validate v1.3.3/go.mod h1:TsndJ/ngyIdQRhMcVVGDDHINPLWB7C82oDArY51KfB0=
github.com/felixge/httpsnoop v1.0.4 h1:NFTV2Zj1bL4mc9sqWACXbQFVBBg2W3GPvqp8/ESS2Wg=
github.com/felixge/httpsnoop v1.0.4/go.mod h1:m8KPJKqk1gH5J9DgRY2ASl2lWCfGKXixSwevea8zH2U=
github.com/go-logr/logr v1.2.2/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A=
@@ -117,8 +111,6 @@ github.com/muesli/cancelreader v0.2.2 h1:3I4Kt4BQjOR54NavqnDogx/MIoWBFa0StPA8ELU
github.com/muesli/cancelreader v0.2.2/go.mod h1:3XuTXfFS2VjM+HTLZY9Ak0l6eUKfijIfMUZ4EgX0QYo=
github.com/ncruces/go-strftime v1.0.0 h1:HMFp8mLCTPp341M/ZnA4qaf7ZlsbTc+miZjCLOFAw7w=
github.com/ncruces/go-strftime v1.0.0/go.mod h1:Fwc5htZGVVkseilnfgOVb9mKy6w1naJmn9CehxcKcls=
-github.com/planetscale/vtprotobuf v0.6.1-0.20240319094008-0393e58bdf10 h1:GFCKgmp0tecUJ0sJuv4pzYCqS9+RGSn52M3FUwPs+uo=
-github.com/planetscale/vtprotobuf v0.6.1-0.20240319094008-0393e58bdf10/go.mod h1:t/avpk3KcrXxUnYOhZhMXJlSEyie6gQbtLq5NM3loB8=
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 h1:Jamvg5psRIccs7FGNTlIRMkT8wgtp5eCXdBlqhYGL6U=
github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=