refactor: rename harness configuration flags to --config for inline JSON and --config-file for paths

This commit is contained in:
Jaana Dogan
2026-07-22 12:04:50 -07:00
parent 701feadd05
commit 2fd20cd431
3 changed files with 27 additions and 27 deletions
+7 -7
View File
@@ -193,8 +193,8 @@ ax exec \
[--input <text>] \
[--conversation <id>] \
[--harness <id>] \
[--config <file.json>] \
[--config-json <json>] \
[--config <json>] \
[--config-file <file.json>] \
[--server <address>] \
[--ax-config <file>] \
[--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
+19 -19
View File
@@ -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)
+1 -1
View File
@@ -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