Agent Executor (AX) is Google's open agentic orchestration runtime
Go
Rename last_seen_seq to last_seq (#202)
Jaana Dogan782e95041655
diff --git a/README.md b/README.mdindex 43ac99d..dffc6ee 100644--- a/README.md+++ b/README.md@@ -91,7 +91,7 @@ sequence number 12:```bashax exec \--conversation d85a4b4e-c53b-4c84-b879-f10d905bce40 \- --last-seen-seq 12 \+ --last-seq 12 \--resume```diff --git a/cmd/ax/exec.go b/cmd/ax/exec.goindex 7dbc7ff..1797f3d 100644--- a/cmd/ax/exec.go+++ b/cmd/ax/exec.go@@ -38,7 +38,7 @@ var (execServerAddr stringexecConfigFile stringexecResume bool // allow resuming an execution without inputs- execLastSeenSeq int32+ execLastSeq int32)var execCmd = &cobra.Command{@@ -56,7 +56,7 @@ func init() {execCmd.Flags().StringVar(&execServerAddr, "server", "", "gRPC controller server address (if specified, connects to remote server; otherwise runs with a local built-in AX server)")execCmd.Flags().StringVar(&execConfigFile, "config", "ax.yaml", "Path to YAML configuration file (only used with a local built-in AX server)")execCmd.Flags().BoolVar(&execResume, "resume", false, "Resume a conversation without inputs")- execCmd.Flags().Int32Var(&execLastSeenSeq, "last-seen-seq", 0, "Last sequence number seen by the client")+ execCmd.Flags().Int32Var(&execLastSeq, "last-seq", 0, "Last sequence number seen by the client")execCmd.MarkFlagsMutuallyExclusive("input", "resume")}@@ -85,7 +85,7 @@ func runExec(cmd *cobra.Command, args []string) error {cancel()}()- return execLoop(ctx, execConversationID, execAgentID, execInput, execLastSeenSeq)+ return execLoop(ctx, execConversationID, execAgentID, execInput, execLastSeq)}func execLoop(ctx context.Context, id string, agentID string, input string, lastSeq int32) error {@@ -122,7 +122,7 @@ func execLoop(ctx context.Context, id string, agentID string, input string, lastConversationId: id,AgentId: agentID,Inputs: inputs,- LastSeenSeq: lastSeq,+ LastSeq: lastSeq,})lastSeq = 0 // disable resuming from sequence, user sees the seq on the screenif err != nil {diff --git a/internal/controller/controller.go b/internal/controller/controller.goindex 59fcffd..6ad3d9f 100644--- a/internal/controller/controller.go+++ b/internal/controller/controller.go@@ -99,9 +99,9 @@ func (d *Controller) tryResuming(ctx context.Context, req *proto.ExecRequest, elhistory = append(history, ev.Messages...)}- if req.LastSeenSeq != 0 {+ if req.LastSeq != 0 {for _, ev := range events {- if ev.Seq > req.LastSeenSeq {+ if ev.Seq > req.LastSeq {if err := handler(&proto.ExecResponse{Outputs: ev.Messages,Seq: ev.Seq,diff --git a/internal/controller/controller_test.go b/internal/controller/controller_test.goindex 5a34caf..7afac36 100644--- a/internal/controller/controller_test.go+++ b/internal/controller/controller_test.go@@ -120,7 +120,7 @@ func TestController_Exec_ResumptionAndIDGeneration(t *testing.T) {}}-func TestController_Exec_LastSeenSeq_Empty(t *testing.T) {+func TestController_Exec_LastSeq_Empty(t *testing.T) {ctx := context.Background()cid := "test-conv-seq"@@ -175,7 +175,7 @@ func TestController_Exec_LastSeenSeq_Empty(t *testing.T) {}}-func TestController_Exec_LastSeenSeq(t *testing.T) {+func TestController_Exec_LastSeq(t *testing.T) {ctx := context.Background()cid := "test-conv-seq"@@ -221,13 +221,13 @@ func TestController_Exec_LastSeenSeq(t *testing.T) {err = c.Exec(ctx, &proto.ExecRequest{ConversationId: cid,- LastSeenSeq: 1,+ LastSeq: 1,}, handler)if err != nil {t.Fatal(err)}- // We expect to receive messages from Seq 2 (since LastSeenSeq is 1).+ // We expect to receive messages from Seq 2 (since LastSeq is 1).if len(msgs) != 1 {t.Fatalf("expected 1 message, got %d", len(msgs))}@@ -410,7 +410,7 @@ func TestController_Exec_InternalOnly(t *testing.T) {t.Fatalf("expected 'public message' in execEvent, got %v", outputs[1].GetContent().GetText().GetText())}- // Test resumption with LastSeenSeq+ // Test resumption with LastSeqvar resumedMsgs []*proto.MessageresumedHandler := ExecHandler(func(resp *proto.ExecResponse) error {resumedMsgs = append(resumedMsgs, resp.Outputs...)@@ -432,7 +432,7 @@ func TestController_Exec_InternalOnly(t *testing.T) {err = c2.Exec(ctx, &proto.ExecRequest{ConversationId: cid,- LastSeenSeq: 1,+ LastSeq: 1,}, resumedHandler)if err != nil {t.Fatal(err)diff --git a/proto/ax.pb.go b/proto/ax.pb.goindex 5a14872..3383647 100644--- a/proto/ax.pb.go+++ b/proto/ax.pb.go@@ -618,7 +618,7 @@ type ExecRequest struct {state protoimpl.MessageState `protogen:"open.v1"`ConversationId string `protobuf:"bytes,1,opt,name=conversation_id,json=conversationId,proto3" json:"conversation_id,omitempty"` // Unique conversation identifierInputs []*Message `protobuf:"bytes,2,rep,name=inputs,proto3" json:"inputs,omitempty"` // New inputs- LastSeenSeq int32 `protobuf:"varint,3,opt,name=last_seen_seq,json=lastSeenSeq,proto3" json:"last_seen_seq,omitempty"` // Last sequence number seen by the client+ LastSeq int32 `protobuf:"varint,3,opt,name=last_seq,json=lastSeq,proto3" json:"last_seq,omitempty"` // Last sequence number seen by the clientAgentId string `protobuf:"bytes,4,opt,name=agent_id,json=agentId,proto3" json:"agent_id,omitempty"` // Agent ID, if empty planner is usedAgentConfig *anypb.Any `protobuf:"bytes,5,opt,name=agent_config,json=agentConfig,proto3" json:"agent_config,omitempty"` // Agent configuration if anyunknownFields protoimpl.UnknownFields@@ -669,9 +669,9 @@ func (x *ExecRequest) GetInputs() []*Message {return nil}-func (x *ExecRequest) GetLastSeenSeq() int32 {+func (x *ExecRequest) GetLastSeq() int32 {if x != nil {- return x.LastSeenSeq+ return x.LastSeq}return 0}@@ -1286,11 +1286,11 @@ const file_proto_ax_proto_rawDesc = "" +"\x12HealthCheckRequest\"I\n" +"\x13HealthCheckResponse\x12\x18\n" +"\ahealthy\x18\x01 \x01(\bR\ahealthy\x12\x18\n" +- "\amessage\x18\x02 \x01(\tR\amessage\"\xd6\x01\n" ++ "\amessage\x18\x02 \x01(\tR\amessage\"\xcd\x01\n" +"\vExecRequest\x12'\n" +"\x0fconversation_id\x18\x01 \x01(\tR\x0econversationId\x12&\n" +- "\x06inputs\x18\x02 \x03(\v2\x0e.proto.MessageR\x06inputs\x12\"\n" +- "\rlast_seen_seq\x18\x03 \x01(\x05R\vlastSeenSeq\x12\x19\n" ++ "\x06inputs\x18\x02 \x03(\v2\x0e.proto.MessageR\x06inputs\x12\x19\n" ++ "\blast_seq\x18\x03 \x01(\x05R\alastSeq\x12\x19\n" +"\bagent_id\x18\x04 \x01(\tR\aagentId\x127\n" +"\fagent_config\x18\x05 \x01(\v2\x14.google.protobuf.AnyR\vagentConfig\"J\n" +"\fExecResponse\x12(\n" +diff --git a/proto/ax.proto b/proto/ax.protoindex 2f32dc7..2254e12 100644--- a/proto/ax.proto+++ b/proto/ax.proto@@ -111,7 +111,7 @@ enum State {message ExecRequest {string conversation_id = 1; // Unique conversation identifierrepeated Message inputs = 2; // New inputs- int32 last_seen_seq = 3; // Last sequence number seen by the client+ int32 last_seq = 3; // Last sequence number seen by the clientstring agent_id = 4; // Agent ID, if empty planner is usedgoogle.protobuf.Any agent_config = 5; // Agent configuration if any