ax README

项目的 README,来自 github.com/google/ax。合并为一个 markdown 文件:README.md。

AX axolotl AX

[!WARNING] AX and several of its features are in heavy development. We are actively refining our core concepts, protocols, and specifications, and will likely introduce major breaking changes prior to a stable release.

Declare an agentic task with workspaces and model specifications. AX sandboxes it, wires up its workspace, and helps running it at scale.

AX is a highly efficient, declarative orchestrator to run millions of autonomous agent workloads in a cluster. It runs on top of Agent Substrate for sandboxed execution and is built to run millions of tasks per cluster. If you have used Kubernetes, ax will feel similar.

# task.yaml
apiVersion: ax.io/v1alpha1
kind: Workspace
metadata:
  name: golang
spec:
  profile:          # tasks that bind this workspace and omit spec.profile use it
    image: "ghcr.io/my-org/my-coding-agent@sha256:..."
  setup:
    git:
      - repo: https://github.com/golang/go.git
        ref: "my-fix"
    files:
      - path: "AGENTS.md"
        content: |
          - Run `go test` to ensure that tests are passing.
          - Do not modify the public API.
---
apiVersion: ax.io/v1alpha1
kind: Task
metadata:
  name: test
spec:
  goal:
    text: "Fix what's broken please."
  workspace:
    name: golang
  debug: true   # enables `ax ssh`

Then apply it, resume it, and look over the agent's shoulder:

ax apply -f task.yaml
ax resume task test
ax describe task test
ax ssh test -- ls -al /workspace

Why?

Agents are a new kind of workload. They are neither stateless microservices nor run-to-completion batch jobs. They accumulate state, need strict isolation, call out to model APIs and tool servers, and can burn money in a loop if nobody is watching. AX gives you three small primitives that handle all of that declaratively:

You want to... AX gives you
Run untrusted agent code in an isolated sandbox with CPU/memory limits Task
Pre-wire Git repos, MCP servers, and skill packages so every agent starts warm Workspace
Configure which LLM the platform itself uses, with credentials from a Kubernetes secret Model
Decide which hosts an agent can reach, and inject credentials without the agent ever seeing them Gateway
Pause an idle agent and pick up exactly where it left off ax suspend / ax resume
Shell into a running agent to see what it is doing ax ssh

Everything is expressed as ax.io/v1alpha1 manifests and applied with a single command.

Quick start

1. Install AX

curl -fsSL https://raw.githubusercontent.com/google/ax/main/install.sh | AX_VERSION=v0.4.0-rc.2 sh
export PATH="$HOME/.ax/bin:$PATH"

[!TIP] Prefer a UI? See AX Studio to set up AX on your computer and start tasks from a local app instead of using the CLI below.

2. Start AX

Locally:

ax local start

Or on an existing cluster with Agent Substrate:

ax install
kubectl apply -f examples/workerpool.yaml

Run your first task

From your ax checkout:

ax apply -f examples/simple.yaml         # the smallest useful Task
ax resume task simple-task               # new tasks start Suspended; resume schedules the actor and starts it
ax get tasks
# NAME          ATESPACE   STATE     ACTOR         AGE
# simple-task   default    Running   simple-task   1m

ax ssh simple-task -- ls -la /workspace  # poke around inside the sandbox
ax suspend task simple-task              # checkpoint and pause
ax resume task simple-task               # pick up where it left off

The first resume also waits for the workspace to initialize (cloning its git repos), so it can take a while; if the CLI gives up first, the task keeps coming up in the background — ax get tasks tells you where it is.

Every Task runs an image pinned by digest, named by spec.profile.image or spec.profile.ateTemplate.name or inherited from its Workspace's spec.profile; replace the image in examples/simple.yaml with $AX_TASK_IMAGE if you built your own.

Prebuilt agent images

Ready-to-run agent images, such as Antigravity, are published from agentexecutor/images. Each image's README has a complete Gateway and Task manifest.

Tour

