Skip to content

armgit / ax

Public Imported from GitHub
0

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

Go

Introduce "registry" to the config (#85)

Jaana Doganfe670e641cd9
diff --git a/README.md b/README.md
index 023a388..7838575 100644
--- a/README.md
+++ b/README.md
@@ -225,19 +225,23 @@ health_check:
interval: 30s
# Agents to register on startup
-agents:
- - remote:
- id: "text-processing-agent"
- name: "Text Processing Agent"
- description: "An agent for text processing"
+registry:
+ remote_agents:
+ - id: "remote-text-processor"
+ name: "Remote Text Processor"
+ description: "Converts text to lowercase."
address: "localhost:50051"
metadata:
- version: "1.0"
- - sandbox:
- id: "uppercase-sandbox-agent"
- name: "Sandbox Uppercase Agent"
- description: "A secure, ephemeral cloud container for executing uppercase transformations"
+ version: "1.0"
+ sandbox_agents:
+ - id: "uppercase"
+ name: "Upper Case Agent"
+ description: "Converts text to uppercase."
sandbox_template_ref: "uppercase-agent-template"
+ container_port: 8494
+ use_router: true
+ metadata:
+ version: "1.0"
```
@@ -340,9 +344,9 @@ kubectl expose deployment sandbox-router --port=8080 --target-port=8080
To use a Sandbox Agent, specify it in your `gar.yaml` configuration using the `sandbox` type:
```yaml
-agents:
- - sandbox:
- id: "my-sandbox-agent"
+registry:
+ sandbox_agents:
+ - id: "my-sandbox-agent"
name: "Sandbox Worker"
description: "An ephemeral sandbox processor"
sandbox_template_ref: "your-gke-sandbox-template-name"
@@ -374,9 +378,9 @@ kubectl apply -f examples/sandbox_agent/sandbox-template-and-pool.yaml
**3. Configure gar.yaml**
Ensure your `gar.yaml` references this sandbox agent:
```yaml
-agents:
- - id: "uppercase-agent"
- sandbox:
+registry:
+ sandbox_agents:
+ - id: "uppercase-agent"
sandbox_template_ref: "uppercase-agent-template"
container_port: 8494
```
diff --git a/cmd/gar/serve.go b/cmd/gar/serve.go
index 10183e5..84705cf 100644
--- a/cmd/gar/serve.go
+++ b/cmd/gar/serve.go
@@ -125,19 +125,16 @@ func newControllerFromConfig(ctx context.Context, cfg *config.Config) (*controll
return nil, err
}
- for _, agentCfg := range cfg.Agents {
- if agentCfg.SandboxAgentConfig != nil {
- if err := c.Registry().RegisterSandbox(ctx, *agentCfg.SandboxAgentConfig); err != nil {
- return nil, fmt.Errorf("failed to register sandbox agent %s: %w", agentCfg.SandboxAgentConfig.ID, err)
- }
- } else if agentCfg.RemoteAgentConfig != nil {
- if err := c.Registry().RegisterRemote(*agentCfg.RemoteAgentConfig); err != nil {
- return nil, fmt.Errorf("failed to register remote agent %s: %w", agentCfg.RemoteAgentConfig.ID, err)
- }
- } else {
- return nil, fmt.Errorf("invalid agent configuration: must specify 'sandbox' or 'remote'")
+ for _, agentCfg := range cfg.Registry.RemoteAgents {
+ if err := c.Registry().RegisterRemote(agentCfg); err != nil {
+ return nil, fmt.Errorf("failed to register remote agent %s: %w", agentCfg.ID, err)
}
}
+ for _, agentCfg := range cfg.Registry.SandboxAgents {
+ if err := c.Registry().RegisterSandbox(ctx, agentCfg); err != nil {
+ return nil, fmt.Errorf("failed to register sandbox agent %s: %w", agentCfg.ID, err)
+ }
+ }
return c, nil
}
diff --git a/gar.yaml b/gar.yaml
index 9a53b3e..1398c54 100644
--- a/gar.yaml
+++ b/gar.yaml
@@ -59,17 +59,16 @@ planner:
# Remote agents configuration (optional)
# List of remote or sandbox agents to register on startup.
-
-agents:
- - remote:
- id: "remote-text-processor"
+registry:
+ remote_agents:
+ - id: "remote-text-processor"
name: "Remote Text Processor"
description: "Converts text to lowercase."
address: "localhost:50051"
metadata:
version: "1.0"
- - sandbox:
- id: "uppercase"
+ sandbox_agents: # TODO: Rename to k8s_sandbox_agents
+ - id: "uppercase"
name: "Upper Case Agent"
description: "Converts text to uppercase."
sandbox_template_ref: "uppercase-agent-template"
diff --git a/internal/config/config.go b/internal/config/config.go
index 9e66900..d721fa5 100644
--- a/internal/config/config.go
+++ b/internal/config/config.go
@@ -31,12 +31,13 @@ type Config struct {
MaxSteps int `yaml:"max_steps"` // Maximum steps per trigger
HealthCheck HealthCheckConfig `yaml:"health_check"`
Planner PlannerConfig `yaml:"planner,omitempty"`
- Agents []Agent `yaml:"agents,omitempty"` // List of local agents to register
+ Registry RegistryConfig `yaml:"registry,omitempty"`
}
-type Agent struct {
- RemoteAgentConfig *RemoteAgentConfig `yaml:"remote,omitempty"`
- SandboxAgentConfig *SandboxAgentConfig `yaml:"sandbox,omitempty"`
+// RegistryConfig allows registring agents.
+type RegistryConfig struct {
+ RemoteAgents []RemoteAgentConfig `yaml:"remote_agents,omitempty"`
+ SandboxAgents []SandboxAgentConfig `yaml:"sandbox_agents,omitempty"`
}
// HealthCheckConfig defines the configuration for agent health checks.