Skip to content

armgit / ax

Public Imported from GitHub
0

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

Go

Allow registering remote agents from config

JBDb95c38f76324
diff --git a/README.md b/README.md
index c530d1b..4d3c8b4 100644
--- a/README.md
+++ b/README.md
@@ -188,6 +188,16 @@ max_steps: 50
# Health check interval for agents
health_check_interval: 30s
+
+# Remote agents to register on startup
+remote_agents:
+ - id: "python-agent"
+ name: "Python Agent"
+ description: "Python-based agent for text processing"
+ address: "localhost:50051"
+ metadata:
+ version: "1.0"
+ language: "python"
```
Example:
@@ -335,7 +345,9 @@ func (s *server) HealthCheck(ctx context.Context, req *proto.HealthCheckRequest)
**Workflow:**
1. Remote agent starts as gRPC server on a port (e.g., :50051)
2. Start gar controller: `gar serve`
-3. Register with gar: `gar register --agent-id my-agent --agent-name "My Agent" --agent-description "Agent description" --agent-addr localhost:50051`
+3. Register with gar using one of these methods:
+ - **Option A - Config file**: Add the agent to `remote_agents` in `gar.yaml` (agents will be registered on startup)
+ - **Option B - CLI command**: `gar register --agent-id my-agent --agent-name "My Agent" --agent-description "Agent description" --agent-addr localhost:50051`
4. When gar triggers a session, it calls the agent's `Process` RPC
5. GAR streams input content → Agent processes → Agent streams output back
diff --git a/cmd/gar/serve.go b/cmd/gar/serve.go
index 8fa1f39..58a5f5b 100644
--- a/cmd/gar/serve.go
+++ b/cmd/gar/serve.go
@@ -95,5 +95,19 @@ func newControllerFromConfig(ctx context.Context, cfg *config.Config) (*controll
if err != nil {
return nil, err
}
+
+ // Register remote agents from config
+ for _, agentCfg := range cfg.RemoteAgents {
+ if err := c.Registry().RegisterRemote(
+ agentCfg.ID,
+ agentCfg.Name,
+ agentCfg.Description,
+ agentCfg.Address,
+ agentCfg.Metadata,
+ ); err != nil {
+ return nil, fmt.Errorf("failed to register remote agent %s: %w", agentCfg.ID, err)
+ }
+ }
+
return c, nil
}
diff --git a/gar.yaml b/gar.yaml
index 6f206b2..a3ee485 100644
--- a/gar.yaml
+++ b/gar.yaml
@@ -42,3 +42,21 @@ health_check_interval: 30s
#
# # Custom system prompt for the planner (optional)
# system_prompt: ""
+
+# Remote agents configuration (optional)
+# List of remote agents to register on startup.
+# Remote agents run as separate gRPC servers.
+#
+# remote_agents:
+# - id: "python-agent"
+# name: "Python Agent"
+# description: "Python-based agent for text processing"
+# address: "localhost:50051"
+# metadata:
+# version: "1.0"
+# language: "python"
+#
+# - id: "custom-agent"
+# name: "Custom Agent"
+# description: "Custom agent implementation"
+# address: "localhost:50052"
diff --git a/internal/config/config.go b/internal/config/config.go
index a393456..a2b2961 100644
--- a/internal/config/config.go
+++ b/internal/config/config.go
@@ -11,11 +11,12 @@ import (
// Config represents the main configuration for GAR server.
type Config struct {
- Server ServerConfig `yaml:"server"`
- EventLog EventLogConfig `yaml:"eventlog"`
- MaxSteps int `yaml:"max_steps"` // Maximum steps per trigger
- HealthCheckInterval time.Duration `yaml:"health_check_interval"` // Health check interval for agents
- GeminiPlanner GeminiPlannerConfig `yaml:"gemini_planner,omitempty"`
+ Server ServerConfig `yaml:"server"`
+ EventLog EventLogConfig `yaml:"eventlog"`
+ MaxSteps int `yaml:"max_steps"` // Maximum steps per trigger
+ HealthCheckInterval time.Duration `yaml:"health_check_interval"` // Health check interval for agents
+ GeminiPlanner GeminiPlannerConfig `yaml:"gemini_planner,omitempty"`
+ RemoteAgents []RemoteAgentConfig `yaml:"remote_agents,omitempty"` // List of remote agents to register
}
// ServerConfig configures the gRPC server.
@@ -46,6 +47,15 @@ type GeminiPlannerConfig struct {
SystemPrompt string `yaml:"system_prompt,omitempty"`
}
+// RemoteAgentConfig configures a remote agent to register on startup.
+type RemoteAgentConfig struct {
+ ID string `yaml:"id"` // Unique agent identifier
+ Name string `yaml:"name"` // Human-readable name
+ Description string `yaml:"description"` // Description of agent capabilities
+ Address string `yaml:"address"` // gRPC address (e.g., "localhost:50051")
+ Metadata map[string]string `yaml:"metadata,omitempty"` // Optional metadata
+}
+
// LoadFromFile loads configuration from a YAML file.
func LoadFromFile(path string) (*Config, error) {
data, err := os.ReadFile(path)