Repository navigation
Expand file tree
/
Copy pathax.proto
More file actions
213 lines (179 loc) · 6 KB
/
Copy pathax.proto
File metadata and controls
213 lines (179 loc) · 6 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
// Copyright 2026 Google LLC
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
syntax = "proto3";
package ax;
import "google/protobuf/timestamp.proto";
import "proto/content.proto";
option go_package = "github.com/google/ax/proto";
// WARNING: This file is in active development and
// significant changes can be made with breaking changes.
message AgentStart {
string agent_id = 1;
bytes agent_config = 2;
repeated Message messages = 3;
}
message AgentOutputs {
repeated Message messages = 1;
}
message AgentEnd {}
message AgentRequest {
string conversation_id = 1;
string exec_id = 2;
AgentStart start = 3;
}
string conversation_id = 1;
string exec_id = 2;
oneof type {
AgentOutputs outputs = 3;
AgentEnd end = 4;
}
}
// Message is a message in the history.
message Message {
string role = 1; // user, assistant, or model
Content content = 2; // content of the message
// If true, the message is stored only in the execution log
// (for resumption) but not in the conversation history,
// and not emitted to the client or any agent.
bool internal_only = 3;
}
// A conversation is the historical session that consist of
// a number of execution. A conversation cannot be continued
// before the last execution is completed or failed.
message ConversationEvent {
string conversation_id = 1;
int32 seq = 2;
string exec_id = 3;
string harness_id = 4;
bytes harness_config = 5;
repeated Message messages = 6;
State state = 7;
}
// ExecutionEvent is the entry in the event log. ExecutionEvents are used
// to record the actions taken place in the executor.
// The executor can replay the events for resumability.
message ExecutionEvent {
string exec_id = 1;
string agent_id = 2;
bytes agent_config = 3;
repeated Message inputs = 4;
repeated Message outputs = 5;
State state = 6;
google.protobuf.Timestamp timestamp = 7;
// TODO(jbd): Remove agent_id and agent_config once controller2 is in place.
// These fields are supplied from the ConversationEvent log.
}
// HealthCheckRequest for agent health checks
message HealthCheckRequest {}
// HealthCheckResponse contains agent health status
message HealthCheckResponse {
bool healthy = 1;
string message = 2;
}
// AgentService defines the gRPC service for agent communication.
// This protocol enables a bidirectional communication between the
// controller and the agent. Agents can start new agentic calls via
// the controller within the same execution boundary by using the channel.
//
// WARNING: There will be significant changes to this protocol as
// we are solidifying resumption on the wire.
service AgentService {
// Connect is used by agents to connect to the controller.
rpc Connect(AgentRequest) returns (stream AgentResponse);
// HealthCheck checks if the agent is healthy and responsive
rpc HealthCheck(HealthCheckRequest) returns (HealthCheckResponse);
}
message HarnessStart {
// Per-execution harness configuration.
bytes harness_config = 1;
repeated Message messages = 2;
}
// HarnessCancel aborts the in-flight harness execution.
message HarnessCancel {
CancelReason reason = 1;
}
message HarnessRequest {
string conversation_id = 1;
string harness_id = 2;
oneof type {
HarnessStart start = 3;
HarnessCancel cancel = 4;
}
}
message HarnessOutputs {
repeated Message messages = 1;
}
message HarnessEnd {
// Terminal state for the harness execution.
State state = 1;
// Optional error message.
string error_message = 2;
}
message HarnessResponse {
string conversation_id = 1;
oneof type {
HarnessOutputs outputs = 2;
HarnessEnd end = 3;
}
}
service HarnessService {
// Connect drives one harness execution. The client sends
// HarnessRequest{start} (and may send one HarnessRequest{cancel}
// mid-stream), and the server streams zero or more HarnessResponse{outputs}
// frames terminated by exactly one HarnessResponse{end}.
rpc Connect(stream HarnessRequest) returns (stream HarnessResponse);
}
// State represents the state of an execution
enum State {
STATE_UNSPECIFIED = 0; // Unspecified state
STATE_PENDING = 1;
STATE_FAILED = 2;
STATE_COMPLETED = 3;
STATE_CANCELED = 4;
}
// CancelReason explains why an in-flight execution is canceled.
enum CancelReason {
CANCEL_REASON_UNSPECIFIED = 0;
CANCEL_REASON_USER_REQUESTED = 1;
CANCEL_REASON_TIMEOUT = 2;
CANCEL_REASON_INTERNAL_ERROR = 3;
}
// ExecRequest for executing.
message ExecRequest {
string conversation_id = 1; // Unique conversation identifier
repeated Message inputs = 2; // New inputs
int32 last_seq = 3; // Last sequence number seen by the client
string agent_id = 4; // Agent ID, if empty planner is used
bytes agent_config = 5; // Agent configuration if any
}
// ExecResponse contains the result of an execution.
message ExecResponse {
repeated Message outputs = 1; // Output content
int32 seq = 2; // Seq of the outputs
}
service ControllerService {
// Exec executes an agentic task or resumes an existing one with streaming responses
// If the conversation_id already exists, it will be resumed.
rpc Exec(ExecRequest) returns (stream ExecResponse);
}
message DeleteConversationRequest {
string conversation_id = 1;
}
message DeleteConversationResponse {}
service ConversationService {
// Deletes conversational events and all event log resources
// for its children executions.
rpc DeleteConversation(DeleteConversationRequest) returns (DeleteConversationResponse);
}