langgraph-api 0.5.4__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.
Files changed (122) hide show
  1. langgraph_api/__init__.py +1 -1
  2. langgraph_api/api/__init__.py +93 -27
  3. langgraph_api/api/a2a.py +36 -32
  4. langgraph_api/api/assistants.py +114 -26
  5. langgraph_api/api/mcp.py +3 -3
  6. langgraph_api/api/meta.py +15 -2
  7. langgraph_api/api/openapi.py +27 -17
  8. langgraph_api/api/profile.py +108 -0
  9. langgraph_api/api/runs.py +114 -57
  10. langgraph_api/api/store.py +19 -2
  11. langgraph_api/api/threads.py +133 -10
  12. langgraph_api/asgi_transport.py +14 -9
  13. langgraph_api/auth/custom.py +23 -13
  14. langgraph_api/cli.py +86 -41
  15. langgraph_api/command.py +2 -2
  16. langgraph_api/config/__init__.py +532 -0
  17. langgraph_api/config/_parse.py +58 -0
  18. langgraph_api/config/schemas.py +431 -0
  19. langgraph_api/cron_scheduler.py +17 -1
  20. langgraph_api/encryption/__init__.py +15 -0
  21. langgraph_api/encryption/aes_json.py +158 -0
  22. langgraph_api/encryption/context.py +35 -0
  23. langgraph_api/encryption/custom.py +280 -0
  24. langgraph_api/encryption/middleware.py +632 -0
  25. langgraph_api/encryption/shared.py +63 -0
  26. langgraph_api/errors.py +12 -1
  27. langgraph_api/executor_entrypoint.py +11 -6
  28. langgraph_api/feature_flags.py +19 -0
  29. langgraph_api/graph.py +163 -64
  30. langgraph_api/{grpc_ops → grpc}/client.py +142 -12
  31. langgraph_api/{grpc_ops → grpc}/config_conversion.py +16 -10
  32. langgraph_api/grpc/generated/__init__.py +29 -0
  33. langgraph_api/grpc/generated/checkpointer_pb2.py +63 -0
  34. langgraph_api/grpc/generated/checkpointer_pb2.pyi +99 -0
  35. langgraph_api/grpc/generated/checkpointer_pb2_grpc.py +329 -0
  36. langgraph_api/grpc/generated/core_api_pb2.py +216 -0
  37. langgraph_api/{grpc_ops → grpc}/generated/core_api_pb2.pyi +292 -372
  38. langgraph_api/{grpc_ops → grpc}/generated/core_api_pb2_grpc.py +252 -31
  39. langgraph_api/grpc/generated/engine_common_pb2.py +219 -0
  40. langgraph_api/{grpc_ops → grpc}/generated/engine_common_pb2.pyi +178 -104
  41. langgraph_api/grpc/generated/enum_cancel_run_action_pb2.py +37 -0
  42. langgraph_api/grpc/generated/enum_cancel_run_action_pb2.pyi +12 -0
  43. langgraph_api/grpc/generated/enum_cancel_run_action_pb2_grpc.py +24 -0
  44. langgraph_api/grpc/generated/enum_control_signal_pb2.py +37 -0
  45. langgraph_api/grpc/generated/enum_control_signal_pb2.pyi +16 -0
  46. langgraph_api/grpc/generated/enum_control_signal_pb2_grpc.py +24 -0
  47. langgraph_api/grpc/generated/enum_durability_pb2.py +37 -0
  48. langgraph_api/grpc/generated/enum_durability_pb2.pyi +16 -0
  49. langgraph_api/grpc/generated/enum_durability_pb2_grpc.py +24 -0
  50. langgraph_api/grpc/generated/enum_multitask_strategy_pb2.py +37 -0
  51. langgraph_api/grpc/generated/enum_multitask_strategy_pb2.pyi +16 -0
  52. langgraph_api/grpc/generated/enum_multitask_strategy_pb2_grpc.py +24 -0
  53. langgraph_api/grpc/generated/enum_run_status_pb2.py +37 -0
  54. langgraph_api/grpc/generated/enum_run_status_pb2.pyi +22 -0
  55. langgraph_api/grpc/generated/enum_run_status_pb2_grpc.py +24 -0
  56. langgraph_api/grpc/generated/enum_stream_mode_pb2.py +37 -0
  57. langgraph_api/grpc/generated/enum_stream_mode_pb2.pyi +28 -0
  58. langgraph_api/grpc/generated/enum_stream_mode_pb2_grpc.py +24 -0
  59. langgraph_api/grpc/generated/enum_thread_status_pb2.py +37 -0
  60. langgraph_api/grpc/generated/enum_thread_status_pb2.pyi +16 -0
  61. langgraph_api/grpc/generated/enum_thread_status_pb2_grpc.py +24 -0
  62. langgraph_api/grpc/generated/enum_thread_stream_mode_pb2.py +37 -0
  63. langgraph_api/grpc/generated/enum_thread_stream_mode_pb2.pyi +16 -0
  64. langgraph_api/grpc/generated/enum_thread_stream_mode_pb2_grpc.py +24 -0
  65. langgraph_api/grpc/generated/errors_pb2.py +39 -0
  66. langgraph_api/grpc/generated/errors_pb2.pyi +21 -0
  67. langgraph_api/grpc/generated/errors_pb2_grpc.py +24 -0
  68. langgraph_api/grpc/ops/__init__.py +370 -0
  69. langgraph_api/grpc/ops/assistants.py +424 -0
  70. langgraph_api/grpc/ops/runs.py +792 -0
  71. langgraph_api/grpc/ops/threads.py +1013 -0
  72. langgraph_api/http.py +16 -5
  73. langgraph_api/js/client.mts +1 -4
  74. langgraph_api/js/package.json +28 -27
  75. langgraph_api/js/remote.py +39 -17
  76. langgraph_api/js/sse.py +2 -2
  77. langgraph_api/js/ui.py +1 -1
  78. langgraph_api/js/yarn.lock +1139 -869
  79. langgraph_api/metadata.py +29 -3
  80. langgraph_api/middleware/http_logger.py +1 -1
  81. langgraph_api/middleware/private_network.py +7 -7
  82. langgraph_api/models/run.py +44 -26
  83. langgraph_api/otel_context.py +205 -0
  84. langgraph_api/patch.py +2 -2
  85. langgraph_api/queue_entrypoint.py +34 -35
  86. langgraph_api/route.py +33 -1
  87. langgraph_api/schema.py +84 -9
  88. langgraph_api/self_hosted_logs.py +2 -2
  89. langgraph_api/self_hosted_metrics.py +73 -3
  90. langgraph_api/serde.py +16 -4
  91. langgraph_api/server.py +33 -31
  92. langgraph_api/state.py +3 -2
  93. langgraph_api/store.py +25 -16
  94. langgraph_api/stream.py +20 -16
  95. langgraph_api/thread_ttl.py +28 -13
  96. langgraph_api/timing/__init__.py +25 -0
  97. langgraph_api/timing/profiler.py +200 -0
  98. langgraph_api/timing/timer.py +318 -0
  99. langgraph_api/utils/__init__.py +53 -8
  100. langgraph_api/utils/config.py +2 -1
  101. langgraph_api/utils/future.py +10 -6
  102. langgraph_api/utils/uuids.py +29 -62
  103. langgraph_api/validation.py +6 -0
  104. langgraph_api/webhook.py +120 -6
  105. langgraph_api/worker.py +54 -24
  106. {langgraph_api-0.5.4.dist-info → langgraph_api-0.7.3.dist-info}/METADATA +8 -6
  107. langgraph_api-0.7.3.dist-info/RECORD +168 -0
  108. {langgraph_api-0.5.4.dist-info → langgraph_api-0.7.3.dist-info}/WHEEL +1 -1
  109. langgraph_runtime/__init__.py +1 -0
  110. langgraph_runtime/routes.py +11 -0
  111. logging.json +1 -3
  112. openapi.json +635 -537
  113. langgraph_api/config.py +0 -523
  114. langgraph_api/grpc_ops/generated/__init__.py +0 -5
  115. langgraph_api/grpc_ops/generated/core_api_pb2.py +0 -275
  116. langgraph_api/grpc_ops/generated/engine_common_pb2.py +0 -194
  117. langgraph_api/grpc_ops/ops.py +0 -1045
  118. langgraph_api-0.5.4.dist-info/RECORD +0 -121
  119. /langgraph_api/{grpc_ops → grpc}/__init__.py +0 -0
  120. /langgraph_api/{grpc_ops → grpc}/generated/engine_common_pb2_grpc.py +0 -0
  121. {langgraph_api-0.5.4.dist-info → langgraph_api-0.7.3.dist-info}/entry_points.txt +0 -0
  122. {langgraph_api-0.5.4.dist-info → langgraph_api-0.7.3.dist-info}/licenses/LICENSE +0 -0