Want a tour of AX end to end? Run ./hack/tour.sh against the current context. It walks through Tasks, Gateways, Workspaces with setup, suspend and resume, fan-out from a workspace snapshot, atespaces, and Models, and deletes everything it creates when it exits.

Documentation

Guide Read it to...
Local Installer Walk through ax local, ax ctx, ax install, and promoting tasks unchanged from local Kind to a remote GKE cluster.
AX Studio Set up AX on your computer and start, watch, and shell into tasks from a local web app.
Concepts Learn what a Task, Workspace, and Model each do, and how a task moves through phases and conditions.
Manifests Write your own YAML, with an annotated example of every kind.
Sandbox See what the runner does on boot and what your command can rely on: metadata server, guest services, environment.
Runners Understand the contract between the control plane and the task container, and build your own runner image to replace the default.
Sessions Associate multi-turn tasks with one sessionId, bring your own session storage.
Networking Reach a running task through the atenet router from the cluster, your laptop, or a gRPC client.
Observability Collect ax-server's logs, metrics, traces, and events, and configure where they go.
Architecture Understand how the control plane fits together, plus the API reference.
Development Build, test, and ship changes to AX itself.
Roadmap See planned milestones across core specs, actor architecture, agentic environments, and governance.

CLI usage

ax talks to the control plane over gRPC. It is deliberately kubectl-shaped: apply, get, describe, delete, plus a few agent-specific verbs.

Everyday commands

# Apply anything (multi-document YAML, file or stdin)
ax apply -f examples/simple.yaml

# Tasks
ax get tasks                          # list
ax get tasks -a my-atespace           # list in another atespace
ax get task task123                   # full spec + live status as YAML
ax describe task task123              # human-readable detail
ax suspend task task123               # checkpoint actor state and pause
ax resume task task123                # resume a suspended task
ax promote task task123 --to prod     # copy the task and what it binds to the cluster of kube context prod, and resume it there
ax delete task task123

# Shell into the running sandbox
ax ssh task123                        # interactive shell (task needs spec.debug: true)
ax ssh task123 -- ls -la /workspace   # one-off command
ax ssh task123 -- python3 main.py

# Workspaces, gateways, and models follow the same pattern

ax get workspaces
# NAME                ATESPACE   GIT-REPOS   MCP-SERVERS
# default-workspace   default    1           1
ax describe workspace default-workspace
ax delete workspace default-workspace

ax get gateways
# NAME            ATESPACE   EGRESS-RULES
# review-bot-gw   default    3
ax describe gateway review-bot-gw
ax delete gateway review-bot-gw

ax get models
# NAME            ATESPACE   PROVIDER   MODEL
# default-model   default    google     gemini-3.8-flash
ax describe model default-model
ax delete model default-model

# Environment & connection plumbing
ax local start --server-image <img>   # create/resume local Kind + Substrate + AX cluster
ax local status                       # check local environment, Substrate, and AX health
ax local stop                         # stop local environment while keeping state
ax local delete                       # destroy local environment and clean up owned context
ax install / ax uninstall             # install or remove AX on the active Kubernetes cluster
ax ctx                                # list kube contexts and active AX tunnel status
ax ctx <name>                         # switch active Kubernetes context in kubeconfig
ax tunnel list                        # background tunnels (state lives in ~/.ax/tunnels)
ax tunnel stop
ax version

Works with kubectx

ax follows your active Kubernetes context. Switch clusters and ax resolves and tunnels to that cluster's control plane in the background.

kubectx staging-cluster
ax get tasks

kubectx prod-cluster
ax get tasks

# Or target a context without switching
ax --context=dev-cluster get tasks

Global flags

Flag Description Default
-a, --atespace Atespace scope for the command default
-n, --namespace Kubernetes namespace where AX is installed ax-system
--context Kubernetes context to target active kubectx / current-context
--server Control plane address, bypassing auto-detection derived from kube context, or $AX_SERVER
--trace Trace the command and print its trace ID to stderr. Its RPCs send a sampled W3C traceparent, and CLI spans are exported over OTLP when OTEL_EXPORTER_OTLP_ENDPOINT is set. Without it, the CLI sends no trace context and ax-server samples on its own. See CLI traces off

