Skip to content

armgit / ax

Public Imported from GitHub
0

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

Go

Agent objects shouldn't have an ID

Jaana Dogana467deb3c909
diff --git a/agent/agent.go b/agent/agent.go
index da689aa..14ce2e4 100644
--- a/agent/agent.go
+++ b/agent/agent.go
@@ -38,9 +38,6 @@ type Agent interface {
// Returns an error if the agent is unhealthy or unreachable.
HealthCheck(ctx context.Context) error
- // ID returns the unique identifier for this agent.
- ID() string
-
// Close gracefully shuts down the agent and releases resources.
Close() error
}
diff --git a/agent/local.go b/agent/local.go
index bda4c88..76f20e3 100644
--- a/agent/local.go
+++ b/agent/local.go
@@ -67,11 +67,6 @@ func (a *LocalAgent) HealthCheck(ctx context.Context) error {
return a.healthCheckFunc(ctx)
}
-// ID returns the unique identifier for this agent.
-func (a *LocalAgent) ID() string {
- return a.id
-}
-
// Close gracefully shuts down the agent.
func (a *LocalAgent) Close() error {
// Local agents don't typically need cleanup, but this can be extended
diff --git a/agent/remote.go b/agent/remote.go
index cee076b..d375dff 100644
--- a/agent/remote.go
+++ b/agent/remote.go
@@ -31,7 +31,6 @@ import (
// RemoteAgent is a gRPC client that implements the Agent interface.
// It communicates with remote agent services over gRPC.
type RemoteAgent struct {
- id string
address string
conn *grpc.ClientConn
client proto.AgentServiceClient
@@ -43,7 +42,6 @@ type RemoteAgent struct {
// RemoteAgentConfig configures a remote agent client.
type RemoteAgentConfig struct {
- ID string
Address string // gRPC server address (e.g., "localhost:50051")
Reconnect bool // Whether to automatically reconnect on failures
MaxRetries int // Maximum number of retry attempts (0 = infinite)
@@ -52,15 +50,11 @@ type RemoteAgentConfig struct {
// NewRemoteAgent creates a new remote agent client.
func NewRemoteAgent(config RemoteAgentConfig) (*RemoteAgent, error) {
- if config.ID == "" {
- return nil, fmt.Errorf("agent ID cannot be empty")
- }
if config.Address == "" {
return nil, fmt.Errorf("agent address cannot be empty")
}
agent := &RemoteAgent{
- id: config.ID,
address: config.Address,
reconnect: config.Reconnect,
maxRetries: config.MaxRetries,
@@ -164,11 +158,6 @@ func (a *RemoteAgent) HealthCheck(ctx context.Context) error {
return nil
}
-// ID returns the unique identifier for this agent.
-func (a *RemoteAgent) ID() string {
- return a.id
-}
-
// Close gracefully shuts down the remote agent connection.
func (a *RemoteAgent) Close() error {
a.mu.Lock()
diff --git a/examples/local_agent/main.go b/examples/local_agent/main.go
index bcdf48a..e8789f5 100644
--- a/examples/local_agent/main.go
+++ b/examples/local_agent/main.go
@@ -54,6 +54,7 @@ func main() {
if err := c.Registry().RegisterLocal(
echoAgent,
+ "local-echo-agent",
"Echo Agent",
"Simple echo agent that uppercases input",
map[string]string{
diff --git a/internal/controller/registry.go b/internal/controller/registry.go
index 95029d0..235bfc3 100644
--- a/internal/controller/registry.go
+++ b/internal/controller/registry.go
@@ -75,11 +75,10 @@ func NewRegistry(healthCheckInterval time.Duration) *Registry {
}
// RegisterLocal registers a local (in-process) agent.
-func (r *Registry) RegisterLocal(a agent.Agent, name, description string, metadata map[string]string) error {
+func (r *Registry) RegisterLocal(a agent.Agent, id, name, description string, metadata map[string]string) error {
r.mu.Lock()
defer r.mu.Unlock()
- id := a.ID()
if _, ok := r.agents[id]; ok {
return fmt.Errorf("agent %s already registered", id)
}
@@ -109,7 +108,6 @@ func (r *Registry) RegisterRemote(cfg config.RemoteAgentConfig) error {
// Create remote agent client
remoteAgent, err := agent.NewRemoteAgent(agent.RemoteAgentConfig{
- ID: cfg.ID,
Address: cfg.Address,
Reconnect: true,
MaxRetries: 3,