Skip to content

armgit / ax

Public Imported from GitHub
0

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

Go

Remove redundant code

Jaana Dogan1bbfcee3fbe2
diff --git a/internal/controller/controller.go b/internal/controller/controller.go
index f56ab12..c1103e5 100644
--- a/internal/controller/controller.go
+++ b/internal/controller/controller.go
@@ -117,18 +117,7 @@ func (d *Controller) TriggerSession(ctx context.Context, sessionID string, input
return fmt.Errorf("failed to create session: %w", err)
}
}
-
- if sess.State() == proto.State_STATE_FAILED {
- return fmt.Errorf("session has failed and cannot continue")
- }
-
- for _, content := range inputs {
- if _, err := sess.WriteContentIn(ctx, content); err != nil {
- return fmt.Errorf("failed to write input content: %w", err)
- }
- }
-
- if err := d.loopExecutor.Execute(ctx, sess.ID, inputs); err != nil {
+ if err := d.loopExecutor.Execute(ctx, sess, inputs); err != nil {
return fmt.Errorf("execution failed: %w", err)
}
return nil
diff --git a/internal/controller/loop.go b/internal/controller/loop.go
index 39712b8..73a70e6 100644
--- a/internal/controller/loop.go
+++ b/internal/controller/loop.go
@@ -98,13 +98,10 @@ func NewLoopExecutor(ctx context.Context, config LoopConfig) (*LoopExecutor, err
}
// Execute starts a new agentic loop execution for the given session.
-func (e *LoopExecutor) Execute(ctx context.Context, sessionID string, inputs []*proto.Content) error {
- // Get or create session
- session, err := e.sessionManager.GetSession(sessionID)
- if err != nil {
- return fmt.Errorf("failed to get session: %w", err)
+func (e *LoopExecutor) Execute(ctx context.Context, session *Session, inputs []*proto.Content) error {
+ if session.State() == proto.State_STATE_FAILED {
+ return fmt.Errorf("session has failed and cannot continue")
}
-
if err := session.SetState(ctx, proto.State_STATE_RUNNING); err != nil {
return fmt.Errorf("failed to set session state: %w", err)
}