From 2fd20cd431259aa2bb3340d7c1e080cdcba2c630 Mon Sep 17 00:00:00 2001 From: Jaana Dogan Date: Wed, 22 Jul 2026 12:04:50 -0700 Subject: [PATCH] refactor: rename harness configuration flags to --config for inline JSON and --config-file for paths --- README.md | 14 +++++++------- cmd/ax/exec.go | 38 +++++++++++++++++++------------------- cmd/ax/main.go | 2 +- 3 files changed, 27 insertions(+), 27 deletions(-) diff --git a/README.md b/README.md index d49d832..c139744 100644 --- a/README.md +++ b/README.md @@ -193,8 +193,8 @@ ax exec \ [--input ] \ [--conversation ] \ [--harness ] \ - [--config ] \ - [--config-json ] \ + [--config ] \ + [--config-file ] \ [--server
] \ [--ax-config ] \ [--resume] \ @@ -207,8 +207,8 @@ Options: - `--input`: Input message to send to agents (optional if `--resume` is set, otherwise required) - `--conversation`: Conversation ID (optional, generates UUID if not provided, or resumes if exists) - `--harness`: Harness ID to use (optional, defaults to the default harness) -- `--config`: Path to a JSON file with per-request harness configuration (optional) -- `--config-json`: Per-request harness configuration as an inline JSON string (optional, mutually exclusive with `--config`) +- `--config`: Per-request harness configuration as an inline JSON string (optional, mutually exclusive with `--config-file`) +- `--config-file`: Path to a JSON file with per-request harness configuration (optional) - `--server`: gRPC controller server address (optional. If not provided, runs with a local built-in AX server) - `--ax-config`: Path to YAML configuration file (only used with a local built-in AX server, default: "ax.yaml") - `--resume`: Resume a conversation without inputs (optional, mutually exclusive with `--input`) @@ -228,11 +228,11 @@ ax exec --server localhost:8494 --input "Hello agents!" # Execute with per-request harness config ax exec \ - --config-json '{"system_instructions":"Answer in one sentence.","model":"gemini-3.5-flash"}' \ + --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` instead: -ax exec --config antigravity.json --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." ``` ### Serve diff --git a/cmd/ax/exec.go b/cmd/ax/exec.go index d24ec9e..f7f1473 100644 --- a/cmd/ax/exec.go +++ b/cmd/ax/exec.go @@ -34,15 +34,15 @@ import ( ) var ( - execConversationID string - execHarnessID string - execHarnessConfig string - execHarnessConfigJSON string - execInput string - execServerAddr string - execConfigFile string - execResume bool // allow resuming an execution without inputs - execLastSeq int32 + execConversationID string + execHarnessID string + execConfigFile string + execConfig string + execInput string + execServerAddr string + execAXConfigFile string + execResume bool // allow resuming an execution without inputs + execLastSeq int32 ) var execCmd = &cobra.Command{ @@ -57,15 +57,15 @@ If no conversation ID is provided, a new UUID will be generated.`, 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(&execHarnessConfig, "config", "", "Path to a JSON file with per-request harness configuration") - execCmd.Flags().StringVar(&execHarnessConfigJSON, "config-json", "", "Per-request harness configuration as an inline JSON string (mutually exclusive with --config)") + 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(&execConfigFile, "ax-config", "ax.yaml", "Path to YAML configuration file (only used 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(&execLastSeq, "last-seq", 0, "Last sequence number seen by the client") execCmd.MarkFlagsMutuallyExclusive("input", "resume") - execCmd.MarkFlagsMutuallyExclusive("config", "config-json") + execCmd.MarkFlagsMutuallyExclusive("config", "config-file") } // TODO(jbd): Add multimodal input flags, e.g. --input-image. @@ -108,7 +108,7 @@ func runExec(cmd *cobra.Command, args []string) error { }() if execServerAddr == "" { - cfg, err := newConfig(cmd, execConfigFile) + cfg, err := newConfig(cmd, execAXConfigFile) if err != nil { return err } @@ -124,14 +124,14 @@ func runExec(cmd *cobra.Command, args []string) error { } var harnessConfig []byte - if execHarnessConfig != "" { - b, err := os.ReadFile(execHarnessConfig) + if execConfigFile != "" { + b, err := os.ReadFile(execConfigFile) if err != nil { - return fmt.Errorf("failed to read harness config %q: %w", execHarnessConfig, err) + return fmt.Errorf("failed to read harness config %q: %w", execConfigFile, err) } harnessConfig = b - } else if execHarnessConfigJSON != "" { - harnessConfig = []byte(execHarnessConfigJSON) + } else if execConfig != "" { + harnessConfig = []byte(execConfig) } return execLoop(ctx, execConversationID, execHarnessID, harnessConfig, execInput, execLastSeq) diff --git a/cmd/ax/main.go b/cmd/ax/main.go index c87d8b9..acc9833 100644 --- a/cmd/ax/main.go +++ b/cmd/ax/main.go @@ -65,7 +65,7 @@ const currentVersion = "v1alpha" func newConfig(cmd *cobra.Command, configFile string) (*cliutil.Config, error) { cfg, err := cliutil.LoadFromFile(configFile) configFlagChanged := (cmd.Flags().Lookup("ax-config") != nil && cmd.Flags().Changed("ax-config")) || - (cmd.Flags().Lookup("config") != nil && cmd.Flags().Changed("config") && cmd.Flags().Lookup("ax-config") == nil) + (cmd.Flags().Lookup("config-file") != nil && cmd.Flags().Changed("config-file")) if errors.Is(err, os.ErrNotExist) && !configFlagChanged { cfg := cliutil.DefaultConfig() cfg.Version = currentVersion