forked from microsoft/autogen
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathagent_worker.proto
146 lines (121 loc) · 3.41 KB
/
agent_worker.proto
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
syntax = "proto3";
package agents;
option csharp_namespace = "Microsoft.AutoGen.Contracts";
import "cloudevent.proto";
import "google/protobuf/any.proto";
message TopicId {
string type = 1;
string source = 2;
}
message AgentId {
string type = 1;
string key = 2;
}
message Payload {
string data_type = 1;
string data_content_type = 2;
bytes data = 3;
}
message RpcRequest {
string request_id = 1;
optional AgentId source = 2;
AgentId target = 3;
string method = 4;
Payload payload = 5;
map<string, string> metadata = 6;
}
message RpcResponse {
string request_id = 1;
Payload payload = 2;
string error = 3;
map<string, string> metadata = 4;
}
message Event {
string topic_type = 1;
string topic_source = 2;
optional AgentId source = 3;
Payload payload = 4;
map<string, string> metadata = 5;
}
message RegisterAgentTypeRequest {
string request_id = 1; // TODO: remove once message based requests are removed
string type = 2;
}
message RegisterAgentTypeResponse {
string request_id = 1; // TODO: remove once message based requests are removed
bool success = 2;
optional string error = 3;
}
message TypeSubscription {
string topic_type = 1;
string agent_type = 2;
}
message TypePrefixSubscription {
string topic_type_prefix = 1;
string agent_type = 2;
}
message Subscription {
string id = 1;
oneof subscription {
TypeSubscription typeSubscription = 2;
TypePrefixSubscription typePrefixSubscription = 3;
}
}
message AddSubscriptionRequest {
string request_id = 1; // TODO: remove once message based requests are removed
Subscription subscription = 2;
}
message AddSubscriptionResponse {
string request_id = 1; // TODO: remove once message based requests are removed
bool success = 2;
optional string error = 3;
}
message RemoveSubscriptionRequest {
string id = 1;
}
message RemoveSubscriptionResponse {
bool success = 1;
optional string error = 2;
}
message GetSubscriptionsRequest {}
message GetSubscriptionsResponse {
repeated Subscription subscriptions = 1;
}
service AgentRpc {
rpc OpenChannel (stream Message) returns (stream Message);
rpc GetState(AgentId) returns (GetStateResponse);
rpc SaveState(AgentState) returns (SaveStateResponse);
rpc RegisterAgent(RegisterAgentTypeRequest) returns (RegisterAgentTypeResponse);
rpc AddSubscription(AddSubscriptionRequest) returns (AddSubscriptionResponse);
rpc RemoveSubscription(RemoveSubscriptionRequest) returns (RemoveSubscriptionResponse);
rpc GetSubscriptions(GetSubscriptionsRequest) returns (GetSubscriptionsResponse);
}
message AgentState {
AgentId agent_id = 1;
string eTag = 2;
oneof data {
bytes binary_data = 3;
string text_data = 4;
google.protobuf.Any proto_data = 5;
}
}
message GetStateResponse {
AgentState agent_state = 1;
bool success = 2;
optional string error = 3;
}
message SaveStateResponse {
bool success = 1;
optional string error = 2;
}
message Message {
oneof message {
RpcRequest request = 1;
RpcResponse response = 2;
io.cloudevents.v1.CloudEvent cloudEvent = 3;
RegisterAgentTypeRequest registerAgentTypeRequest = 4;
RegisterAgentTypeResponse registerAgentTypeResponse = 5;
AddSubscriptionRequest addSubscriptionRequest = 6;
AddSubscriptionResponse addSubscriptionResponse = 7;
}
}