levier-runtime 0.1.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- levier_runtime/__init__.py +57 -0
- levier_runtime/channel/__init__.py +5 -0
- levier_runtime/channel/client.py +317 -0
- levier_runtime/channel/envelope.py +57 -0
- levier_runtime/cli.py +116 -0
- levier_runtime/config.py +289 -0
- levier_runtime/context.py +409 -0
- levier_runtime/events.py +100 -0
- levier_runtime/ids.py +36 -0
- levier_runtime/llm/__init__.py +44 -0
- levier_runtime/llm/anthropic.py +410 -0
- levier_runtime/llm/base.py +134 -0
- levier_runtime/llm/http.py +133 -0
- levier_runtime/llm/openai.py +379 -0
- levier_runtime/llm/router.py +56 -0
- levier_runtime/manager.py +272 -0
- levier_runtime/mcp/__init__.py +8 -0
- levier_runtime/mcp/client.py +289 -0
- levier_runtime/profile.py +91 -0
- levier_runtime/react/__init__.py +11 -0
- levier_runtime/react/agent.py +527 -0
- levier_runtime/react/checkpoint.py +193 -0
- levier_runtime/runtime.py +139 -0
- levier_runtime/toolbox.py +261 -0
- levier_runtime/tools/__init__.py +23 -0
- levier_runtime/tools/base.py +131 -0
- levier_runtime/types.py +143 -0
- levier_runtime-0.1.0.dist-info/METADATA +101 -0
- levier_runtime-0.1.0.dist-info/RECORD +37 -0
- levier_runtime-0.1.0.dist-info/WHEEL +5 -0
- levier_runtime-0.1.0.dist-info/top_level.txt +2 -0
- middleware/__init__.py +1 -0
- middleware/runtime/__init__.py +1 -0
- middleware/runtime/v1/__init__.py +1 -0
- middleware/runtime/v1/runtime_pb2.py +98 -0
- middleware/runtime/v1/runtime_pb2.pyi +332 -0
- middleware/runtime/v1/runtime_pb2_grpc.py +84 -0
|
@@ -0,0 +1,332 @@
|
|
|
1
|
+
from google.protobuf import struct_pb2 as _struct_pb2
|
|
2
|
+
from google.protobuf.internal import containers as _containers
|
|
3
|
+
from google.protobuf.internal import enum_type_wrapper as _enum_type_wrapper
|
|
4
|
+
from google.protobuf import descriptor as _descriptor
|
|
5
|
+
from google.protobuf import message as _message
|
|
6
|
+
from collections.abc import Iterable as _Iterable, Mapping as _Mapping
|
|
7
|
+
from typing import ClassVar as _ClassVar, Optional as _Optional, Union as _Union
|
|
8
|
+
|
|
9
|
+
DESCRIPTOR: _descriptor.FileDescriptor
|
|
10
|
+
|
|
11
|
+
class RuntimeType(int, metaclass=_enum_type_wrapper.EnumTypeWrapper):
|
|
12
|
+
__slots__ = ()
|
|
13
|
+
RUNTIME_TYPE_UNSPECIFIED: _ClassVar[RuntimeType]
|
|
14
|
+
NORMAL: _ClassVar[RuntimeType]
|
|
15
|
+
SANDBOX: _ClassVar[RuntimeType]
|
|
16
|
+
LONGTERM: _ClassVar[RuntimeType]
|
|
17
|
+
|
|
18
|
+
class ToolScope(int, metaclass=_enum_type_wrapper.EnumTypeWrapper):
|
|
19
|
+
__slots__ = ()
|
|
20
|
+
TOOL_SCOPE_UNSPECIFIED: _ClassVar[ToolScope]
|
|
21
|
+
LOCAL: _ClassVar[ToolScope]
|
|
22
|
+
GLOBAL: _ClassVar[ToolScope]
|
|
23
|
+
|
|
24
|
+
class EventType(int, metaclass=_enum_type_wrapper.EnumTypeWrapper):
|
|
25
|
+
__slots__ = ()
|
|
26
|
+
EVENT_TYPE_UNSPECIFIED: _ClassVar[EventType]
|
|
27
|
+
RUN_STATUS: _ClassVar[EventType]
|
|
28
|
+
MESSAGE_DELTA: _ClassVar[EventType]
|
|
29
|
+
MESSAGE_COMPLETED: _ClassVar[EventType]
|
|
30
|
+
TOOL_CALL_BEGIN: _ClassVar[EventType]
|
|
31
|
+
TOOL_CALL_END: _ClassVar[EventType]
|
|
32
|
+
USAGE: _ClassVar[EventType]
|
|
33
|
+
ERROR: _ClassVar[EventType]
|
|
34
|
+
CHECKPOINT_SAVED: _ClassVar[EventType]
|
|
35
|
+
RUNTIME_TYPE_UNSPECIFIED: RuntimeType
|
|
36
|
+
NORMAL: RuntimeType
|
|
37
|
+
SANDBOX: RuntimeType
|
|
38
|
+
LONGTERM: RuntimeType
|
|
39
|
+
TOOL_SCOPE_UNSPECIFIED: ToolScope
|
|
40
|
+
LOCAL: ToolScope
|
|
41
|
+
GLOBAL: ToolScope
|
|
42
|
+
EVENT_TYPE_UNSPECIFIED: EventType
|
|
43
|
+
RUN_STATUS: EventType
|
|
44
|
+
MESSAGE_DELTA: EventType
|
|
45
|
+
MESSAGE_COMPLETED: EventType
|
|
46
|
+
TOOL_CALL_BEGIN: EventType
|
|
47
|
+
TOOL_CALL_END: EventType
|
|
48
|
+
USAGE: EventType
|
|
49
|
+
ERROR: EventType
|
|
50
|
+
CHECKPOINT_SAVED: EventType
|
|
51
|
+
|
|
52
|
+
class Envelope(_message.Message):
|
|
53
|
+
__slots__ = ("msg_id", "correlation_id", "run_id", "ts_ms", "attempt", "lease_epoch", "hello", "heartbeat", "task_assign", "task_ack", "event", "tool_call_request", "tool_call_result", "cancel", "reconcile", "checkpoint", "error")
|
|
54
|
+
MSG_ID_FIELD_NUMBER: _ClassVar[int]
|
|
55
|
+
CORRELATION_ID_FIELD_NUMBER: _ClassVar[int]
|
|
56
|
+
RUN_ID_FIELD_NUMBER: _ClassVar[int]
|
|
57
|
+
TS_MS_FIELD_NUMBER: _ClassVar[int]
|
|
58
|
+
ATTEMPT_FIELD_NUMBER: _ClassVar[int]
|
|
59
|
+
LEASE_EPOCH_FIELD_NUMBER: _ClassVar[int]
|
|
60
|
+
HELLO_FIELD_NUMBER: _ClassVar[int]
|
|
61
|
+
HEARTBEAT_FIELD_NUMBER: _ClassVar[int]
|
|
62
|
+
TASK_ASSIGN_FIELD_NUMBER: _ClassVar[int]
|
|
63
|
+
TASK_ACK_FIELD_NUMBER: _ClassVar[int]
|
|
64
|
+
EVENT_FIELD_NUMBER: _ClassVar[int]
|
|
65
|
+
TOOL_CALL_REQUEST_FIELD_NUMBER: _ClassVar[int]
|
|
66
|
+
TOOL_CALL_RESULT_FIELD_NUMBER: _ClassVar[int]
|
|
67
|
+
CANCEL_FIELD_NUMBER: _ClassVar[int]
|
|
68
|
+
RECONCILE_FIELD_NUMBER: _ClassVar[int]
|
|
69
|
+
CHECKPOINT_FIELD_NUMBER: _ClassVar[int]
|
|
70
|
+
ERROR_FIELD_NUMBER: _ClassVar[int]
|
|
71
|
+
msg_id: str
|
|
72
|
+
correlation_id: str
|
|
73
|
+
run_id: str
|
|
74
|
+
ts_ms: int
|
|
75
|
+
attempt: int
|
|
76
|
+
lease_epoch: int
|
|
77
|
+
hello: Hello
|
|
78
|
+
heartbeat: Heartbeat
|
|
79
|
+
task_assign: TaskAssign
|
|
80
|
+
task_ack: TaskAck
|
|
81
|
+
event: Event
|
|
82
|
+
tool_call_request: ToolCallRequest
|
|
83
|
+
tool_call_result: ToolCallResult
|
|
84
|
+
cancel: Cancel
|
|
85
|
+
reconcile: Reconcile
|
|
86
|
+
checkpoint: Checkpoint
|
|
87
|
+
error: ErrorReport
|
|
88
|
+
def __init__(self, msg_id: _Optional[str] = ..., correlation_id: _Optional[str] = ..., run_id: _Optional[str] = ..., ts_ms: _Optional[int] = ..., attempt: _Optional[int] = ..., lease_epoch: _Optional[int] = ..., hello: _Optional[_Union[Hello, _Mapping]] = ..., heartbeat: _Optional[_Union[Heartbeat, _Mapping]] = ..., task_assign: _Optional[_Union[TaskAssign, _Mapping]] = ..., task_ack: _Optional[_Union[TaskAck, _Mapping]] = ..., event: _Optional[_Union[Event, _Mapping]] = ..., tool_call_request: _Optional[_Union[ToolCallRequest, _Mapping]] = ..., tool_call_result: _Optional[_Union[ToolCallResult, _Mapping]] = ..., cancel: _Optional[_Union[Cancel, _Mapping]] = ..., reconcile: _Optional[_Union[Reconcile, _Mapping]] = ..., checkpoint: _Optional[_Union[Checkpoint, _Mapping]] = ..., error: _Optional[_Union[ErrorReport, _Mapping]] = ...) -> None: ...
|
|
89
|
+
|
|
90
|
+
class Hello(_message.Message):
|
|
91
|
+
__slots__ = ("daemon_id", "auth_token", "runtime_type", "max_concurrent_runs", "version", "labels", "running_runs", "runtime_name")
|
|
92
|
+
class LabelsEntry(_message.Message):
|
|
93
|
+
__slots__ = ("key", "value")
|
|
94
|
+
KEY_FIELD_NUMBER: _ClassVar[int]
|
|
95
|
+
VALUE_FIELD_NUMBER: _ClassVar[int]
|
|
96
|
+
key: str
|
|
97
|
+
value: str
|
|
98
|
+
def __init__(self, key: _Optional[str] = ..., value: _Optional[str] = ...) -> None: ...
|
|
99
|
+
DAEMON_ID_FIELD_NUMBER: _ClassVar[int]
|
|
100
|
+
AUTH_TOKEN_FIELD_NUMBER: _ClassVar[int]
|
|
101
|
+
RUNTIME_TYPE_FIELD_NUMBER: _ClassVar[int]
|
|
102
|
+
MAX_CONCURRENT_RUNS_FIELD_NUMBER: _ClassVar[int]
|
|
103
|
+
VERSION_FIELD_NUMBER: _ClassVar[int]
|
|
104
|
+
LABELS_FIELD_NUMBER: _ClassVar[int]
|
|
105
|
+
RUNNING_RUNS_FIELD_NUMBER: _ClassVar[int]
|
|
106
|
+
RUNTIME_NAME_FIELD_NUMBER: _ClassVar[int]
|
|
107
|
+
daemon_id: str
|
|
108
|
+
auth_token: str
|
|
109
|
+
runtime_type: RuntimeType
|
|
110
|
+
max_concurrent_runs: int
|
|
111
|
+
version: str
|
|
112
|
+
labels: _containers.ScalarMap[str, str]
|
|
113
|
+
running_runs: _containers.RepeatedCompositeFieldContainer[RunningRun]
|
|
114
|
+
runtime_name: str
|
|
115
|
+
def __init__(self, daemon_id: _Optional[str] = ..., auth_token: _Optional[str] = ..., runtime_type: _Optional[_Union[RuntimeType, str]] = ..., max_concurrent_runs: _Optional[int] = ..., version: _Optional[str] = ..., labels: _Optional[_Mapping[str, str]] = ..., running_runs: _Optional[_Iterable[_Union[RunningRun, _Mapping]]] = ..., runtime_name: _Optional[str] = ...) -> None: ...
|
|
116
|
+
|
|
117
|
+
class RunningRun(_message.Message):
|
|
118
|
+
__slots__ = ("run_id", "lease_epoch")
|
|
119
|
+
RUN_ID_FIELD_NUMBER: _ClassVar[int]
|
|
120
|
+
LEASE_EPOCH_FIELD_NUMBER: _ClassVar[int]
|
|
121
|
+
run_id: str
|
|
122
|
+
lease_epoch: int
|
|
123
|
+
def __init__(self, run_id: _Optional[str] = ..., lease_epoch: _Optional[int] = ...) -> None: ...
|
|
124
|
+
|
|
125
|
+
class Reconcile(_message.Message):
|
|
126
|
+
__slots__ = ("cancel_run_ids",)
|
|
127
|
+
CANCEL_RUN_IDS_FIELD_NUMBER: _ClassVar[int]
|
|
128
|
+
cancel_run_ids: _containers.RepeatedScalarFieldContainer[str]
|
|
129
|
+
def __init__(self, cancel_run_ids: _Optional[_Iterable[str]] = ...) -> None: ...
|
|
130
|
+
|
|
131
|
+
class Heartbeat(_message.Message):
|
|
132
|
+
__slots__ = ("running_count", "cpu_load", "mem_mb")
|
|
133
|
+
RUNNING_COUNT_FIELD_NUMBER: _ClassVar[int]
|
|
134
|
+
CPU_LOAD_FIELD_NUMBER: _ClassVar[int]
|
|
135
|
+
MEM_MB_FIELD_NUMBER: _ClassVar[int]
|
|
136
|
+
running_count: int
|
|
137
|
+
cpu_load: float
|
|
138
|
+
mem_mb: float
|
|
139
|
+
def __init__(self, running_count: _Optional[int] = ..., cpu_load: _Optional[float] = ..., mem_mb: _Optional[float] = ...) -> None: ...
|
|
140
|
+
|
|
141
|
+
class TaskAssign(_message.Message):
|
|
142
|
+
__slots__ = ("run_id", "app_id", "params", "input", "model", "tools", "mcp_bindings", "timeouts", "session_id", "resume_from", "trace_context")
|
|
143
|
+
RUN_ID_FIELD_NUMBER: _ClassVar[int]
|
|
144
|
+
APP_ID_FIELD_NUMBER: _ClassVar[int]
|
|
145
|
+
PARAMS_FIELD_NUMBER: _ClassVar[int]
|
|
146
|
+
INPUT_FIELD_NUMBER: _ClassVar[int]
|
|
147
|
+
MODEL_FIELD_NUMBER: _ClassVar[int]
|
|
148
|
+
TOOLS_FIELD_NUMBER: _ClassVar[int]
|
|
149
|
+
MCP_BINDINGS_FIELD_NUMBER: _ClassVar[int]
|
|
150
|
+
TIMEOUTS_FIELD_NUMBER: _ClassVar[int]
|
|
151
|
+
SESSION_ID_FIELD_NUMBER: _ClassVar[int]
|
|
152
|
+
RESUME_FROM_FIELD_NUMBER: _ClassVar[int]
|
|
153
|
+
TRACE_CONTEXT_FIELD_NUMBER: _ClassVar[int]
|
|
154
|
+
run_id: str
|
|
155
|
+
app_id: str
|
|
156
|
+
params: _struct_pb2.Struct
|
|
157
|
+
input: _containers.RepeatedCompositeFieldContainer[ChatMessage]
|
|
158
|
+
model: ModelProfile
|
|
159
|
+
tools: _containers.RepeatedCompositeFieldContainer[ToolManifest]
|
|
160
|
+
mcp_bindings: _containers.RepeatedCompositeFieldContainer[McpBinding]
|
|
161
|
+
timeouts: TimeoutProfile
|
|
162
|
+
session_id: str
|
|
163
|
+
resume_from: Checkpoint
|
|
164
|
+
trace_context: str
|
|
165
|
+
def __init__(self, run_id: _Optional[str] = ..., app_id: _Optional[str] = ..., params: _Optional[_Union[_struct_pb2.Struct, _Mapping]] = ..., input: _Optional[_Iterable[_Union[ChatMessage, _Mapping]]] = ..., model: _Optional[_Union[ModelProfile, _Mapping]] = ..., tools: _Optional[_Iterable[_Union[ToolManifest, _Mapping]]] = ..., mcp_bindings: _Optional[_Iterable[_Union[McpBinding, _Mapping]]] = ..., timeouts: _Optional[_Union[TimeoutProfile, _Mapping]] = ..., session_id: _Optional[str] = ..., resume_from: _Optional[_Union[Checkpoint, _Mapping]] = ..., trace_context: _Optional[str] = ...) -> None: ...
|
|
166
|
+
|
|
167
|
+
class ChatMessage(_message.Message):
|
|
168
|
+
__slots__ = ("role", "content", "name")
|
|
169
|
+
ROLE_FIELD_NUMBER: _ClassVar[int]
|
|
170
|
+
CONTENT_FIELD_NUMBER: _ClassVar[int]
|
|
171
|
+
NAME_FIELD_NUMBER: _ClassVar[int]
|
|
172
|
+
role: str
|
|
173
|
+
content: str
|
|
174
|
+
name: str
|
|
175
|
+
def __init__(self, role: _Optional[str] = ..., content: _Optional[str] = ..., name: _Optional[str] = ...) -> None: ...
|
|
176
|
+
|
|
177
|
+
class ModelProfile(_message.Message):
|
|
178
|
+
__slots__ = ("provider", "model", "api_key", "base_url", "params")
|
|
179
|
+
class ParamsEntry(_message.Message):
|
|
180
|
+
__slots__ = ("key", "value")
|
|
181
|
+
KEY_FIELD_NUMBER: _ClassVar[int]
|
|
182
|
+
VALUE_FIELD_NUMBER: _ClassVar[int]
|
|
183
|
+
key: str
|
|
184
|
+
value: str
|
|
185
|
+
def __init__(self, key: _Optional[str] = ..., value: _Optional[str] = ...) -> None: ...
|
|
186
|
+
PROVIDER_FIELD_NUMBER: _ClassVar[int]
|
|
187
|
+
MODEL_FIELD_NUMBER: _ClassVar[int]
|
|
188
|
+
API_KEY_FIELD_NUMBER: _ClassVar[int]
|
|
189
|
+
BASE_URL_FIELD_NUMBER: _ClassVar[int]
|
|
190
|
+
PARAMS_FIELD_NUMBER: _ClassVar[int]
|
|
191
|
+
provider: str
|
|
192
|
+
model: str
|
|
193
|
+
api_key: str
|
|
194
|
+
base_url: str
|
|
195
|
+
params: _containers.ScalarMap[str, str]
|
|
196
|
+
def __init__(self, provider: _Optional[str] = ..., model: _Optional[str] = ..., api_key: _Optional[str] = ..., base_url: _Optional[str] = ..., params: _Optional[_Mapping[str, str]] = ...) -> None: ...
|
|
197
|
+
|
|
198
|
+
class ToolManifest(_message.Message):
|
|
199
|
+
__slots__ = ("name", "description", "input_schema_json", "scope")
|
|
200
|
+
NAME_FIELD_NUMBER: _ClassVar[int]
|
|
201
|
+
DESCRIPTION_FIELD_NUMBER: _ClassVar[int]
|
|
202
|
+
INPUT_SCHEMA_JSON_FIELD_NUMBER: _ClassVar[int]
|
|
203
|
+
SCOPE_FIELD_NUMBER: _ClassVar[int]
|
|
204
|
+
name: str
|
|
205
|
+
description: str
|
|
206
|
+
input_schema_json: str
|
|
207
|
+
scope: ToolScope
|
|
208
|
+
def __init__(self, name: _Optional[str] = ..., description: _Optional[str] = ..., input_schema_json: _Optional[str] = ..., scope: _Optional[_Union[ToolScope, str]] = ...) -> None: ...
|
|
209
|
+
|
|
210
|
+
class McpBinding(_message.Message):
|
|
211
|
+
__slots__ = ("server_name", "transport", "command", "args", "env", "url", "headers", "allowed_tools", "namespace")
|
|
212
|
+
class EnvEntry(_message.Message):
|
|
213
|
+
__slots__ = ("key", "value")
|
|
214
|
+
KEY_FIELD_NUMBER: _ClassVar[int]
|
|
215
|
+
VALUE_FIELD_NUMBER: _ClassVar[int]
|
|
216
|
+
key: str
|
|
217
|
+
value: str
|
|
218
|
+
def __init__(self, key: _Optional[str] = ..., value: _Optional[str] = ...) -> None: ...
|
|
219
|
+
class HeadersEntry(_message.Message):
|
|
220
|
+
__slots__ = ("key", "value")
|
|
221
|
+
KEY_FIELD_NUMBER: _ClassVar[int]
|
|
222
|
+
VALUE_FIELD_NUMBER: _ClassVar[int]
|
|
223
|
+
key: str
|
|
224
|
+
value: str
|
|
225
|
+
def __init__(self, key: _Optional[str] = ..., value: _Optional[str] = ...) -> None: ...
|
|
226
|
+
SERVER_NAME_FIELD_NUMBER: _ClassVar[int]
|
|
227
|
+
TRANSPORT_FIELD_NUMBER: _ClassVar[int]
|
|
228
|
+
COMMAND_FIELD_NUMBER: _ClassVar[int]
|
|
229
|
+
ARGS_FIELD_NUMBER: _ClassVar[int]
|
|
230
|
+
ENV_FIELD_NUMBER: _ClassVar[int]
|
|
231
|
+
URL_FIELD_NUMBER: _ClassVar[int]
|
|
232
|
+
HEADERS_FIELD_NUMBER: _ClassVar[int]
|
|
233
|
+
ALLOWED_TOOLS_FIELD_NUMBER: _ClassVar[int]
|
|
234
|
+
NAMESPACE_FIELD_NUMBER: _ClassVar[int]
|
|
235
|
+
server_name: str
|
|
236
|
+
transport: str
|
|
237
|
+
command: str
|
|
238
|
+
args: _containers.RepeatedScalarFieldContainer[str]
|
|
239
|
+
env: _containers.ScalarMap[str, str]
|
|
240
|
+
url: str
|
|
241
|
+
headers: _containers.ScalarMap[str, str]
|
|
242
|
+
allowed_tools: _containers.RepeatedScalarFieldContainer[str]
|
|
243
|
+
namespace: str
|
|
244
|
+
def __init__(self, server_name: _Optional[str] = ..., transport: _Optional[str] = ..., command: _Optional[str] = ..., args: _Optional[_Iterable[str]] = ..., env: _Optional[_Mapping[str, str]] = ..., url: _Optional[str] = ..., headers: _Optional[_Mapping[str, str]] = ..., allowed_tools: _Optional[_Iterable[str]] = ..., namespace: _Optional[str] = ...) -> None: ...
|
|
245
|
+
|
|
246
|
+
class TimeoutProfile(_message.Message):
|
|
247
|
+
__slots__ = ("run_timeout_ms", "tool_timeout_ms")
|
|
248
|
+
RUN_TIMEOUT_MS_FIELD_NUMBER: _ClassVar[int]
|
|
249
|
+
TOOL_TIMEOUT_MS_FIELD_NUMBER: _ClassVar[int]
|
|
250
|
+
run_timeout_ms: int
|
|
251
|
+
tool_timeout_ms: int
|
|
252
|
+
def __init__(self, run_timeout_ms: _Optional[int] = ..., tool_timeout_ms: _Optional[int] = ...) -> None: ...
|
|
253
|
+
|
|
254
|
+
class TaskAck(_message.Message):
|
|
255
|
+
__slots__ = ("accepted", "reason")
|
|
256
|
+
ACCEPTED_FIELD_NUMBER: _ClassVar[int]
|
|
257
|
+
REASON_FIELD_NUMBER: _ClassVar[int]
|
|
258
|
+
accepted: bool
|
|
259
|
+
reason: str
|
|
260
|
+
def __init__(self, accepted: _Optional[bool] = ..., reason: _Optional[str] = ...) -> None: ...
|
|
261
|
+
|
|
262
|
+
class Event(_message.Message):
|
|
263
|
+
__slots__ = ("seq", "type", "ephemeral", "data", "source")
|
|
264
|
+
SEQ_FIELD_NUMBER: _ClassVar[int]
|
|
265
|
+
TYPE_FIELD_NUMBER: _ClassVar[int]
|
|
266
|
+
EPHEMERAL_FIELD_NUMBER: _ClassVar[int]
|
|
267
|
+
DATA_FIELD_NUMBER: _ClassVar[int]
|
|
268
|
+
SOURCE_FIELD_NUMBER: _ClassVar[int]
|
|
269
|
+
seq: int
|
|
270
|
+
type: EventType
|
|
271
|
+
ephemeral: bool
|
|
272
|
+
data: _struct_pb2.Struct
|
|
273
|
+
source: str
|
|
274
|
+
def __init__(self, seq: _Optional[int] = ..., type: _Optional[_Union[EventType, str]] = ..., ephemeral: _Optional[bool] = ..., data: _Optional[_Union[_struct_pb2.Struct, _Mapping]] = ..., source: _Optional[str] = ...) -> None: ...
|
|
275
|
+
|
|
276
|
+
class ToolCallRequest(_message.Message):
|
|
277
|
+
__slots__ = ("invocation_id", "tool_name", "arguments_json", "timeout_ms")
|
|
278
|
+
INVOCATION_ID_FIELD_NUMBER: _ClassVar[int]
|
|
279
|
+
TOOL_NAME_FIELD_NUMBER: _ClassVar[int]
|
|
280
|
+
ARGUMENTS_JSON_FIELD_NUMBER: _ClassVar[int]
|
|
281
|
+
TIMEOUT_MS_FIELD_NUMBER: _ClassVar[int]
|
|
282
|
+
invocation_id: str
|
|
283
|
+
tool_name: str
|
|
284
|
+
arguments_json: str
|
|
285
|
+
timeout_ms: int
|
|
286
|
+
def __init__(self, invocation_id: _Optional[str] = ..., tool_name: _Optional[str] = ..., arguments_json: _Optional[str] = ..., timeout_ms: _Optional[int] = ...) -> None: ...
|
|
287
|
+
|
|
288
|
+
class ToolCallResult(_message.Message):
|
|
289
|
+
__slots__ = ("invocation_id", "ok", "result_json", "error")
|
|
290
|
+
INVOCATION_ID_FIELD_NUMBER: _ClassVar[int]
|
|
291
|
+
OK_FIELD_NUMBER: _ClassVar[int]
|
|
292
|
+
RESULT_JSON_FIELD_NUMBER: _ClassVar[int]
|
|
293
|
+
ERROR_FIELD_NUMBER: _ClassVar[int]
|
|
294
|
+
invocation_id: str
|
|
295
|
+
ok: bool
|
|
296
|
+
result_json: str
|
|
297
|
+
error: ErrorInfo
|
|
298
|
+
def __init__(self, invocation_id: _Optional[str] = ..., ok: _Optional[bool] = ..., result_json: _Optional[str] = ..., error: _Optional[_Union[ErrorInfo, _Mapping]] = ...) -> None: ...
|
|
299
|
+
|
|
300
|
+
class ErrorInfo(_message.Message):
|
|
301
|
+
__slots__ = ("code", "message", "retryable")
|
|
302
|
+
CODE_FIELD_NUMBER: _ClassVar[int]
|
|
303
|
+
MESSAGE_FIELD_NUMBER: _ClassVar[int]
|
|
304
|
+
RETRYABLE_FIELD_NUMBER: _ClassVar[int]
|
|
305
|
+
code: str
|
|
306
|
+
message: str
|
|
307
|
+
retryable: bool
|
|
308
|
+
def __init__(self, code: _Optional[str] = ..., message: _Optional[str] = ..., retryable: _Optional[bool] = ...) -> None: ...
|
|
309
|
+
|
|
310
|
+
class Cancel(_message.Message):
|
|
311
|
+
__slots__ = ("reason",)
|
|
312
|
+
REASON_FIELD_NUMBER: _ClassVar[int]
|
|
313
|
+
reason: str
|
|
314
|
+
def __init__(self, reason: _Optional[str] = ...) -> None: ...
|
|
315
|
+
|
|
316
|
+
class Checkpoint(_message.Message):
|
|
317
|
+
__slots__ = ("session_id", "event_seq_watermark", "state")
|
|
318
|
+
SESSION_ID_FIELD_NUMBER: _ClassVar[int]
|
|
319
|
+
EVENT_SEQ_WATERMARK_FIELD_NUMBER: _ClassVar[int]
|
|
320
|
+
STATE_FIELD_NUMBER: _ClassVar[int]
|
|
321
|
+
session_id: str
|
|
322
|
+
event_seq_watermark: int
|
|
323
|
+
state: bytes
|
|
324
|
+
def __init__(self, session_id: _Optional[str] = ..., event_seq_watermark: _Optional[int] = ..., state: _Optional[bytes] = ...) -> None: ...
|
|
325
|
+
|
|
326
|
+
class ErrorReport(_message.Message):
|
|
327
|
+
__slots__ = ("code", "message")
|
|
328
|
+
CODE_FIELD_NUMBER: _ClassVar[int]
|
|
329
|
+
MESSAGE_FIELD_NUMBER: _ClassVar[int]
|
|
330
|
+
code: str
|
|
331
|
+
message: str
|
|
332
|
+
def __init__(self, code: _Optional[str] = ..., message: _Optional[str] = ...) -> None: ...
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
# Generated by the gRPC Python protocol compiler plugin. DO NOT EDIT!
|
|
2
|
+
"""Client and server classes corresponding to protobuf-defined services."""
|
|
3
|
+
import grpc
|
|
4
|
+
|
|
5
|
+
from middleware.runtime.v1 import runtime_pb2 as middleware_dot_runtime_dot_v1_dot_runtime__pb2
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
class RuntimeServiceStub:
|
|
9
|
+
"""RuntimeService carries all daemon control and data messages over one
|
|
10
|
+
bidirectional stream.
|
|
11
|
+
"""
|
|
12
|
+
|
|
13
|
+
def __init__(self, channel):
|
|
14
|
+
"""Constructor.
|
|
15
|
+
|
|
16
|
+
Args:
|
|
17
|
+
channel: A grpc.Channel.
|
|
18
|
+
"""
|
|
19
|
+
self.Channel = channel.stream_stream(
|
|
20
|
+
'/middleware.runtime.v1.RuntimeService/Channel',
|
|
21
|
+
request_serializer=middleware_dot_runtime_dot_v1_dot_runtime__pb2.Envelope.SerializeToString,
|
|
22
|
+
response_deserializer=middleware_dot_runtime_dot_v1_dot_runtime__pb2.Envelope.FromString,
|
|
23
|
+
_registered_method=True)
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
class RuntimeServiceServicer:
|
|
27
|
+
"""RuntimeService carries all daemon control and data messages over one
|
|
28
|
+
bidirectional stream.
|
|
29
|
+
"""
|
|
30
|
+
|
|
31
|
+
def Channel(self, request_iterator, context):
|
|
32
|
+
"""Channel is the single long-lived stream established by a daemon.
|
|
33
|
+
"""
|
|
34
|
+
context.set_code(grpc.StatusCode.UNIMPLEMENTED)
|
|
35
|
+
context.set_details('Method not implemented!')
|
|
36
|
+
raise NotImplementedError('Method not implemented!')
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+
def add_RuntimeServiceServicer_to_server(servicer, server):
|
|
40
|
+
rpc_method_handlers = {
|
|
41
|
+
'Channel': grpc.stream_stream_rpc_method_handler(
|
|
42
|
+
servicer.Channel,
|
|
43
|
+
request_deserializer=middleware_dot_runtime_dot_v1_dot_runtime__pb2.Envelope.FromString,
|
|
44
|
+
response_serializer=middleware_dot_runtime_dot_v1_dot_runtime__pb2.Envelope.SerializeToString,
|
|
45
|
+
),
|
|
46
|
+
}
|
|
47
|
+
generic_handler = grpc.method_handlers_generic_handler(
|
|
48
|
+
'middleware.runtime.v1.RuntimeService', rpc_method_handlers)
|
|
49
|
+
server.add_generic_rpc_handlers((generic_handler,))
|
|
50
|
+
server.add_registered_method_handlers('middleware.runtime.v1.RuntimeService', rpc_method_handlers)
|
|
51
|
+
|
|
52
|
+
|
|
53
|
+
# This class is part of an EXPERIMENTAL API.
|
|
54
|
+
class RuntimeService:
|
|
55
|
+
"""RuntimeService carries all daemon control and data messages over one
|
|
56
|
+
bidirectional stream.
|
|
57
|
+
"""
|
|
58
|
+
|
|
59
|
+
@staticmethod
|
|
60
|
+
def Channel(request_iterator,
|
|
61
|
+
target,
|
|
62
|
+
options=(),
|
|
63
|
+
channel_credentials=None,
|
|
64
|
+
call_credentials=None,
|
|
65
|
+
insecure=False,
|
|
66
|
+
compression=None,
|
|
67
|
+
wait_for_ready=None,
|
|
68
|
+
timeout=None,
|
|
69
|
+
metadata=None):
|
|
70
|
+
return grpc.experimental.stream_stream(
|
|
71
|
+
request_iterator,
|
|
72
|
+
target,
|
|
73
|
+
'/middleware.runtime.v1.RuntimeService/Channel',
|
|
74
|
+
middleware_dot_runtime_dot_v1_dot_runtime__pb2.Envelope.SerializeToString,
|
|
75
|
+
middleware_dot_runtime_dot_v1_dot_runtime__pb2.Envelope.FromString,
|
|
76
|
+
options,
|
|
77
|
+
channel_credentials,
|
|
78
|
+
insecure,
|
|
79
|
+
call_credentials,
|
|
80
|
+
compression,
|
|
81
|
+
wait_for_ready,
|
|
82
|
+
timeout,
|
|
83
|
+
metadata,
|
|
84
|
+
_registered_method=True)
|