Skip to content

armgit / ax

Public Imported from GitHub
0

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

Go

Subcommands should have a context

JBDee7a00f18cf4
diff --git a/cmd/gar/inspect.go b/cmd/gar/inspect.go
index d26291a..2ead3be 100644
--- a/cmd/gar/inspect.go
+++ b/cmd/gar/inspect.go
@@ -28,6 +28,7 @@ func init() {
}
func runInspect(cmd *cobra.Command, args []string) error {
+ ctx := context.Background()
fmt.Printf("Inspecting session: %s\n", inspectSessionID)
conn, err := connect(inspectServerAddr)
@@ -39,7 +40,7 @@ func runInspect(cmd *cobra.Command, args []string) error {
client := proto.NewGARServiceClient(conn)
// Get session details
- resp, err := client.GetSession(context.Background(), &proto.GetSessionRequest{
+ resp, err := client.GetSession(ctx, &proto.GetSessionRequest{
SessionId: inspectSessionID,
})
if err != nil {
diff --git a/cmd/gar/register.go b/cmd/gar/register.go
index 8fc8d68..9850897 100644
--- a/cmd/gar/register.go
+++ b/cmd/gar/register.go
@@ -36,6 +36,8 @@ func init() {
}
func runRegister(cmd *cobra.Command, args []string) error {
+ ctx := context.Background()
+
fmt.Printf("Registering agent: %s at %s\n", registerAgentID, registerAgentAddr)
fmt.Printf(" Name: %s\n", registerAgentName)
fmt.Printf(" Description: %s\n", registerAgentDesc)
@@ -49,7 +51,7 @@ func runRegister(cmd *cobra.Command, args []string) error {
client := proto.NewGARServiceClient(conn)
// Register remote agent
- _, err = client.RegisterAgent(context.Background(), &proto.RegisterAgentRequest{
+ _, err = client.RegisterAgent(ctx, &proto.RegisterAgentRequest{
AgentId: registerAgentID,
Name: registerAgentName,
Description: registerAgentDesc,
diff --git a/cmd/gar/trigger.go b/cmd/gar/trigger.go
index eac1568..74e3136 100644
--- a/cmd/gar/trigger.go
+++ b/cmd/gar/trigger.go
@@ -38,6 +38,8 @@ func init() {
}
func runTrigger(cmd *cobra.Command, args []string) error {
+ ctx := context.Background()
+
// Generate UUID if no session ID provided
if triggerSessionID == "" {
triggerSessionID = uuid.New().String()
@@ -57,7 +59,7 @@ func runTrigger(cmd *cobra.Command, args []string) error {
}
// Setup signal handling for graceful shutdown
- ctx, cancel := context.WithCancel(context.Background())
+ ctx, cancel := context.WithCancel(ctx)
defer cancel()
sigChan := make(chan os.Signal, 1)