Skip to content

armgit / ax

Public Imported from GitHub
0

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

Go

Introduce checkpoint_id to ExecutionEvent (#148)

Jaana Dogan7a25bd0d6d2f
diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md
index 732c431..ebe94b0 100644
--- a/CONTRIBUTING.md
+++ b/CONTRIBUTING.md
@@ -112,3 +112,24 @@ git push origin my-feature
```
Visit https://github.com/google-gemini/ax to open a pull request.
+
+
+## Troubleshooting
+
+### Outdated table schema
+
+AX is still under heavy development and the database schema is not yet stable. If you encounter errors related to outdated table schemas, you can reset the database by deleting the `eventlog` directory.
+
+An example:
+
+```bash
+ax exec --input "hello"
+
+Error: error creating controller: failed to create event log: sqlite_eventlog: create index exec_checkpoint_id: SQL logic error: no such column: checkpoint_id (1)
+```
+
+Delete the `eventlog` directory and try again.
+
+```bash
+rm -rf ./eventlog
+```
diff --git a/internal/controller/executor/sqlite.go b/internal/controller/executor/sqlite.go
index 88ad3d2..0c52b10 100644
--- a/internal/controller/executor/sqlite.go
+++ b/internal/controller/executor/sqlite.go
@@ -52,6 +52,7 @@ func OpenSQLiteEventLog(path string) (*SQLiteEventLog, error) {
CREATE TABLE IF NOT EXISTS event_log (
id INTEGER PRIMARY KEY AUTOINCREMENT,
exec_id TEXT NOT NULL,
+ checkpoint_id TEXT,
state INTEGER NOT NULL,
payload TEXT NOT NULL,
timestamp DATETIME NOT NULL
@@ -63,7 +64,12 @@ func OpenSQLiteEventLog(path string) (*SQLiteEventLog, error) {
// Create index if it doesn't exist
if _, err := db.Exec(`CREATE INDEX IF NOT EXISTS idx_event_log_exec_id ON event_log(exec_id)`); err != nil {
db.Close()
- return nil, fmt.Errorf("sqlite_eventlog: create index: %w", err)
+ return nil, fmt.Errorf("sqlite_eventlog: create index exec_id: %w", err)
+ }
+
+ if _, err := db.Exec(`CREATE INDEX IF NOT EXISTS idx_event_log_exec_checkpoint_id ON event_log(exec_id, checkpoint_id)`); err != nil {
+ db.Close()
+ return nil, fmt.Errorf("sqlite_eventlog: create index exec_checkpoint_id: %w", err)
}
return &SQLiteEventLog{db: db}, nil
@@ -85,8 +91,8 @@ func (l *SQLiteEventLog) Append(ctx context.Context, event *proto.ExecutionEvent
}
_, err = l.db.ExecContext(ctx,
- "INSERT INTO event_log (exec_id, state, payload, timestamp) VALUES (?, ?, ?, ?)",
- event.ExecId, event.State, string(payload), timestamp)
+ "INSERT INTO event_log (exec_id, checkpoint_id, state, payload, timestamp) VALUES (?, ?, ?, ?, ?)",
+ event.ExecId, event.CheckpointId, event.State, string(payload), timestamp)
if err != nil {
return fmt.Errorf("sqlite_eventlog: insert: %w", err)
diff --git a/proto/ax.pb.go b/proto/ax.pb.go
index b64b725..a209179 100644
--- a/proto/ax.pb.go
+++ b/proto/ax.pb.go
@@ -831,7 +831,8 @@ type ExecutionEvent struct {
Inputs []*Message `protobuf:"bytes,3,rep,name=inputs,proto3" json:"inputs,omitempty"`
Outputs []*Message `protobuf:"bytes,4,rep,name=outputs,proto3" json:"outputs,omitempty"`
State State `protobuf:"varint,5,opt,name=state,proto3,enum=proto.State" json:"state,omitempty"`
- Timestamp *timestamppb.Timestamp `protobuf:"bytes,6,opt,name=timestamp,proto3" json:"timestamp,omitempty"` // string checkpoint_id = 10;
+ Timestamp *timestamppb.Timestamp `protobuf:"bytes,6,opt,name=timestamp,proto3" json:"timestamp,omitempty"`
+ CheckpointId string `protobuf:"bytes,7,opt,name=checkpoint_id,json=checkpointId,proto3" json:"checkpoint_id,omitempty"`
unknownFields protoimpl.UnknownFields
sizeCache protoimpl.SizeCache
}
@@ -908,6 +909,13 @@ func (x *ExecutionEvent) GetTimestamp() *timestamppb.Timestamp {
return nil
}
+func (x *ExecutionEvent) GetCheckpointId() string {
+ if x != nil {
+ return x.CheckpointId
+ }
+ return ""
+}
+
// HealthCheckRequest for agent health checks
type HealthCheckRequest struct {
state protoimpl.MessageState `protogen:"open.v1"`
@@ -1515,14 +1523,15 @@ const file_proto_ax_proto_rawDesc = "" +
"J\x04\b\v\x10\x1a\"G\n" +
"\aMessage\x12\x12\n" +
"\x04role\x18\x01 \x01(\tR\x04role\x12(\n" +
- "\acontent\x18\x02 \x01(\v2\x0e.proto.ContentR\acontent\"\xf4\x01\n" +
+ "\acontent\x18\x02 \x01(\v2\x0e.proto.ContentR\acontent\"\x99\x02\n" +
"\x0eExecutionEvent\x12\x17\n" +
"\aexec_id\x18\x01 \x01(\tR\x06execId\x12\x19\n" +
"\bagent_id\x18\x02 \x01(\tR\aagentId\x12&\n" +
"\x06inputs\x18\x03 \x03(\v2\x0e.proto.MessageR\x06inputs\x12(\n" +
"\aoutputs\x18\x04 \x03(\v2\x0e.proto.MessageR\aoutputs\x12\"\n" +
"\x05state\x18\x05 \x01(\x0e2\f.proto.StateR\x05state\x128\n" +
- "\ttimestamp\x18\x06 \x01(\v2\x1a.google.protobuf.TimestampR\ttimestamp\"\x14\n" +
+ "\ttimestamp\x18\x06 \x01(\v2\x1a.google.protobuf.TimestampR\ttimestamp\x12#\n" +
+ "\rcheckpoint_id\x18\a \x01(\tR\fcheckpointId\"\x14\n" +
"\x12HealthCheckRequest\"I\n" +
"\x13HealthCheckResponse\x12\x18\n" +
"\ahealthy\x18\x01 \x01(\bR\ahealthy\x12\x18\n" +
diff --git a/proto/ax.proto b/proto/ax.proto
index 670bb68..82710dc 100644
--- a/proto/ax.proto
+++ b/proto/ax.proto
@@ -116,7 +116,7 @@ message ExecutionEvent {
repeated Message outputs = 4;
State state = 5;
google.protobuf.Timestamp timestamp = 6;
- // string checkpoint_id = 10;
+ string checkpoint_id = 7;
}
// HealthCheckRequest for agent health checks