Agent Executor (AX) is Google's open agentic orchestration runtime
Go
Current step should be readonly
Jaana Dogan667ccc09cd33
diff --git a/internal/controller/gemini.go b/internal/controller/gemini.goindex e7419ef..a6a7699 100644--- a/internal/controller/gemini.go+++ b/internal/controller/gemini.go@@ -174,7 +174,7 @@ Guidelines:AgentID: agentID,Inputs: input,Goal: &Goal{Description: "Process user request using model selected agent"},- StepIndex: session.CurrentStep,+ StepIndex: session.CurrentStep(),}, nil}}diff --git a/internal/controller/session.go b/internal/controller/session.goindex 278d996..105f9e5 100644--- a/internal/controller/session.go+++ b/internal/controller/session.go@@ -16,14 +16,15 @@ import (type Session struct {ID stringState proto.State- CurrentStep intActiveAgents []stringMessageHistory []*proto.ContentCheckpointIDs []string // Ordered list of checkpoint UUIDsCreatedAt time.TimeUpdatedAt time.Time- mu sync.RWMutex- eventLog eventlog.EventLog++ mu sync.RWMutex+ eventLog eventlog.EventLog+ currentStep int}// EventLogFactory is a function that creates EventLog instances for sessions.@@ -64,7 +65,7 @@ func (sm *SessionManager) NewSession(sessionID string) (*Session, error) {session := &Session{ID: sessionID,State: proto.State_STATE_RUNNING,- CurrentStep: 0,+ currentStep: 0,ActiveAgents: []string{},MessageHistory: []*proto.Content{},CheckpointIDs: []string{},@@ -109,7 +110,7 @@ func (sm *SessionManager) LoadSessionFromCheckpoint(sessionID string, checkpointsession := &Session{ID: sessionID,State: proto.State_STATE_RUNNING,- CurrentStep: 0,+ currentStep: 0,ActiveAgents: []string{},MessageHistory: []*proto.Content{},CheckpointIDs: []string{},@@ -275,10 +276,17 @@ func (s *Session) AdvanceStep() {s.mu.Lock()defer s.mu.Unlock()- s.CurrentStep+++ s.currentStep++s.UpdatedAt = time.Now()}+func (s *Session) CurrentStep() int {+ s.mu.RLock()+ defer s.mu.RUnlock()++ return s.currentStep+}+// Helper function to extract string from map[string]anyfunc getStringFromData(data map[string]any, key string) string {if val, ok := data[key]; ok {diff --git a/internal/server/server.go b/internal/server/server.goindex e550b6b..a0e3df1 100644--- a/internal/server/server.go+++ b/internal/server/server.go@@ -88,7 +88,7 @@ func (s *Server) GetSession(ctx context.Context, req *proto.GetSessionRequest) (return &proto.GetSessionResponse{Session: &proto.SessionInfo{State: session.State,- CurrentStep: int32(session.CurrentStep),+ CurrentStep: int32(session.CurrentStep()),ActiveAgents: session.ActiveAgents,CreatedAt: timestamppb.New(session.CreatedAt),UpdatedAt: timestamppb.New(session.UpdatedAt),