langgraph-api 0.4.1__py3-none-any.whl → 0.7.3__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.
- langgraph_api/__init__.py +1 -1
- langgraph_api/api/__init__.py +111 -51
- langgraph_api/api/a2a.py +1610 -0
- langgraph_api/api/assistants.py +212 -89
- langgraph_api/api/mcp.py +3 -3
- langgraph_api/api/meta.py +52 -28
- langgraph_api/api/openapi.py +27 -17
- langgraph_api/api/profile.py +108 -0
- langgraph_api/api/runs.py +342 -195
- langgraph_api/api/store.py +19 -2
- langgraph_api/api/threads.py +209 -27
- langgraph_api/asgi_transport.py +14 -9
- langgraph_api/asyncio.py +14 -4
- langgraph_api/auth/custom.py +52 -37
- langgraph_api/auth/langsmith/backend.py +4 -3
- langgraph_api/auth/langsmith/client.py +13 -8
- langgraph_api/cli.py +230 -133
- langgraph_api/command.py +5 -3
- langgraph_api/config/__init__.py +532 -0
- langgraph_api/config/_parse.py +58 -0
- langgraph_api/config/schemas.py +431 -0
- langgraph_api/cron_scheduler.py +17 -1
- langgraph_api/encryption/__init__.py +15 -0
- langgraph_api/encryption/aes_json.py +158 -0
- langgraph_api/encryption/context.py +35 -0
- langgraph_api/encryption/custom.py +280 -0
- langgraph_api/encryption/middleware.py +632 -0
- langgraph_api/encryption/shared.py +63 -0
- langgraph_api/errors.py +12 -1
- langgraph_api/executor_entrypoint.py +11 -6
- langgraph_api/feature_flags.py +29 -0
- langgraph_api/graph.py +176 -76
- langgraph_api/grpc/client.py +313 -0
- langgraph_api/grpc/config_conversion.py +231 -0
- langgraph_api/grpc/generated/__init__.py +29 -0
- langgraph_api/grpc/generated/checkpointer_pb2.py +63 -0
- langgraph_api/grpc/generated/checkpointer_pb2.pyi +99 -0
- langgraph_api/grpc/generated/checkpointer_pb2_grpc.py +329 -0
- langgraph_api/grpc/generated/core_api_pb2.py +216 -0
- langgraph_api/grpc/generated/core_api_pb2.pyi +905 -0
- langgraph_api/grpc/generated/core_api_pb2_grpc.py +1621 -0
- langgraph_api/grpc/generated/engine_common_pb2.py +219 -0
- langgraph_api/grpc/generated/engine_common_pb2.pyi +722 -0
- langgraph_api/grpc/generated/engine_common_pb2_grpc.py +24 -0
- langgraph_api/grpc/generated/enum_cancel_run_action_pb2.py +37 -0
- langgraph_api/grpc/generated/enum_cancel_run_action_pb2.pyi +12 -0
- langgraph_api/grpc/generated/enum_cancel_run_action_pb2_grpc.py +24 -0
- langgraph_api/grpc/generated/enum_control_signal_pb2.py +37 -0
- langgraph_api/grpc/generated/enum_control_signal_pb2.pyi +16 -0
- langgraph_api/grpc/generated/enum_control_signal_pb2_grpc.py +24 -0
- langgraph_api/grpc/generated/enum_durability_pb2.py +37 -0
- langgraph_api/grpc/generated/enum_durability_pb2.pyi +16 -0
- langgraph_api/grpc/generated/enum_durability_pb2_grpc.py +24 -0
- langgraph_api/grpc/generated/enum_multitask_strategy_pb2.py +37 -0
- langgraph_api/grpc/generated/enum_multitask_strategy_pb2.pyi +16 -0
- langgraph_api/grpc/generated/enum_multitask_strategy_pb2_grpc.py +24 -0
- langgraph_api/grpc/generated/enum_run_status_pb2.py +37 -0
- langgraph_api/grpc/generated/enum_run_status_pb2.pyi +22 -0
- langgraph_api/grpc/generated/enum_run_status_pb2_grpc.py +24 -0
- langgraph_api/grpc/generated/enum_stream_mode_pb2.py +37 -0
- langgraph_api/grpc/generated/enum_stream_mode_pb2.pyi +28 -0
- langgraph_api/grpc/generated/enum_stream_mode_pb2_grpc.py +24 -0
- langgraph_api/grpc/generated/enum_thread_status_pb2.py +37 -0
- langgraph_api/grpc/generated/enum_thread_status_pb2.pyi +16 -0
- langgraph_api/grpc/generated/enum_thread_status_pb2_grpc.py +24 -0
- langgraph_api/grpc/generated/enum_thread_stream_mode_pb2.py +37 -0
- langgraph_api/grpc/generated/enum_thread_stream_mode_pb2.pyi +16 -0
- langgraph_api/grpc/generated/enum_thread_stream_mode_pb2_grpc.py +24 -0
- langgraph_api/grpc/generated/errors_pb2.py +39 -0
- langgraph_api/grpc/generated/errors_pb2.pyi +21 -0
- langgraph_api/grpc/generated/errors_pb2_grpc.py +24 -0
- langgraph_api/grpc/ops/__init__.py +370 -0
- langgraph_api/grpc/ops/assistants.py +424 -0
- langgraph_api/grpc/ops/runs.py +792 -0
- langgraph_api/grpc/ops/threads.py +1013 -0
- langgraph_api/http.py +16 -5
- langgraph_api/http_metrics.py +15 -35
- langgraph_api/http_metrics_utils.py +38 -0
- langgraph_api/js/build.mts +1 -1
- langgraph_api/js/client.http.mts +13 -7
- langgraph_api/js/client.mts +2 -5
- langgraph_api/js/package.json +29 -28
- langgraph_api/js/remote.py +56 -30
- langgraph_api/js/src/graph.mts +20 -0
- langgraph_api/js/sse.py +2 -2
- langgraph_api/js/ui.py +1 -1
- langgraph_api/js/yarn.lock +1204 -1006
- langgraph_api/logging.py +29 -2
- langgraph_api/metadata.py +99 -28
- langgraph_api/middleware/http_logger.py +7 -2
- langgraph_api/middleware/private_network.py +7 -7
- langgraph_api/models/run.py +54 -93
- langgraph_api/otel_context.py +205 -0
- langgraph_api/patch.py +5 -3
- langgraph_api/queue_entrypoint.py +154 -65
- langgraph_api/route.py +47 -5
- langgraph_api/schema.py +88 -10
- langgraph_api/self_hosted_logs.py +124 -0
- langgraph_api/self_hosted_metrics.py +450 -0
- langgraph_api/serde.py +79 -37
- langgraph_api/server.py +138 -60
- langgraph_api/state.py +4 -3
- langgraph_api/store.py +25 -16
- langgraph_api/stream.py +80 -29
- langgraph_api/thread_ttl.py +31 -13
- langgraph_api/timing/__init__.py +25 -0
- langgraph_api/timing/profiler.py +200 -0
- langgraph_api/timing/timer.py +318 -0
- langgraph_api/utils/__init__.py +53 -8
- langgraph_api/utils/cache.py +47 -10
- langgraph_api/utils/config.py +2 -1
- langgraph_api/utils/errors.py +77 -0
- langgraph_api/utils/future.py +10 -6
- langgraph_api/utils/headers.py +76 -2
- langgraph_api/utils/retriable_client.py +74 -0
- langgraph_api/utils/stream_codec.py +315 -0
- langgraph_api/utils/uuids.py +29 -62
- langgraph_api/validation.py +9 -0
- langgraph_api/webhook.py +120 -6
- langgraph_api/worker.py +55 -24
- {langgraph_api-0.4.1.dist-info → langgraph_api-0.7.3.dist-info}/METADATA +16 -8
- langgraph_api-0.7.3.dist-info/RECORD +168 -0
- {langgraph_api-0.4.1.dist-info → langgraph_api-0.7.3.dist-info}/WHEEL +1 -1
- langgraph_runtime/__init__.py +1 -0
- langgraph_runtime/routes.py +11 -0
- logging.json +1 -3
- openapi.json +839 -478
- langgraph_api/config.py +0 -387
- langgraph_api/js/isolate-0x130008000-46649-46649-v8.log +0 -4430
- langgraph_api/js/isolate-0x138008000-44681-44681-v8.log +0 -4430
- langgraph_api/js/package-lock.json +0 -3308
- langgraph_api-0.4.1.dist-info/RECORD +0 -107
- /langgraph_api/{utils.py → grpc/__init__.py} +0 -0
- {langgraph_api-0.4.1.dist-info → langgraph_api-0.7.3.dist-info}/entry_points.txt +0 -0
- {langgraph_api-0.4.1.dist-info → langgraph_api-0.7.3.dist-info}/licenses/LICENSE +0 -0
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
from google.protobuf import empty_pb2 as _empty_pb2
|
|
2
|
+
from . import engine_common_pb2 as _engine_common_pb2
|
|
3
|
+
from google.protobuf.internal import containers as _containers
|
|
4
|
+
from google.protobuf.internal import enum_type_wrapper as _enum_type_wrapper
|
|
5
|
+
from google.protobuf import descriptor as _descriptor
|
|
6
|
+
from google.protobuf import message as _message
|
|
7
|
+
from collections.abc import Iterable as _Iterable, Mapping as _Mapping
|
|
8
|
+
from typing import ClassVar as _ClassVar, Optional as _Optional, Union as _Union
|
|
9
|
+
|
|
10
|
+
DESCRIPTOR: _descriptor.FileDescriptor
|
|
11
|
+
|
|
12
|
+
class PutRequest(_message.Message):
|
|
13
|
+
__slots__ = ("config", "checkpoint", "metadata", "new_versions")
|
|
14
|
+
class NewVersionsEntry(_message.Message):
|
|
15
|
+
__slots__ = ("key", "value")
|
|
16
|
+
KEY_FIELD_NUMBER: _ClassVar[int]
|
|
17
|
+
VALUE_FIELD_NUMBER: _ClassVar[int]
|
|
18
|
+
key: str
|
|
19
|
+
value: str
|
|
20
|
+
def __init__(self, key: _Optional[str] = ..., value: _Optional[str] = ...) -> None: ...
|
|
21
|
+
CONFIG_FIELD_NUMBER: _ClassVar[int]
|
|
22
|
+
CHECKPOINT_FIELD_NUMBER: _ClassVar[int]
|
|
23
|
+
METADATA_FIELD_NUMBER: _ClassVar[int]
|
|
24
|
+
NEW_VERSIONS_FIELD_NUMBER: _ClassVar[int]
|
|
25
|
+
config: _engine_common_pb2.EngineRunnableConfig
|
|
26
|
+
checkpoint: _engine_common_pb2.Checkpoint
|
|
27
|
+
metadata: _engine_common_pb2.CheckpointMetadata
|
|
28
|
+
new_versions: _containers.ScalarMap[str, str]
|
|
29
|
+
def __init__(self, config: _Optional[_Union[_engine_common_pb2.EngineRunnableConfig, _Mapping]] = ..., checkpoint: _Optional[_Union[_engine_common_pb2.Checkpoint, _Mapping]] = ..., metadata: _Optional[_Union[_engine_common_pb2.CheckpointMetadata, _Mapping]] = ..., new_versions: _Optional[_Mapping[str, str]] = ...) -> None: ...
|
|
30
|
+
|
|
31
|
+
class PutWritesRequest(_message.Message):
|
|
32
|
+
__slots__ = ("config", "writes", "task_id", "task_path")
|
|
33
|
+
CONFIG_FIELD_NUMBER: _ClassVar[int]
|
|
34
|
+
WRITES_FIELD_NUMBER: _ClassVar[int]
|
|
35
|
+
TASK_ID_FIELD_NUMBER: _ClassVar[int]
|
|
36
|
+
TASK_PATH_FIELD_NUMBER: _ClassVar[int]
|
|
37
|
+
config: _engine_common_pb2.EngineRunnableConfig
|
|
38
|
+
writes: _containers.RepeatedCompositeFieldContainer[_engine_common_pb2.Write]
|
|
39
|
+
task_id: str
|
|
40
|
+
task_path: str
|
|
41
|
+
def __init__(self, config: _Optional[_Union[_engine_common_pb2.EngineRunnableConfig, _Mapping]] = ..., writes: _Optional[_Iterable[_Union[_engine_common_pb2.Write, _Mapping]]] = ..., task_id: _Optional[str] = ..., task_path: _Optional[str] = ...) -> None: ...
|
|
42
|
+
|
|
43
|
+
class ListRequest(_message.Message):
|
|
44
|
+
__slots__ = ("config", "filter_json", "before", "limit")
|
|
45
|
+
CONFIG_FIELD_NUMBER: _ClassVar[int]
|
|
46
|
+
FILTER_JSON_FIELD_NUMBER: _ClassVar[int]
|
|
47
|
+
BEFORE_FIELD_NUMBER: _ClassVar[int]
|
|
48
|
+
LIMIT_FIELD_NUMBER: _ClassVar[int]
|
|
49
|
+
config: _engine_common_pb2.EngineRunnableConfig
|
|
50
|
+
filter_json: bytes
|
|
51
|
+
before: _engine_common_pb2.EngineRunnableConfig
|
|
52
|
+
limit: int
|
|
53
|
+
def __init__(self, config: _Optional[_Union[_engine_common_pb2.EngineRunnableConfig, _Mapping]] = ..., filter_json: _Optional[bytes] = ..., before: _Optional[_Union[_engine_common_pb2.EngineRunnableConfig, _Mapping]] = ..., limit: _Optional[int] = ...) -> None: ...
|
|
54
|
+
|
|
55
|
+
class DeleteThreadRequest(_message.Message):
|
|
56
|
+
__slots__ = ("thread_id",)
|
|
57
|
+
THREAD_ID_FIELD_NUMBER: _ClassVar[int]
|
|
58
|
+
thread_id: str
|
|
59
|
+
def __init__(self, thread_id: _Optional[str] = ...) -> None: ...
|
|
60
|
+
|
|
61
|
+
class PruneRequest(_message.Message):
|
|
62
|
+
__slots__ = ("thread_ids", "strategy")
|
|
63
|
+
class PruneStrategy(int, metaclass=_enum_type_wrapper.EnumTypeWrapper):
|
|
64
|
+
__slots__ = ()
|
|
65
|
+
UNSPECIFIED: _ClassVar[PruneRequest.PruneStrategy]
|
|
66
|
+
KEEP_LATEST: _ClassVar[PruneRequest.PruneStrategy]
|
|
67
|
+
DELETE_ALL: _ClassVar[PruneRequest.PruneStrategy]
|
|
68
|
+
UNSPECIFIED: PruneRequest.PruneStrategy
|
|
69
|
+
KEEP_LATEST: PruneRequest.PruneStrategy
|
|
70
|
+
DELETE_ALL: PruneRequest.PruneStrategy
|
|
71
|
+
THREAD_IDS_FIELD_NUMBER: _ClassVar[int]
|
|
72
|
+
STRATEGY_FIELD_NUMBER: _ClassVar[int]
|
|
73
|
+
thread_ids: _containers.RepeatedScalarFieldContainer[str]
|
|
74
|
+
strategy: PruneRequest.PruneStrategy
|
|
75
|
+
def __init__(self, thread_ids: _Optional[_Iterable[str]] = ..., strategy: _Optional[_Union[PruneRequest.PruneStrategy, str]] = ...) -> None: ...
|
|
76
|
+
|
|
77
|
+
class GetTupleRequest(_message.Message):
|
|
78
|
+
__slots__ = ("config",)
|
|
79
|
+
CONFIG_FIELD_NUMBER: _ClassVar[int]
|
|
80
|
+
config: _engine_common_pb2.EngineRunnableConfig
|
|
81
|
+
def __init__(self, config: _Optional[_Union[_engine_common_pb2.EngineRunnableConfig, _Mapping]] = ...) -> None: ...
|
|
82
|
+
|
|
83
|
+
class PutResponse(_message.Message):
|
|
84
|
+
__slots__ = ("next_config",)
|
|
85
|
+
NEXT_CONFIG_FIELD_NUMBER: _ClassVar[int]
|
|
86
|
+
next_config: _engine_common_pb2.EngineRunnableConfig
|
|
87
|
+
def __init__(self, next_config: _Optional[_Union[_engine_common_pb2.EngineRunnableConfig, _Mapping]] = ...) -> None: ...
|
|
88
|
+
|
|
89
|
+
class ListResponse(_message.Message):
|
|
90
|
+
__slots__ = ("checkpoint_tuples",)
|
|
91
|
+
CHECKPOINT_TUPLES_FIELD_NUMBER: _ClassVar[int]
|
|
92
|
+
checkpoint_tuples: _containers.RepeatedCompositeFieldContainer[_engine_common_pb2.CheckpointTuple]
|
|
93
|
+
def __init__(self, checkpoint_tuples: _Optional[_Iterable[_Union[_engine_common_pb2.CheckpointTuple, _Mapping]]] = ...) -> None: ...
|
|
94
|
+
|
|
95
|
+
class GetTupleResponse(_message.Message):
|
|
96
|
+
__slots__ = ("checkpoint_tuple",)
|
|
97
|
+
CHECKPOINT_TUPLE_FIELD_NUMBER: _ClassVar[int]
|
|
98
|
+
checkpoint_tuple: _engine_common_pb2.CheckpointTuple
|
|
99
|
+
def __init__(self, checkpoint_tuple: _Optional[_Union[_engine_common_pb2.CheckpointTuple, _Mapping]] = ...) -> None: ...
|
|
@@ -0,0 +1,329 @@
|
|
|
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
|
+
import warnings
|
|
5
|
+
|
|
6
|
+
from . import checkpointer_pb2 as checkpointer__pb2
|
|
7
|
+
from google.protobuf import empty_pb2 as google_dot_protobuf_dot_empty__pb2
|
|
8
|
+
|
|
9
|
+
GRPC_GENERATED_VERSION = '1.75.1'
|
|
10
|
+
GRPC_VERSION = grpc.__version__
|
|
11
|
+
_version_not_supported = False
|
|
12
|
+
|
|
13
|
+
try:
|
|
14
|
+
from grpc._utilities import first_version_is_lower
|
|
15
|
+
_version_not_supported = first_version_is_lower(GRPC_VERSION, GRPC_GENERATED_VERSION)
|
|
16
|
+
except ImportError:
|
|
17
|
+
_version_not_supported = True
|
|
18
|
+
|
|
19
|
+
if _version_not_supported:
|
|
20
|
+
raise RuntimeError(
|
|
21
|
+
f'The grpc package installed is at version {GRPC_VERSION},'
|
|
22
|
+
+ f' but the generated code in checkpointer_pb2_grpc.py depends on'
|
|
23
|
+
+ f' grpcio>={GRPC_GENERATED_VERSION}.'
|
|
24
|
+
+ f' Please upgrade your grpc module to grpcio>={GRPC_GENERATED_VERSION}'
|
|
25
|
+
+ f' or downgrade your generated code using grpcio-tools<={GRPC_VERSION}.'
|
|
26
|
+
)
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
class CheckpointerStub(object):
|
|
30
|
+
"""Checkpoint persistence.
|
|
31
|
+
API mostly based on the Python specification:
|
|
32
|
+
https://github.com/langchain-ai/langgraph/tree/df8becd5cfc74bb09ab2d7cbdf17c5559114b8d8/libs/checkpoint#interface
|
|
33
|
+
"""
|
|
34
|
+
|
|
35
|
+
def __init__(self, channel):
|
|
36
|
+
"""Constructor.
|
|
37
|
+
|
|
38
|
+
Args:
|
|
39
|
+
channel: A grpc.Channel.
|
|
40
|
+
"""
|
|
41
|
+
self.Put = channel.unary_unary(
|
|
42
|
+
'/checkpointer.Checkpointer/Put',
|
|
43
|
+
request_serializer=checkpointer__pb2.PutRequest.SerializeToString,
|
|
44
|
+
response_deserializer=checkpointer__pb2.PutResponse.FromString,
|
|
45
|
+
_registered_method=True)
|
|
46
|
+
self.PutWrites = channel.unary_unary(
|
|
47
|
+
'/checkpointer.Checkpointer/PutWrites',
|
|
48
|
+
request_serializer=checkpointer__pb2.PutWritesRequest.SerializeToString,
|
|
49
|
+
response_deserializer=google_dot_protobuf_dot_empty__pb2.Empty.FromString,
|
|
50
|
+
_registered_method=True)
|
|
51
|
+
self.List = channel.unary_unary(
|
|
52
|
+
'/checkpointer.Checkpointer/List',
|
|
53
|
+
request_serializer=checkpointer__pb2.ListRequest.SerializeToString,
|
|
54
|
+
response_deserializer=checkpointer__pb2.ListResponse.FromString,
|
|
55
|
+
_registered_method=True)
|
|
56
|
+
self.GetTuple = channel.unary_unary(
|
|
57
|
+
'/checkpointer.Checkpointer/GetTuple',
|
|
58
|
+
request_serializer=checkpointer__pb2.GetTupleRequest.SerializeToString,
|
|
59
|
+
response_deserializer=checkpointer__pb2.GetTupleResponse.FromString,
|
|
60
|
+
_registered_method=True)
|
|
61
|
+
self.DeleteThread = channel.unary_unary(
|
|
62
|
+
'/checkpointer.Checkpointer/DeleteThread',
|
|
63
|
+
request_serializer=checkpointer__pb2.DeleteThreadRequest.SerializeToString,
|
|
64
|
+
response_deserializer=google_dot_protobuf_dot_empty__pb2.Empty.FromString,
|
|
65
|
+
_registered_method=True)
|
|
66
|
+
self.Prune = channel.unary_unary(
|
|
67
|
+
'/checkpointer.Checkpointer/Prune',
|
|
68
|
+
request_serializer=checkpointer__pb2.PruneRequest.SerializeToString,
|
|
69
|
+
response_deserializer=google_dot_protobuf_dot_empty__pb2.Empty.FromString,
|
|
70
|
+
_registered_method=True)
|
|
71
|
+
|
|
72
|
+
|
|
73
|
+
class CheckpointerServicer(object):
|
|
74
|
+
"""Checkpoint persistence.
|
|
75
|
+
API mostly based on the Python specification:
|
|
76
|
+
https://github.com/langchain-ai/langgraph/tree/df8becd5cfc74bb09ab2d7cbdf17c5559114b8d8/libs/checkpoint#interface
|
|
77
|
+
"""
|
|
78
|
+
|
|
79
|
+
def Put(self, request, context):
|
|
80
|
+
"""Put stores a checkpoint with its configuration and metadata.
|
|
81
|
+
Returns the next config pointing at the saved checkpoint ID.
|
|
82
|
+
"""
|
|
83
|
+
context.set_code(grpc.StatusCode.UNIMPLEMENTED)
|
|
84
|
+
context.set_details('Method not implemented!')
|
|
85
|
+
raise NotImplementedError('Method not implemented!')
|
|
86
|
+
|
|
87
|
+
def PutWrites(self, request, context):
|
|
88
|
+
"""PutWrites stores intermediate writes linked to a checkpoint (pending writes).
|
|
89
|
+
"""
|
|
90
|
+
context.set_code(grpc.StatusCode.UNIMPLEMENTED)
|
|
91
|
+
context.set_details('Method not implemented!')
|
|
92
|
+
raise NotImplementedError('Method not implemented!')
|
|
93
|
+
|
|
94
|
+
def List(self, request, context):
|
|
95
|
+
"""List returns checkpoints that match a given configuration and filter criteria.
|
|
96
|
+
"""
|
|
97
|
+
context.set_code(grpc.StatusCode.UNIMPLEMENTED)
|
|
98
|
+
context.set_details('Method not implemented!')
|
|
99
|
+
raise NotImplementedError('Method not implemented!')
|
|
100
|
+
|
|
101
|
+
def GetTuple(self, request, context):
|
|
102
|
+
"""GetTuple fetches a checkpoint tuple for a given configuration (thread_id and checkpoint_id).
|
|
103
|
+
"""
|
|
104
|
+
context.set_code(grpc.StatusCode.UNIMPLEMENTED)
|
|
105
|
+
context.set_details('Method not implemented!')
|
|
106
|
+
raise NotImplementedError('Method not implemented!')
|
|
107
|
+
|
|
108
|
+
def DeleteThread(self, request, context):
|
|
109
|
+
"""DeleteThread deletes all checkpoints and writes for a thread.
|
|
110
|
+
"""
|
|
111
|
+
context.set_code(grpc.StatusCode.UNIMPLEMENTED)
|
|
112
|
+
context.set_details('Method not implemented!')
|
|
113
|
+
raise NotImplementedError('Method not implemented!')
|
|
114
|
+
|
|
115
|
+
def Prune(self, request, context):
|
|
116
|
+
"""Prune deletes checkpoints and related data for a set of threads.
|
|
117
|
+
"""
|
|
118
|
+
context.set_code(grpc.StatusCode.UNIMPLEMENTED)
|
|
119
|
+
context.set_details('Method not implemented!')
|
|
120
|
+
raise NotImplementedError('Method not implemented!')
|
|
121
|
+
|
|
122
|
+
|
|
123
|
+
def add_CheckpointerServicer_to_server(servicer, server):
|
|
124
|
+
rpc_method_handlers = {
|
|
125
|
+
'Put': grpc.unary_unary_rpc_method_handler(
|
|
126
|
+
servicer.Put,
|
|
127
|
+
request_deserializer=checkpointer__pb2.PutRequest.FromString,
|
|
128
|
+
response_serializer=checkpointer__pb2.PutResponse.SerializeToString,
|
|
129
|
+
),
|
|
130
|
+
'PutWrites': grpc.unary_unary_rpc_method_handler(
|
|
131
|
+
servicer.PutWrites,
|
|
132
|
+
request_deserializer=checkpointer__pb2.PutWritesRequest.FromString,
|
|
133
|
+
response_serializer=google_dot_protobuf_dot_empty__pb2.Empty.SerializeToString,
|
|
134
|
+
),
|
|
135
|
+
'List': grpc.unary_unary_rpc_method_handler(
|
|
136
|
+
servicer.List,
|
|
137
|
+
request_deserializer=checkpointer__pb2.ListRequest.FromString,
|
|
138
|
+
response_serializer=checkpointer__pb2.ListResponse.SerializeToString,
|
|
139
|
+
),
|
|
140
|
+
'GetTuple': grpc.unary_unary_rpc_method_handler(
|
|
141
|
+
servicer.GetTuple,
|
|
142
|
+
request_deserializer=checkpointer__pb2.GetTupleRequest.FromString,
|
|
143
|
+
response_serializer=checkpointer__pb2.GetTupleResponse.SerializeToString,
|
|
144
|
+
),
|
|
145
|
+
'DeleteThread': grpc.unary_unary_rpc_method_handler(
|
|
146
|
+
servicer.DeleteThread,
|
|
147
|
+
request_deserializer=checkpointer__pb2.DeleteThreadRequest.FromString,
|
|
148
|
+
response_serializer=google_dot_protobuf_dot_empty__pb2.Empty.SerializeToString,
|
|
149
|
+
),
|
|
150
|
+
'Prune': grpc.unary_unary_rpc_method_handler(
|
|
151
|
+
servicer.Prune,
|
|
152
|
+
request_deserializer=checkpointer__pb2.PruneRequest.FromString,
|
|
153
|
+
response_serializer=google_dot_protobuf_dot_empty__pb2.Empty.SerializeToString,
|
|
154
|
+
),
|
|
155
|
+
}
|
|
156
|
+
generic_handler = grpc.method_handlers_generic_handler(
|
|
157
|
+
'checkpointer.Checkpointer', rpc_method_handlers)
|
|
158
|
+
server.add_generic_rpc_handlers((generic_handler,))
|
|
159
|
+
server.add_registered_method_handlers('checkpointer.Checkpointer', rpc_method_handlers)
|
|
160
|
+
|
|
161
|
+
|
|
162
|
+
# This class is part of an EXPERIMENTAL API.
|
|
163
|
+
class Checkpointer(object):
|
|
164
|
+
"""Checkpoint persistence.
|
|
165
|
+
API mostly based on the Python specification:
|
|
166
|
+
https://github.com/langchain-ai/langgraph/tree/df8becd5cfc74bb09ab2d7cbdf17c5559114b8d8/libs/checkpoint#interface
|
|
167
|
+
"""
|
|
168
|
+
|
|
169
|
+
@staticmethod
|
|
170
|
+
def Put(request,
|
|
171
|
+
target,
|
|
172
|
+
options=(),
|
|
173
|
+
channel_credentials=None,
|
|
174
|
+
call_credentials=None,
|
|
175
|
+
insecure=False,
|
|
176
|
+
compression=None,
|
|
177
|
+
wait_for_ready=None,
|
|
178
|
+
timeout=None,
|
|
179
|
+
metadata=None):
|
|
180
|
+
return grpc.experimental.unary_unary(
|
|
181
|
+
request,
|
|
182
|
+
target,
|
|
183
|
+
'/checkpointer.Checkpointer/Put',
|
|
184
|
+
checkpointer__pb2.PutRequest.SerializeToString,
|
|
185
|
+
checkpointer__pb2.PutResponse.FromString,
|
|
186
|
+
options,
|
|
187
|
+
channel_credentials,
|
|
188
|
+
insecure,
|
|
189
|
+
call_credentials,
|
|
190
|
+
compression,
|
|
191
|
+
wait_for_ready,
|
|
192
|
+
timeout,
|
|
193
|
+
metadata,
|
|
194
|
+
_registered_method=True)
|
|
195
|
+
|
|
196
|
+
@staticmethod
|
|
197
|
+
def PutWrites(request,
|
|
198
|
+
target,
|
|
199
|
+
options=(),
|
|
200
|
+
channel_credentials=None,
|
|
201
|
+
call_credentials=None,
|
|
202
|
+
insecure=False,
|
|
203
|
+
compression=None,
|
|
204
|
+
wait_for_ready=None,
|
|
205
|
+
timeout=None,
|
|
206
|
+
metadata=None):
|
|
207
|
+
return grpc.experimental.unary_unary(
|
|
208
|
+
request,
|
|
209
|
+
target,
|
|
210
|
+
'/checkpointer.Checkpointer/PutWrites',
|
|
211
|
+
checkpointer__pb2.PutWritesRequest.SerializeToString,
|
|
212
|
+
google_dot_protobuf_dot_empty__pb2.Empty.FromString,
|
|
213
|
+
options,
|
|
214
|
+
channel_credentials,
|
|
215
|
+
insecure,
|
|
216
|
+
call_credentials,
|
|
217
|
+
compression,
|
|
218
|
+
wait_for_ready,
|
|
219
|
+
timeout,
|
|
220
|
+
metadata,
|
|
221
|
+
_registered_method=True)
|
|
222
|
+
|
|
223
|
+
@staticmethod
|
|
224
|
+
def List(request,
|
|
225
|
+
target,
|
|
226
|
+
options=(),
|
|
227
|
+
channel_credentials=None,
|
|
228
|
+
call_credentials=None,
|
|
229
|
+
insecure=False,
|
|
230
|
+
compression=None,
|
|
231
|
+
wait_for_ready=None,
|
|
232
|
+
timeout=None,
|
|
233
|
+
metadata=None):
|
|
234
|
+
return grpc.experimental.unary_unary(
|
|
235
|
+
request,
|
|
236
|
+
target,
|
|
237
|
+
'/checkpointer.Checkpointer/List',
|
|
238
|
+
checkpointer__pb2.ListRequest.SerializeToString,
|
|
239
|
+
checkpointer__pb2.ListResponse.FromString,
|
|
240
|
+
options,
|
|
241
|
+
channel_credentials,
|
|
242
|
+
insecure,
|
|
243
|
+
call_credentials,
|
|
244
|
+
compression,
|
|
245
|
+
wait_for_ready,
|
|
246
|
+
timeout,
|
|
247
|
+
metadata,
|
|
248
|
+
_registered_method=True)
|
|
249
|
+
|
|
250
|
+
@staticmethod
|
|
251
|
+
def GetTuple(request,
|
|
252
|
+
target,
|
|
253
|
+
options=(),
|
|
254
|
+
channel_credentials=None,
|
|
255
|
+
call_credentials=None,
|
|
256
|
+
insecure=False,
|
|
257
|
+
compression=None,
|
|
258
|
+
wait_for_ready=None,
|
|
259
|
+
timeout=None,
|
|
260
|
+
metadata=None):
|
|
261
|
+
return grpc.experimental.unary_unary(
|
|
262
|
+
request,
|
|
263
|
+
target,
|
|
264
|
+
'/checkpointer.Checkpointer/GetTuple',
|
|
265
|
+
checkpointer__pb2.GetTupleRequest.SerializeToString,
|
|
266
|
+
checkpointer__pb2.GetTupleResponse.FromString,
|
|
267
|
+
options,
|
|
268
|
+
channel_credentials,
|
|
269
|
+
insecure,
|
|
270
|
+
call_credentials,
|
|
271
|
+
compression,
|
|
272
|
+
wait_for_ready,
|
|
273
|
+
timeout,
|
|
274
|
+
metadata,
|
|
275
|
+
_registered_method=True)
|
|
276
|
+
|
|
277
|
+
@staticmethod
|
|
278
|
+
def DeleteThread(request,
|
|
279
|
+
target,
|
|
280
|
+
options=(),
|
|
281
|
+
channel_credentials=None,
|
|
282
|
+
call_credentials=None,
|
|
283
|
+
insecure=False,
|
|
284
|
+
compression=None,
|
|
285
|
+
wait_for_ready=None,
|
|
286
|
+
timeout=None,
|
|
287
|
+
metadata=None):
|
|
288
|
+
return grpc.experimental.unary_unary(
|
|
289
|
+
request,
|
|
290
|
+
target,
|
|
291
|
+
'/checkpointer.Checkpointer/DeleteThread',
|
|
292
|
+
checkpointer__pb2.DeleteThreadRequest.SerializeToString,
|
|
293
|
+
google_dot_protobuf_dot_empty__pb2.Empty.FromString,
|
|
294
|
+
options,
|
|
295
|
+
channel_credentials,
|
|
296
|
+
insecure,
|
|
297
|
+
call_credentials,
|
|
298
|
+
compression,
|
|
299
|
+
wait_for_ready,
|
|
300
|
+
timeout,
|
|
301
|
+
metadata,
|
|
302
|
+
_registered_method=True)
|
|
303
|
+
|
|
304
|
+
@staticmethod
|
|
305
|
+
def Prune(request,
|
|
306
|
+
target,
|
|
307
|
+
options=(),
|
|
308
|
+
channel_credentials=None,
|
|
309
|
+
call_credentials=None,
|
|
310
|
+
insecure=False,
|
|
311
|
+
compression=None,
|
|
312
|
+
wait_for_ready=None,
|
|
313
|
+
timeout=None,
|
|
314
|
+
metadata=None):
|
|
315
|
+
return grpc.experimental.unary_unary(
|
|
316
|
+
request,
|
|
317
|
+
target,
|
|
318
|
+
'/checkpointer.Checkpointer/Prune',
|
|
319
|
+
checkpointer__pb2.PruneRequest.SerializeToString,
|
|
320
|
+
google_dot_protobuf_dot_empty__pb2.Empty.FromString,
|
|
321
|
+
options,
|
|
322
|
+
channel_credentials,
|
|
323
|
+
insecure,
|
|
324
|
+
call_credentials,
|
|
325
|
+
compression,
|
|
326
|
+
wait_for_ready,
|
|
327
|
+
timeout,
|
|
328
|
+
metadata,
|
|
329
|
+
_registered_method=True)
|