@@ -8,7 +8,10 @@ from typing import Any, cast
8
8
  import orjson
9
9
  from langchain_core.runnables.config import RunnableConfig
10
10
 
11
- from langgraph_api.grpc_ops.generated import engine_common_pb2
11
+ from langgraph_api.grpc.generated import (
12
+ engine_common_pb2,
13
+ enum_durability_pb2,
14
+ )
12
15
 
13
16
  CONFIG_KEY_SEND = "__pregel_send"
14
17
  CONFIG_KEY_READ = "__pregel_read"
@@ -25,27 +28,27 @@ CONFIG_KEY_GRAPH_ID = "graph_id"
25
28
 
26
29
  def _durability_to_proto(
27
30
  durability: str,
28
- ) -> engine_common_pb2.Durability:
31
+ ) -> enum_durability_pb2.Durability:
29
32
  match durability:
30
33
  case "async":
31
- return engine_common_pb2.Durability.ASYNC
34
+ return enum_durability_pb2.Durability.ASYNC
32
35
  case "sync":
33
- return engine_common_pb2.Durability.SYNC
36
+ return enum_durability_pb2.Durability.SYNC
34
37
  case "exit":
35
- return engine_common_pb2.Durability.EXIT
38
+ return enum_durability_pb2.Durability.EXIT
36
39
  case _:
