Skip to content

armgit / ax

Public Imported from GitHub
0

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

Go

Remove ID from the local agent config

Jaana Dogan954aae3235b0
diff --git a/agent/local.go b/agent/local.go
index 76f20e3..e633a79 100644
--- a/agent/local.go
+++ b/agent/local.go
@@ -24,23 +24,18 @@ import (
// LocalAgent wraps a local (in-process) agent implementation.
// It implements the Agent interface for agents running in the same process as the dispatcher.
type LocalAgent struct {
- id string
processFunc func(ctx context.Context, sessionID string, inputs []*proto.Content, handler OutputHandler) error
healthCheckFunc func(ctx context.Context) error
}
// LocalAgentConfig configures a local agent.
type LocalAgentConfig struct {
- ID string
ProcessFunc func(ctx context.Context, sessionID string, inputs []*proto.Content, handler OutputHandler) error
HealthCheckFunc func(ctx context.Context) error
}
// NewLocalAgent creates a new local agent with the provided configuration.
func NewLocalAgent(config LocalAgentConfig) (*LocalAgent, error) {
- if config.ID == "" {
- return nil, fmt.Errorf("agent ID cannot be empty")
- }
if config.ProcessFunc == nil {
return nil, fmt.Errorf("ProcessFunc cannot be nil")
}
@@ -51,7 +46,6 @@ func NewLocalAgent(config LocalAgentConfig) (*LocalAgent, error) {
}
return &LocalAgent{
- id: config.ID,
processFunc: config.ProcessFunc,
healthCheckFunc: config.HealthCheckFunc,
}, nil
diff --git a/examples/local_agent/main.go b/examples/local_agent/main.go
index c82f4f0..cc3a1de 100644
--- a/examples/local_agent/main.go
+++ b/examples/local_agent/main.go
@@ -32,7 +32,7 @@ func main() {
ctx := context.Background()
// Create a local echo agent
- echoAgent, err := createEchoAgent("local-echo-agent")
+ echoAgent, err := createEchoAgent()
if err != nil {
log.Fatalf("Error creating agent: %v\n", err)
}
@@ -86,7 +86,7 @@ func main() {
}
// createEchoAgent creates a simple echo agent that repeats input with a prefix.
-func createEchoAgent(id string) (*agent.LocalAgent, error) {
+func createEchoAgent() (*agent.LocalAgent, error) {
processFunc := func(ctx context.Context, sessionID string, inputs []*proto.Content, handler agent.OutputHandler) error {
// Process each input and call handler with response
for _, content := range inputs {
@@ -120,7 +120,6 @@ func createEchoAgent(id string) (*agent.LocalAgent, error) {
}
return agent.NewLocalAgent(agent.LocalAgentConfig{
- ID: id,
ProcessFunc: processFunc,
HealthCheckFunc: healthCheckFunc,
})