syntax = "proto3";
package agent;
// The Cortex Server exposes this service
service AgentOrchestrator {
// Bi-directional stream for persistent connection (Phone Home Pattern)
rpc Connect(stream NodeMessage) returns (stream ServerMessage);
}
// Sent from the Agent Node Client to the Cortex Server
message NodeMessage {
oneof payload {
RegistrationRequest registration = 1;
Heartbeat heartbeat = 2;
TaskResponse task_response = 3;
}
}
// Sent from the Cortex Server to the Agent Node Client
message ServerMessage {
oneof payload {
RegistrationResponse registration_ack = 1;
TaskRequest task_request = 2;
}
}
message RegistrationRequest {
string node_id = 1;
string version = 2;
string platform = 3;
map<string, bool> capabilities = 4;
string auth_token = 5; // Short-lived JWT identifying the User/Workspace
}
message RegistrationResponse {
bool success = 1;
string error_message = 2;
string session_id = 3;
string next_token_rotation_ms = 4;
}
message Heartbeat {
string node_id = 1;
float cpu_usage_percent = 2;
float memory_usage_percent = 3;
int32 active_task_count = 4;
}
message TaskRequest {
string task_id = 1;
string task_type = 2; // "shell", "browser_cdp"
string payload_json = 3;
int32 timeout_ms = 4;
bool cancellable = 5;
string capability_required = 6;
string idempotency_key = 7;
string trace_id = 8; // For OpenTelemetry observability
string signature = 9; // Cryptographic signature of payload_json
}
message TaskResponse {
string task_id = 1;
enum Status {
UNKNOWN = 0;
SUCCESS = 1;
ERROR = 2;
CANCELLED = 3;
TIMEOUT = 4;
}
Status status = 2;
string stdout = 3;
string stderr = 4;
string structured_output_json = 5;
int32 duration_ms = 6;
string trace_id = 7;
}