Agent Executor (AX) is Google's open agentic orchestration runtime
Go
sync code with latest substrate API changes (#348)
Dmitry Berkovichf220cec527f3
diff --git a/cmd/axepp/main.go b/cmd/axepp/main.goindex 3fe96a4..d3349c7 100644--- a/cmd/axepp/main.go+++ b/cmd/axepp/main.go@@ -38,6 +38,7 @@ import ("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")@@ -54,16 +55,23 @@ type authServer struct {}func runSession(ctx context.Context, sc ateapipb.ControlClient, sessionID string) (*authv3.CheckResponse, error) {- key := &ateapipb.ActorKey{+ 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,- ActorId: sessionID,+ }); 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 with AutoCreate", slog.Any("actor-key", key))+ slog.InfoContext(ctx, "About to call ResumeActor", slog.Any("actor-id", sessionID))resp, err := sc.ResumeActor(ctx, &ateapipb.ResumeActorRequest{- ActorKey: key,- AutoCreate: true,+ ActorId: sessionID,})if err != nil {slog.InfoContext(ctx, "ResumeActor error", slog.Any("error", err))diff --git a/hack/install-ax.sh b/hack/install-ax.shnew file mode 100755index 0000000..9885092--- /dev/null+++ b/hack/install-ax.sh@@ -0,0 +1,117 @@+#!/bin/bash+# 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.++set -e+set -u+set -o pipefail++ROOT=$(git rev-parse --show-toplevel)+cd "${ROOT}"++# ANSI color codes for prettier output+COLOR_CYAN='\033[1;36m'+COLOR_RESET='\033[0m'++function log_step() {+ local step_name="$1"+ echo -e "${COLOR_CYAN}[step]: ${step_name}${COLOR_RESET}"+}++function usage() {+ echo "Usage: $0 [options]"+ echo ""+ echo "Options:"+ echo " --deploy-ax-server Deploy AX server and components using ko"+ echo " --delete-ax-server Delete AX server and components from cluster"+ echo " -h, --help Show this help message"+}++run_kubectl() {+ kubectl \+ ${KUBECTL_CONTEXT:+--context=${KUBECTL_CONTEXT}} \+ "$@"+}++run_ko() {+ GOFLAGS="-tags=ate" ko apply \+ ${KUBECTL_CONTEXT:+--context=${KUBECTL_CONTEXT}} \+ "$@"+}++deploy_ax_server() {+ log_step "deploy_ax_server"++ # Check dependencies+ if [[ -z "${GEMINI_API_KEY:-}" ]]; then+ echo "Error: GEMINI_API_KEY environment variable must be set" >&2+ exit 1+ fi+ if [[ -z "${BUCKET_NAME:-}" ]]; then+ echo "Error: BUCKET_NAME environment variable must be set" >&2+ exit 1+ fi++ echo "Using GCS Bucket: ${BUCKET_NAME}"++ # Render template and apply with ko+ sed -e "s|\${GEMINI_API_KEY}|${GEMINI_API_KEY}|g" \+ -e "s|\${BUCKET_NAME}|${BUCKET_NAME}|g" \+ manifests/ax-deployment.yaml.tmpl \+ | run_ko -f -++ # Apply service+ run_kubectl apply -f manifests/ax-service.yaml+}++delete_ax_server() {+ log_step "delete_ax_server"++ # Delete resources using a dummy key and bucket so credentials aren't required for deletion+ sed -e "s|\${GEMINI_API_KEY}|dummy-key|g" \+ -e "s|\${BUCKET_NAME}|dummy-bucket|g" \+ manifests/ax-deployment.yaml.tmpl \+ | run_kubectl delete --ignore-not-found -f -++ run_kubectl delete --ignore-not-found -f manifests/ax-service.yaml+}++if [ "$#" -eq 0 ]; then+ usage+ exit 1+fi++# If -h or --help appears anywhere in the command line, print the usage and exit.+for arg in "$@"; do+ case "$arg" in+ -h|--help)+ usage+ exit 0+ ;;+ esac+done++while [[ "$#" -gt 0 ]]; do+ case $1 in+ --deploy-ax-server) deploy_ax_server ;;+ --delete-ax-server) delete_ax_server ;;+ *)+ echo "Error: unknown option: $1" >&2+ echo ""+ usage+ exit 1+ ;;+ esac+ shift+donediff --git a/internal/experimental/k8s/ate/client.go b/internal/experimental/k8s/ate/client.goindex 6db289a..b81b0fa 100644--- a/internal/experimental/k8s/ate/client.go+++ b/internal/experimental/k8s/ate/client.go@@ -60,11 +60,9 @@ func NewClient(ns, template, target string, opts ...grpc.DialOption) (*Client, efunc (c *Client) CreateActor(ctx context.Context, execID string) (*ateapipb.CreateActorResponse, error) {client := ateapipb.NewControlClient(c.conn)resp, err := client.CreateActor(ctx, &ateapipb.CreateActorRequest{- ActorKey: &ateapipb.ActorKey{- ActorTemplateNamespace: c.namespace,- ActorTemplateName: c.template,- ActorId: execID,- },+ ActorId: execID,+ ActorTemplateNamespace: c.namespace,+ ActorTemplateName: c.template,})if err != nil {return nil, fmt.Errorf("error when calling Control.CreateActor: %w", err)@@ -76,11 +74,7 @@ func (c *Client) CreateActor(ctx context.Context, execID string) (*ateapipb.Creafunc (c *Client) SuspendActor(ctx context.Context, execID string) (*ateapipb.SuspendActorResponse, error) {client := ateapipb.NewControlClient(c.conn)resp, err := client.SuspendActor(ctx, &ateapipb.SuspendActorRequest{- ActorKey: &ateapipb.ActorKey{- ActorTemplateNamespace: c.namespace,- ActorTemplateName: c.template,- ActorId: execID,- },+ ActorId: execID,})if err != nil {return nil, fmt.Errorf("error when calling Control.SuspendActor: %w", err)diff --git a/manifests/README.md b/manifests/README.mdindex 1928765..4c8ba67 100644--- a/manifests/README.md+++ b/manifests/README.md@@ -10,30 +10,57 @@ The target Kubernetes cluster is assumed to have## 🚀 Deploying to Agent Substrate-This option deploys to isolated, warm-standby actors. Workers are live-snapshotted on boot and instantly restored from GCS when a new conversation starts. Actors are-automatically suspended when conversations stop emitting all of their outputs.+This option deploys AX as isolated, warm-standby actors. Workers are live-snapshotted on boot and instantly restored from GCS when a new conversation starts. Actors are automatically suspended when conversations stop emitting all of their outputs.-### 1. Deploy+### 1. Build and Deploy++> [!NOTE]+> Do not manually edit `manifests/ax-deployment.yaml.tmpl`. The installation script automatically injects your `${GEMINI_API_KEY}` and `${BUCKET_NAME}` environment variables during deployment.++Use the core installation script to build the images and apply the resolved manifests to your cluster:```bash-kubectl apply -f manifests/ax-deployment.yaml-kubectl apply -f manifests/ax-service.yaml+export GEMINI_API_KEY="your-api-key"+export BUCKET_NAME="your-gcs-bucket"+./hack/install-ax.sh --deploy-ax-server```-### 2. Retrieve Public Router IP+This command will:+- Build the AX server and proxy images using `ko`.+- Create the `ax` namespace.+- Create the `WorkerPool` and `ActorTemplate` for AX.++Wait until the template is ready:+```bash+kubectl wait --for=condition=Ready actortemplate/ax-template -n ax --timeout=5m+```++### 2. Port-Forward Services++To interact with the router locally:```bash-kubectl get svc ax-router -n ax+# Port-forward the Ax Router+kubectl port-forward -n ax svc/ax-router 8001:443```-*Wait until the `EXTERNAL-IP` transitions from `<pending>` to a public IP (e.g., `34.57.137.14`).*### 3. Test End-to-End+Run an execution targeting the deployed server using the external IP:+```bash-ax exec --server=<EXTERNAL-IP>:443 --input="hello"+ax exec --server=localhost:8001 --input="hello"```*Envoy will intercept the request and route traffic using the conversation ID.*+## 🧹 How to Uninstall++To remove AX resources from your cluster, run:++```bash+./hack/install-ax.sh --delete-ax-server+```+---## 🛠️ Inspection & Diagnosticsdiff --git a/manifests/ax-deployment.yaml b/manifests/ax-deployment.yaml.tmplsimilarity index 97%rename from manifests/ax-deployment.yamlrename to manifests/ax-deployment.yaml.tmplindex 279196b..623000a 100644--- a/manifests/ax-deployment.yaml+++ b/manifests/ax-deployment.yaml.tmpl@@ -26,13 +26,13 @@ spec:replicas: 5containers:- name: "ax"- image: gcr.io/ax-container-images/ax:latest+ image: ko://github.com/google/ax/cmd/axcommand: ["ax", "serve"]ports:- containerPort: 8494env:- name: GEMINI_API_KEY- value: "YOUR_API_KEY" # TODO: Use envFrom once it's available.+ value: "${GEMINI_API_KEY}"- name: AX_SUBSTRATEvalue: "1"---@@ -46,7 +46,7 @@ spec:name: ax-workerpoolsnapshotsConfig:location:- bucket: YOUR_BUCKET+ bucket: ${BUCKET_NAME}folder: ax---apiVersion: v1@@ -197,7 +197,7 @@ spec:- name: envoy-configmountPath: /etc/envoy- name: axepp- image: gcr.io/ax-container-images/axepp:latest+ image: ko://github.com/google/ax/cmd/axeppargs:- "--grpc-server-cred-bundle=/run/servicedns.podcert.gke.io/credential-bundle.pem"ports:diff --git a/manifests/ax-service.yaml b/manifests/ax-service.yamlindex 3582c8a..9fbc904 100644--- a/manifests/ax-service.yaml+++ b/manifests/ax-service.yaml@@ -20,7 +20,7 @@ metadata:annotations:cloud.google.com/backend-config: '{"default": "ax-backend-config"}'spec:- type: LoadBalancer+ type: ClusterIPselector:app: ax-routerports: