Skip to content

armgit / ax

Public Imported from GitHub
0

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

Go

align CI go version & and run go fix (#146)

Hyang-Ah Hana Kim72fc4e3dae3f
diff --git a/.github/workflows/go.yml b/.github/workflows/go.yml
index 543c9e5..d13b224 100644
--- a/.github/workflows/go.yml
+++ b/.github/workflows/go.yml
@@ -48,7 +48,7 @@ jobs:
- name: Set up Go
uses: actions/setup-go@v4
with:
- go-version: '1.24'
+ go-version: '1.25'
- name: Build
run: go build -v ./...
diff --git a/cmd/sandbox-router/main.go b/cmd/sandbox-router/main.go
index bb0913c..029a014 100644
--- a/cmd/sandbox-router/main.go
+++ b/cmd/sandbox-router/main.go
@@ -12,6 +12,10 @@
// See the License for the specific language governing permissions and
// limitations under the License.
+// The sandbox-router is a reverse proxy for routing requests
+// to sandbox agents.
+// It reads routing information from HTTP headers and forwards requests
+// to the corresponding sandbox service within a Kubernetes cluster.
package main
import (
diff --git a/internal/controller/controller.go b/internal/controller/controller.go
index b494650..ee823f1 100644
--- a/internal/controller/controller.go
+++ b/internal/controller/controller.go
@@ -19,6 +19,7 @@ package controller
import (
"context"
"fmt"
+ "maps"
"os"
"sync"
@@ -112,9 +113,7 @@ func (d *Controller) Exec(ctx context.Context, incoming *proto.AgentMessage, han
// For testing only! Remove this once the project is stable.
// TODO(jbd): Remove this before the release.
if os.Getenv("AX_TEST_AGENTS") == "1" {
- for id, agent := range testagent.Agents() {
- registry[id] = agent
- }
+ maps.Copy(registry, testagent.Agents())
}
start := incoming.GetStart()
diff --git a/internal/controller/executor/executor_test.go b/internal/controller/executor/executor_test.go
index 75bec9a..71f9c34 100644
--- a/internal/controller/executor/executor_test.go
+++ b/internal/controller/executor/executor_test.go
@@ -154,7 +154,7 @@ func TestFanout(t *testing.T) {
registry := map[string]agent.Agent{
"root": AgentFunc(func(inputs []*proto.Message, tm agent.Executor, o agent.OutputHandler) {
var g errgroup.Group
- for i := 0; i < 50; i++ {
+ for i := range 50 {
i := i // Capture loop variable.
g.Go(func() error {
return tm.Exec(ctx, fmt.Sprintf("child-%d", i), &proto.AgentStart{
@@ -177,7 +177,7 @@ func TestFanout(t *testing.T) {
time.Sleep(100 * time.Millisecond)
var g errgroup.Group
- for i := 0; i < 2; i++ {
+ for i := range 2 {
i := i // Capture loop variable.
g.Go(func() error {
return tm.Exec(ctx, fmt.Sprintf("child2-%d", i), &proto.AgentStart{
diff --git a/internal/controller/executor/sqlite_test.go b/internal/controller/executor/sqlite_test.go
index 9caf271..770af2b 100644
--- a/internal/controller/executor/sqlite_test.go
+++ b/internal/controller/executor/sqlite_test.go
@@ -91,11 +91,11 @@ func TestSQLiteEventLog_ConcurrentAppend(t *testing.T) {
numRoutines := 10
numEvents := 100
- for i := 0; i < numRoutines; i++ {
+ for i := range numRoutines {
wg.Add(1)
go func(agentIdx int) {
defer wg.Done()
- for j := 0; j < numEvents; j++ {
+ for range numEvents {
ev := &proto.ExecutionEvent{
ExecId: "task-concurrent",
State: proto.State(agentIdx % 4), // distribute states 0-3
diff --git a/internal/controller/registry_test.go b/internal/controller/registry_test.go
index 0e7936c..bbd23f6 100644
--- a/internal/controller/registry_test.go
+++ b/internal/controller/registry_test.go
@@ -211,7 +211,7 @@ func TestRegistry_GracefulShutdown(t *testing.T) {
}
// Register multiple agents to create workload
- for i := 0; i < 50; i++ {
+ for i := range 50 {
_ = r.RegisterRemote(config.RemoteAgentConfig{
ID: "remote-shutdown-test-" + string(rune(i)),
Name: "Shutdown Test Remote",
diff --git a/internal/sandboxclient/client.go b/internal/sandboxclient/client.go
index 98a5c38..705101c 100644
--- a/internal/sandboxclient/client.go
+++ b/internal/sandboxclient/client.go
@@ -78,15 +78,15 @@ func NewClient(namespace string) (*Client, error) {
// CreateClaim provisions an ephemeral sandbox execution environment.
func (c *Client) CreateClaim(ctx context.Context, claimName, templateRef string) error {
claim := &unstructured.Unstructured{
- Object: map[string]interface{}{
+ Object: map[string]any{
"apiVersion": "extensions.agents.x-k8s.io/v1alpha1",
"kind": "SandboxClaim",
- "metadata": map[string]interface{}{
+ "metadata": map[string]any{
"name": claimName,
"namespace": c.namespace,
},
- "spec": map[string]interface{}{
- "sandboxTemplateRef": map[string]interface{}{
+ "spec": map[string]any{
+ "sandboxTemplateRef": map[string]any{
"name": templateRef,
},
},
@@ -104,7 +104,7 @@ func (c *Client) DeleteClaim(ctx context.Context, claimName string) error {
// WaitForSandbox waits for the Sandbox resource to be ready and returns the pod selector.
func (c *Client) WaitForSandbox(ctx context.Context, claimName string) (selector string, err error) {
- for i := 0; i < 300; i++ {
+ for range 300 {
select {
case <-ctx.Done():
return "", ctx.Err()
diff --git a/internal/test_multi/test_multi.go b/internal/test_multi/test_multi.go
index 43e6a78..304bc52 100644
--- a/internal/test_multi/test_multi.go
+++ b/internal/test_multi/test_multi.go
@@ -116,7 +116,7 @@ func main() {
},
}
- for i := 0; i < 4; i++ {
+ for i := range 4 {
log.Printf("\n--- Executing step %d ---\n", i+1)
if err := c.Exec(ctx, req, handler); err != nil {
log.Fatalf("Error executing step %d: %v\n", i+1, err)