AX and Agent Substrate

Agent Substrate is the compute runtime layer AX relies on. It schedules actors onto workers, isolates them, and suspends, resumes and snapshots them. It also handles their networking, egress policies and credential injection.

Agent Substrate is a low-opinion system in terms of agentic abstractions. Besides task execution, AX and Agent Substrate are orthogonal to each other.

AX is aiming to grow into an agentic platform that covers session management, memory, multi-task coordination, input steering, registries, models, and trajectory collection. We are building it at Google as our portable agentic platform, one that runs the same way inside Google, on customer clusters, and on-prem.

License

Apache License 2.0. See LICENSE for details.

ax (google/ax)

正在搜索数据库…

14.9K ·GitHub
这是什么东西?AX 是 Google 开源的智能体编排运行时——一个声明式、高吞吐量的编排器,可以在 Kubernetes 集群里运行数十亿个自主智能体工作负载,每个任务都在独立沙箱中运行,并对其网络访问做隔离管控。
它是一个要加到我智能体代码里的库,还是需要部署的东西?都不是:你要把一个控制平面部署到自己的 Kubernetes 集群里,然后用一个叫 ax 的、用法类似 kubectl 的命令行工具来操作它。你要运行的一切都写成 ax.io/v1alpha1 YAML 清单,一条命令就能应用。
怎么把它跑起来?先用 go install 安装 ax CLI,再用 ko 部署控制平面,然后应用你的第一个任务。你需要一个 Kubernetes 集群、一个集群能拉取镜像的容器仓库,以及一个可以访问的 Agent Substrate Control API;./demo.sh 完整演示了整个生命周期。
在上面做开发之前有什么要注意的吗?它还不稳定:核心概念、协议和规范仍在打磨之中,在正式稳定版发布之前预计会有大的破坏性变更。如果现在就采用,要做好应对频繁变动的准备。
ax CLI 能在我的笔记本电脑上运行吗,还是只能在集群里用?CLI 是一个本地的 Go 二进制文件——go install 会把它装到 $(go env GOPATH)/bin——它通过 gRPC 和控制平面通信,并跟随你当前激活的 kubectl context。控制平面本身则运行在你集群的 ax-system 命名空间里。
AX 的四个核心原语是什么?Task 在有 CPU 和内存限制的隔离沙箱里运行不受信任的智能体代码;Workspace 预先接好 Git 仓库、MCP 服务器和技能包,让每个智能体一启动就是热状态;Gateway 把出站流量限制在明确的主机允许列表内;Model 配置平台自身使用哪个 LLM,凭据来自 Kubernetes secret。
为什么不直接在普通的 Kubernetes 上跑智能体?因为智能体既不是无状态的微服务,也不是跑完即止的批处理任务:它们会不断积累状态,需要严格的隔离,要调用模型 API 和工具服务器,而且如果没人盯着,可能会在死循环里烧掉大量钱。AX 的四个原语用声明式的方式把这些问题全都处理了。
怎么查看或暂停一个正在运行的智能体?这个 CLI 刻意做成了 kubectl 的风格——apply、get、describe、watch、delete——另外还有智能体专属的命令:ax suspend 暂停一个空闲的智能体,ax resume 从上次停下的地方原样继续,ax ssh 可以进入一个正在运行的智能体,看看它在干什么。
Agent Substrate 是什么?默认的运行器可以替换吗?Agent Substrate 是 AX 所依赖的沙箱执行层;集群必须能访问它的 Control API(集群内默认地址:api.ate-system.svc.cluster.local:443)。可以替换——Runners 指南说明了控制平面的契约,你可以构建自己的运行器镜像来替换默认的那个。
作者
google
大小
46.1 MB
星标
14.9K
时长
8个月
提交 · 90 天