37
40
  raise ValueError(f"invalid durability: {durability}")
38
41
 
39
42
 
40
43
  def _durability_from_proto(
41
- durability: engine_common_pb2.Durability,
44
+ durability: enum_durability_pb2.Durability,
42
45
  ) -> str:
43
46
  match durability:
44
- case engine_common_pb2.Durability.ASYNC:
47
+ case enum_durability_pb2.Durability.ASYNC:
45
48
  return "async"
46
- case engine_common_pb2.Durability.SYNC:
49
+ case enum_durability_pb2.Durability.SYNC:
47
50
  return "sync"
48
- case engine_common_pb2.Durability.EXIT:
51
+ case enum_durability_pb2.Durability.EXIT:
49
52
  return "exit"
50
53
  case _:
51
54
  raise ValueError(f"invalid durability: {durability}")
@@ -115,7 +118,7 @@ def _inject_configurable_into_proto(
115
118
  elif key == CONFIG_KEY_THREAD_ID:
116
119
  proto.thread_id = str(value)
117
120
  elif key == CONFIG_KEY_CHECKPOINT_MAP:
118
- proto.checkpoint_map.update(cast(dict[str, str], value))
121
+ proto.checkpoint_map.update(cast("dict[str, str]", value))
119
122
  elif key == CONFIG_KEY_CHECKPOINT_ID:
120
123
  proto.checkpoint_id = str(value)
121
124
  elif key == CONFIG_KEY_CHECKPOINT_NS:
@@ -215,6 +218,9 @@ def _configurable_from_proto(
215
218
  if config_proto.HasField("graph_id"):
216
219
  configurable[CONFIG_KEY_GRAPH_ID] = config_proto.graph_id
217
220
 
221
+ if config_proto.HasField("run_id"):
222
+ configurable["run_id"] = config_proto.run_id
223
+
218
224
  if len(config_proto.checkpoint_map) > 0:
219
225
  configurable[CONFIG_KEY_CHECKPOINT_MAP] = dict(config_proto.checkpoint_map)
220
226
 
@@ -0,0 +1,29 @@
1
+ # Generated protobuf files
2
+ # Import enum files first to avoid circular imports
3
+ from . import enum_cancel_run_action_pb2
4
+ from . import enum_control_signal_pb2
5
+ from . import enum_durability_pb2
6
+ from . import enum_multitask_strategy_pb2
7
+ from . import enum_run_status_pb2
8
+ from . import enum_stream_mode_pb2
9
+ from . import enum_thread_status_pb2
10
+ from . import enum_thread_stream_mode_pb2
11
+ from . import core_api_pb2
12
+ from . import core_api_pb2_grpc
13
+ from . import checkpointer_pb2
14
+ from . import checkpointer_pb2_grpc
15
+
16
+ __all__ = [
17
+ "core_api_pb2",
18
+ "core_api_pb2_grpc",
19
+ "checkpointer_pb2",
20
+ "checkpointer_pb2_grpc",
21
+ "enum_cancel_run_action_pb2",
22
+ "enum_control_signal_pb2",
23
+ "enum_durability_pb2",
24
+ "enum_multitask_strategy_pb2",
25
+ "enum_run_status_pb2",
26
+ "enum_stream_mode_pb2",
27
+ "enum_thread_status_pb2",
28
+ "enum_thread_stream_mode_pb2",
29
+ ]
@@ -0,0 +1,63 @@
1
+ # -*- coding: utf-8 -*-
2
+ # Generated by the protocol buffer compiler. DO NOT EDIT!
3
+ # NO CHECKED-IN PROTOBUF GENCODE
4
+ # source: checkpointer.proto
5
+ # Protobuf Python Version: 6.31.1
6
+ """Generated protocol buffer code."""
7
+ from google.protobuf import descriptor as _descriptor
8
+ from google.protobuf import descriptor_pool as _descriptor_pool
9
+ from google.protobuf import runtime_version as _runtime_version
10
+ from google.protobuf import symbol_database as _symbol_database
11
+ from google.protobuf.internal import builder as _builder
12
+ _runtime_version.ValidateProtobufRuntimeVersion(
13
+ _runtime_version.Domain.PUBLIC,
14
+ 6,
15
+ 31,
16
+ 1,
17
+ '',
18
+ 'checkpointer.proto'
19
+ )
20
+ # @@protoc_insertion_point(imports)
21
+
22
+ _sym_db = _symbol_database.Default()
23
+
24
+
25
+ from google.protobuf import empty_pb2 as google_dot_protobuf_dot_empty__pb2
26
+ from . import engine_common_pb2 as engine__common__pb2
27
+
28
+
29
+ DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(b'\n\x12\x63heckpointer.proto\x12\x0c\x63heckpointer\x1a\x1bgoogle/protobuf/empty.proto\x1a\x13\x65ngine-common.proto\"\x97\x02\n\nPutRequest\x12\x32\n\x06\x63onfig\x18\x01 \x01(\x0b\x32\".engineCommon.EngineRunnableConfig\x12,\n\ncheckpoint\x18\x02 \x01(\x0b\x32\x18.engineCommon.Checkpoint\x12\x32\n\x08metadata\x18\x03 \x01(\x0b\x32 .engineCommon.CheckpointMetadata\x12?\n\x0cnew_versions\x18\x04 \x03(\x0b\x32).checkpointer.PutRequest.NewVersionsEntry\x1a\x32\n\x10NewVersionsEntry\x12\x0b\n\x03key\x18\x01 \x01(\t\x12\r\n\x05value\x18\x02 \x01(\t:\x02\x38\x01\"\x8f\x01\n\x10PutWritesRequest\x12\x32\n\x06\x63onfig\x18\x01 \x01(\x0b\x32\".engineCommon.EngineRunnableConfig\x12#\n\x06writes\x18\x02 \x03(\x0b\x32\x13.engineCommon.Write\x12\x0f\n\x07task_id\x18\x03 \x01(\t\x12\x11\n\ttask_path\x18\x04 \x01(\t\"\xa8\x01\n\x0bListRequest\x12\x32\n\x06\x63onfig\x18\x01 \x01(\x0b\x32\".engineCommon.EngineRunnableConfig\x12\x13\n\x0b\x66ilter_json\x18\x02 \x01(\x0c\x12\x32\n\x06\x62\x65\x66ore\x18\x03 \x01(\x0b\x32\".engineCommon.EngineRunnableConfig\x12\x12\n\x05limit\x18\x04 \x01(\x03H\x00\x88\x01\x01\x42\x08\n\x06_limit\"(\n\x13\x44\x65leteThreadRequest\x12\x11\n\tthread_id\x18\x01 \x01(\t\"\xa1\x01\n\x0cPruneRequest\x12\x12\n\nthread_ids\x18\x01 \x03(\t\x12:\n\x08strategy\x18\x02 \x01(\x0e\x32(.checkpointer.PruneRequest.PruneStrategy\"A\n\rPruneStrategy\x12\x0f\n\x0bUNSPECIFIED\x10\x00\x12\x0f\n\x0bKEEP_LATEST\x10\x01\x12\x0e\n\nDELETE_ALL\x10\x02\"E\n\x0fGetTupleRequest\x12\x32\n\x06\x63onfig\x18\x01 \x01(\x0b\x32\".engineCommon.EngineRunnableConfig\"F\n\x0bPutResponse\x12\x37\n\x0bnext_config\x18\x01 \x01(\x0b\x32\".engineCommon.EngineRunnableConfig\"H\n\x0cListResponse\x12\x38\n\x11\x63heckpoint_tuples\x18\x01 \x03(\x0b\x32\x1d.engineCommon.CheckpointTuple\"e\n\x10GetTupleResponse\x12<\n\x10\x63heckpoint_tuple\x18\x01 \x01(\x0b\x32\x1d.engineCommon.CheckpointTupleH\x00\x88\x01\x01\x42\x13\n\x11_checkpoint_tuple2\xa1\x03\n\x0c\x43heckpointer\x12:\n\x03Put\x12\x18.checkpointer.PutRequest\x1a\x19.checkpointer.PutResponse\x12\x43\n\tPutWrites\x12\x1e.checkpointer.PutWritesRequest\x1a\x16.google.protobuf.Empty\x12=\n\x04List\x12\x19.checkpointer.ListRequest\x1a\x1a.checkpointer.ListResponse\x12I\n\x08GetTuple\x12\x1d.checkpointer.GetTupleRequest\x1a\x1e.checkpointer.GetTupleResponse\x12I\n\x0c\x44\x65leteThread\x12!.checkpointer.DeleteThreadRequest\x1a\x16.google.protobuf.Empty\x12;\n\x05Prune\x12\x1a.checkpointer.PruneRequest\x1a\x16.google.protobuf.EmptyB?Z=github.com/langchain-ai/langgraph-api/core/internal/engine/pbb\x06proto3')
30
+
31
+ _globals = globals()
32
+ _builder.BuildMessageAndEnumDescriptors(DESCRIPTOR, _globals)
33
+ _builder.BuildTopDescriptorsAndMessages(DESCRIPTOR, 'checkpointer_pb2', _globals)
34
+ if not _descriptor._USE_C_DESCRIPTORS:
35
+ _globals['DESCRIPTOR']._loaded_options = None
36
+ _globals['DESCRIPTOR']._serialized_options = b'Z=github.com/langchain-ai/langgraph-api/core/internal/engine/pb'
37
+ _globals['_PUTREQUEST_NEWVERSIONSENTRY']._loaded_options = None
38
+ _globals['_PUTREQUEST_NEWVERSIONSENTRY']._serialized_options = b'8\001'
39
+ _globals['_PUTREQUEST']._serialized_start=87
40
+ _globals['_PUTREQUEST']._serialized_end=366
41
+ _globals['_PUTREQUEST_NEWVERSIONSENTRY']._serialized_start=316
42
+ _globals['_PUTREQUEST_NEWVERSIONSENTRY']._serialized_end=366
43
+ _globals['_PUTWRITESREQUEST']._serialized_start=369
44
+ _globals['_PUTWRITESREQUEST']._serialized_end=512
45
+ _globals['_LISTREQUEST']._serialized_start=515
46
+ _globals['_LISTREQUEST']._serialized_end=683
47
+ _globals['_DELETETHREADREQUEST']._serialized_start=685
48
+ _globals['_DELETETHREADREQUEST']._serialized_end=725
49
+ _globals['_PRUNEREQUEST']._serialized_start=728
50
+ _globals['_PRUNEREQUEST']._serialized_end=889
51
+ _globals['_PRUNEREQUEST_PRUNESTRATEGY']._serialized_start=824
52
+ _globals['_PRUNEREQUEST_PRUNESTRATEGY']._serialized_end=889
53
+ _globals['_GETTUPLEREQUEST']._serialized_start=891
54
+ _globals['_GETTUPLEREQUEST']._serialized_end=960
55
+ _globals['_PUTRESPONSE']._serialized_start=962
56
+ _globals['_PUTRESPONSE']._serialized_end=1032
57
+ _globals['_LISTRESPONSE']._serialized_start=1034
58
+ _globals['_LISTRESPONSE']._serialized_end=1106
59
+ _globals['_GETTUPLERESPONSE']._serialized_start=1108
60
+ _globals['_GETTUPLERESPONSE']._serialized_end=1209
61
+ _globals['_CHECKPOINTER']._serialized_start=1212
62
+ _globals['_CHECKPOINTER']._serialized_end=1629
63
+ # @@protoc_insertion_point(module_scope)
@@ -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)