Skip to content

armgit / ax

Public Imported from GitHub
0

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

Go

refactor: simplify CLI by removing the exec subcommand and moving its flags to the root command

Jaana Dogan16db0d7a0fc3
diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md
index 6b31efb..bb90899 100644
--- a/CONTRIBUTING.md
+++ b/CONTRIBUTING.md
@@ -128,7 +128,7 @@ AX is still under heavy development and the database schema is not yet stable. I
An example:
```bash
-ax exec --input "hello"
+ax --input "hello"
Error: error creating controller: failed to create event log: sqlite_eventlog: create index exec_checkpoint_id: SQL logic error: no such column: checkpoint_id (1)
```
diff --git a/README.md b/README.md
index dc3c950..9009b17 100644
--- a/README.md
+++ b/README.md
@@ -137,16 +137,16 @@ The CLI starts the built-in Antigravity harness automatically. No separate harne
```bash
# Using the checked-in ax.yaml, which sets Antigravity as the default harness.
-ax exec --input "Can you list this directory?"
+ax --input "Can you list this directory?"
-# Using exec with an AX server
-ax exec --input "Can you list this directory?" --server localhost:8494
+# Executing with an AX server
+ax --input "Can you list this directory?" --server localhost:8494
```
Conversations can be continued any time:
```bash
-ax exec \
+ax \
--conversation d85a4b4e-c53b-4c84-b879-f10d905bce40 \
--input "Show me the contents of README.md"
```
@@ -158,7 +158,7 @@ rewind the conversation.
In this example, we catch up a client from step number 12:
```bash
-ax exec \
+ax \
--conversation d85a4b4e-c53b-4c84-b879-f10d905bce40 \
--last-step 12 \
--resume
@@ -168,14 +168,14 @@ Instead of running the default harness, you can start executing
any registered harness:
```bash
-ax exec \
+ax \
--input "Can you write me a simple HTTP server in Python?"
```
If anything goes wrong during the execution of a harness,
you can resume an incomplete execution in a conversation:
```bash
-ax exec \
+ax \
--conversation edf98ef5-4bb1-4a9e-a091-3a77e03727e6 \
--resume
```
@@ -183,12 +183,10 @@ ax exec \
## Usage
-The `ax` command provides several subcommands:
-
### Execute
```bash
-ax exec \
+ax \
[--input <text>] \
[--conversation <id>] \
[--harness <id>] \
@@ -217,21 +215,21 @@ Options:
```bash
# Execute a new execution
-ax exec --input "Hello agents!"
+ax --input "Hello agents!"
# Resume an existing execution with new input
-ax exec --conversation a53d4db3-1165-4925-87da-be6c72bbdeb1 --input "Ok, now let's do something else..."
+ax --conversation a53d4db3-1165-4925-87da-be6c72bbdeb1 --input "Ok, now let's do something else..."
# Execute using server mode
-ax exec --server localhost:8494 --input "Hello agents!"
+ax --server localhost:8494 --input "Hello agents!"
# Execute with per-request harness config
-ax exec \
+ax \
--config '{"system_instructions":"Answer in one sentence.","model":"gemini-3.5-flash"}' \
--input "Explain durable execution."
# To keep the same JSON in a file, use `--config-file` instead:
-ax exec --config-file antigravity.json --input "Explain durable execution."
+ax --config-file antigravity.json --input "Explain durable execution."
```
### Serve
diff --git a/ax.yaml b/ax.yaml
index af22733..da53475 100644
--- a/ax.yaml
+++ b/ax.yaml
@@ -14,7 +14,7 @@
# Sample LOCAL configuration for the AX *harness* build (compiled with -tags=harness).
# Usage: ax serve --config ax.yaml
-# ax exec --config ax.yaml --input "hello" # uses default harness (antigravity)
+# ax --ax-config ax.yaml --input "hello" # uses default harness (antigravity)
version: v1alpha
server:
diff --git a/cmd/ax/Dockerfile b/cmd/ax/Dockerfile
index 16a1b90..7a505cd 100644
--- a/cmd/ax/Dockerfile
+++ b/cmd/ax/Dockerfile
@@ -26,7 +26,7 @@
# docker build --platform linux/amd64 --target antigravity -f cmd/ax/Dockerfile -t <ref> . && docker push <ref>
# docker build --platform linux/amd64 --target ax -f cmd/ax/Dockerfile -t <ref> . && docker push <ref>
-# --- Stage 1: build the ax Go binary (with the harness build tag) -------------
+# --- Stage 1: build the ax Go binary -----------------------------------------
FROM --platform=$BUILDPLATFORM golang:1.26 AS build
ARG TARGETOS=linux
ARG TARGETARCH=amd64
diff --git a/cmd/ax/exec.go b/cmd/ax/exec.go
index eae517f..07bb118 100644
--- a/cmd/ax/exec.go
+++ b/cmd/ax/exec.go
@@ -54,18 +54,22 @@ If no conversation ID is provided, a new UUID will be generated.`,
RunE: runExec,
}
+func registerExecFlags(cmd *cobra.Command) {
+ cmd.Flags().StringVar(&execConversationID, "conversation", "", "Conversation ID (optional, generates UUID if not provided)")
+ cmd.Flags().StringVar(&execHarnessID, "harness", "", "Harness ID (optional, default harness is used if not specified)")
+ cmd.Flags().StringVar(&execConfigFile, "config-file", "", "Path to a JSON file with per-request harness configuration")
+ cmd.Flags().StringVar(&execConfig, "config", "", "Per-request harness configuration as an inline JSON string (mutually exclusive with --config-file)")
+ cmd.Flags().StringVar(&execInput, "input", "", "Input message to send (optional)")
+ cmd.Flags().StringVar(&execServerAddr, "server", "", "gRPC controller server address (if specified, connects to remote server; otherwise runs with a local built-in AX server)")
+ cmd.Flags().StringVar(&execAXConfigFile, "ax-config", "ax.yaml", "Path to YAML configuration file (only used with a local built-in AX server)")
+ cmd.Flags().BoolVar(&execResume, "resume", false, "Resume a conversation without inputs")
+ cmd.Flags().Int32Var(&execLastStep, "last-step", 0, "Last step number seen by the client")
+ cmd.MarkFlagsMutuallyExclusive("input", "resume")
+ cmd.MarkFlagsMutuallyExclusive("config", "config-file")
+}
+
func init() {
- execCmd.Flags().StringVar(&execConversationID, "conversation", "", "Conversation ID (optional, generates UUID if not provided)")
- execCmd.Flags().StringVar(&execHarnessID, "harness", "", "Harness ID (optional, default harness is used if not specified)")
- execCmd.Flags().StringVar(&execConfigFile, "config-file", "", "Path to a JSON file with per-request harness configuration")
- execCmd.Flags().StringVar(&execConfig, "config", "", "Per-request harness configuration as an inline JSON string (mutually exclusive with --config-file)")
- execCmd.Flags().StringVar(&execInput, "input", "", "Input message to send (optional)")
- execCmd.Flags().StringVar(&execServerAddr, "server", "", "gRPC controller server address (if specified, connects to remote server; otherwise runs with a local built-in AX server)")
- execCmd.Flags().StringVar(&execAXConfigFile, "ax-config", "ax.yaml", "Path to YAML configuration file (only used with a local built-in AX server)")
- execCmd.Flags().BoolVar(&execResume, "resume", false, "Resume a conversation without inputs")
- execCmd.Flags().Int32Var(&execLastStep, "last-step", 0, "Last step number seen by the client")
- execCmd.MarkFlagsMutuallyExclusive("input", "resume")
- execCmd.MarkFlagsMutuallyExclusive("config", "config-file")
+ registerExecFlags(execCmd)
}
// TODO(jbd): Add multimodal input flags, e.g. --input-image.
diff --git a/cmd/ax/internal/display.go b/cmd/ax/internal/display.go
index 376e25b..c3a3807 100644
--- a/cmd/ax/internal/display.go
+++ b/cmd/ax/internal/display.go
@@ -322,8 +322,8 @@ func (d *Display) PromptForConfigFile() (string, error) {
func (d *Display) ShowResumption(id string, server string) {
fmt.Fprintln(d.w, d.resumeStyle.Render("To resume the conversation,"))
if server != "" {
- fmt.Fprintln(d.w, d.resumeStyle.Render(fmt.Sprintf("ax exec --conversation %s --server %s", id, server)))
+ fmt.Fprintln(d.w, d.resumeStyle.Render(fmt.Sprintf("ax --conversation %s --server %s", id, server)))
} else {
- fmt.Fprintln(d.w, d.resumeStyle.Render(fmt.Sprintf("ax exec --conversation %s", id)))
+ fmt.Fprintln(d.w, d.resumeStyle.Render(fmt.Sprintf("ax --conversation %s", id)))
}
}
diff --git a/cmd/ax/main.go b/cmd/ax/main.go
index fddaf08..e0f36ba 100644
--- a/cmd/ax/main.go
+++ b/cmd/ax/main.go
@@ -37,13 +37,16 @@ func main() {
var rootCmd = &cobra.Command{
Use: "ax",
- Short: "AX - Agent eXecutor",
- Long: `ax provides a server and CLI tools for managing agent orchestrator tasks.
-It provides commands to execute tasks, resume from checkpoints,
-and run the controller server.`,
+ Short: "Execute a conversation or resume an existing one",
+ Long: `Execute a new conversation or resume an existing one.
+If no conversation ID is provided, a new UUID will be generated.`,
+ SilenceUsage: true,
+ RunE: runExec,
}
func init() {
+ registerExecFlags(rootCmd)
+
rootCmd.AddCommand(execCmd)
rootCmd.AddCommand(serveCmd)
}
diff --git a/examples/skills/README.md b/examples/skills/README.md
index 7276904..2f4e388 100644
--- a/examples/skills/README.md
+++ b/examples/skills/README.md
@@ -23,7 +23,7 @@ AX contains a sample `emoji` skill in `examples/skills/emoji`. If you run a task
Run the following command in your terminal:
```bash
-ax exec --input "Give me an emoji for happy"
+ax --input "Give me an emoji for happy"
```
The planner will:
diff --git a/hack/install-ax.sh b/hack/install-ax.sh
index 78f2b63..9c5c02a 100755
--- a/hack/install-ax.sh
+++ b/hack/install-ax.sh
@@ -314,7 +314,7 @@ deploy_ax_server() {
echo "Forward the AX server by running the following command (optional)"
echo "kubectl port-forward -n ax rs/ax-server 8494:8494"
echo ""
- echo "Then, run: ax exec --server localhost:8494 [--harness antigravity|antigravity-interactions]"
+ echo "Then, run: ax --server localhost:8494 [--harness antigravity|antigravity-interactions]"
}
# delete_ax_server removes the AX server and harness resources but preserves the
diff --git a/manifests/README.md b/manifests/README.md
index fe3678d..9ca169c 100644
--- a/manifests/README.md
+++ b/manifests/README.md
@@ -122,7 +122,7 @@ kubectl port-forward -n ax rs/ax-server 8494:8494
Run an execution targeting the port-forwarded server.
```bash
-ax exec --server=localhost:8494 --input="hello, who are you?"
+ax --server=localhost:8494 --input="hello, who are you?"
```
The server should respond with something like: