Agent Executor (AX) is Google's open agentic orchestration runtime
Go
Introduce version field to configuration with validation check (#218)
Jaana Dogan9ce12ed12cdf
diff --git a/README.md b/README.mdindex e5cbcd0..d89e070 100644--- a/README.md+++ b/README.md@@ -213,6 +213,8 @@ Options:Example configuration file (`ax.yaml`):```yaml+version: v1alpha+server:address: ":8494"diff --git a/ax.yaml b/ax.yamlindex 03b01ff..f855ef7 100644--- a/ax.yaml+++ b/ax.yaml@@ -15,6 +15,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 harnesses.default+version: v1alphaserver:address: ":8494"diff --git a/cmd/ax/main.go b/cmd/ax/main.goindex 99c7be5..f0c1a88 100644--- a/cmd/ax/main.go+++ b/cmd/ax/main.go@@ -68,5 +68,8 @@ func newConfig(cmd *cobra.Command, configFile string) (*cliutil.Config, error) {if err != nil {return nil, fmt.Errorf("error loading config file '%s': %w", configFile, err)}+ if cfg.Version != "v1alpha" {+ return nil, fmt.Errorf("unsupported config version %q, must be \"v1alpha\"", cfg.Version)+ }return cfg, nil}diff --git a/internal/config/config.go b/internal/config/config.goindex cde18bc..c52e1b3 100644--- a/internal/config/config.go+++ b/internal/config/config.go@@ -33,6 +33,7 @@ const (// Config represents the main configuration for the AX harness server.type Config struct {+ Version string `yaml:"version"`Server ServerConfig `yaml:"server"`EventLog EventLogConfig `yaml:"eventlog"`Harnesses HarnessesConfig `yaml:"harnesses,omitempty"`diff --git a/internal/config/config_test.go b/internal/config/config_test.goindex b32b209..cd8d358 100644--- a/internal/config/config_test.go+++ b/internal/config/config_test.go@@ -17,6 +17,8 @@ package configimport ("strings""testing"++ "gopkg.in/yaml.v3")func TestSubstrateNewHarness(t *testing.T) {@@ -100,3 +102,21 @@ func TestValidate_MultipleDefaults(t *testing.T) {t.Fatalf("Validate() = %v, want multiple defaults error", err)}}++func TestLoadFromFile_Version(t *testing.T) {+ data := `+version: "1.2.3"+server:+ address: ":8080"+eventlog:+ sqlite:+ filename: "test.db"+`+ var cfg Config+ if err := yaml.Unmarshal([]byte(data), &cfg); err != nil {+ t.Fatalf("Unmarshal failed: %v", err)+ }+ if cfg.Version != "1.2.3" {+ t.Errorf("cfg.Version = %q, want %q", cfg.Version, "1.2.3")+ }+}diff --git a/manifests/ax-deployment.yaml b/manifests/ax-deployment.yamlindex d15f4b9..1ff2304 100644--- a/manifests/ax-deployment.yaml+++ b/manifests/ax-deployment.yaml@@ -202,6 +202,7 @@ metadata:namespace: axdata:ax.yaml: |+ version: v1alphaeventlog:postgres:dsn: ${AX_EVENTLOG_DSN}