langgraph-api 0.20.0.dev2__py3-none-any.whl → 0.20.0.dev4__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 (58) hide show
  1. langgraph_api/__init__.py +1 -1
  2. langgraph_api/_checkpointer/_adapter.py +5 -4
  3. langgraph_api/api/__init__.py +4 -7
  4. langgraph_api/api/assistants.py +2 -9
  5. langgraph_api/api/event_streaming.py +1 -5
  6. langgraph_api/api/mcp/_call_thread.py +1 -1
  7. langgraph_api/api/meta.py +5 -10
  8. langgraph_api/api/runs.py +8 -20
  9. langgraph_api/api/store.py +1 -1
  10. langgraph_api/api/threads.py +9 -24
  11. langgraph_api/cache.py +2 -15
  12. langgraph_api/cli.py +2 -11
  13. langgraph_api/cron_scheduler.py +2 -23
  14. langgraph_api/encryption/middleware.py +1 -66
  15. langgraph_api/errors.py +1 -2
  16. langgraph_api/event_streaming/state_normalizers.py +4 -0
  17. langgraph_api/feature_flags.py +8 -9
  18. langgraph_api/graph.py +3 -133
  19. langgraph_api/grpc/ops/runs.py +14 -2
  20. langgraph_api/grpc/ops/threads.py +2 -3
  21. langgraph_api/js/package.json +10 -10
  22. langgraph_api/js/remote.py +3 -3
  23. langgraph_api/js/yarn.lock +214 -168
  24. langgraph_api/metrics_collector.py +15 -25
  25. langgraph_api/metrics_otlp.py +2 -2
  26. langgraph_api/models/run.py +1 -6
  27. langgraph_api/operator_routes.py +1 -6
  28. langgraph_api/queue_entrypoint.py +2 -2
  29. langgraph_api/runtime/encryption.py +11 -149
  30. langgraph_api/runtime/lifespan.py +2 -2
  31. langgraph_api/runtime/store.py +134 -2
  32. langgraph_api/self_hosted_metrics.py +2 -8
  33. langgraph_api/server.py +1 -1
  34. langgraph_api/store.py +47 -22
  35. langgraph_api/stream.py +14 -22
  36. langgraph_api/transcript/__init__.py +0 -0
  37. langgraph_api/transcript/input_ids.py +100 -0
  38. langgraph_api/worker.py +1 -6
  39. langgraph_api/worker_runtime.py +5 -16
  40. {langgraph_api-0.20.0.dev2.dist-info → langgraph_api-0.20.0.dev4.dist-info}/METADATA +3 -3
  41. {langgraph_api-0.20.0.dev2.dist-info → langgraph_api-0.20.0.dev4.dist-info}/RECORD +53 -56
  42. langgraph_grpc_common/proto/core_api_pb2.py +178 -174
  43. langgraph_grpc_common/proto/core_api_pb2.pyi +101 -6
  44. langgraph_runtime/__init__.py +27 -55
  45. langgraph_runtime/checkpoint.py +5 -1
  46. langgraph_runtime/database.py +5 -1
  47. langgraph_runtime/encryption.py +6 -13
  48. langgraph_runtime/routes.py +6 -9
  49. langgraph_runtime/store.py +5 -1
  50. openapi.json +59 -0
  51. langgraph_runtime/lifespan.py +0 -4
  52. langgraph_runtime/metrics.py +0 -4
  53. langgraph_runtime/ops.py +0 -4
  54. langgraph_runtime/queue.py +0 -4
  55. langgraph_runtime/retry.py +0 -4
  56. {langgraph_api-0.20.0.dev2.dist-info → langgraph_api-0.20.0.dev4.dist-info}/WHEEL +0 -0
  57. {langgraph_api-0.20.0.dev2.dist-info → langgraph_api-0.20.0.dev4.dist-info}/entry_points.txt +0 -0
  58. {langgraph_api-0.20.0.dev2.dist-info → langgraph_api-0.20.0.dev4.dist-info}/licenses/LICENSE +0 -0
@@ -1406,6 +1406,7 @@ class Thread(_message.Message):
1406
1406
  TTL_FIELD_NUMBER: _builtins.int
1407
1407
  PRIORITY_FIELD_NUMBER: _builtins.int
1408
1408
  FAIRNESS_GROUP_FIELD_NUMBER: _builtins.int
1409
+ STREAM_BOUNDS_FIELD_NUMBER: _builtins.int
1409
1410
  status: _enum_thread_status_pb2.ThreadStatus.ValueType
1410
1411
  extracted_json: _builtins.bytes
1411
1412
  """Extracted values from JSONB columns, populated when extract is specified in search.
@@ -1438,6 +1439,12 @@ class Thread(_message.Message):
1438
1439
  def ttl(self) -> Global___ThreadTTLInfo:
1439
1440
  """TTL information, only present when include_ttl is requested."""
1440
1441
 
1442
+ @_builtins.property
1443
+ def stream_bounds(self) -> Global___ThreadStreamBounds:
1444
+ """Where the thread's event stream stands, only present when include_stream_bounds is
1445
+ requested.
1446
+ """
1447
+
1441
1448
  def __init__(
1442
1449
  self,
1443
1450
  *,
@@ -1455,10 +1462,11 @@ class Thread(_message.Message):
1455
1462
  ttl: Global___ThreadTTLInfo | None = ...,
1456
1463
  priority: _builtins.int | None = ...,
1457
1464
  fairness_group: _builtins.str | None = ...,
1465
+ stream_bounds: Global___ThreadStreamBounds | None = ...,
1458
1466
  ) -> None: ...
1459
- _HasFieldArgType: _TypeAlias = _typing.Literal["_extracted_json", b"_extracted_json", "_fairness_group", b"_fairness_group", "_priority", b"_priority", "_ttl", b"_ttl", "config", b"config", "created_at", b"created_at", "error", b"error", "extracted_json", b"extracted_json", "fairness_group", b"fairness_group", "metadata", b"metadata", "priority", b"priority", "state_updated_at", b"state_updated_at", "thread_id", b"thread_id", "ttl", b"ttl", "updated_at", b"updated_at", "values", b"values"] # noqa: Y015
1467
+ _HasFieldArgType: _TypeAlias = _typing.Literal["_extracted_json", b"_extracted_json", "_fairness_group", b"_fairness_group", "_priority", b"_priority", "_stream_bounds", b"_stream_bounds", "_ttl", b"_ttl", "config", b"config", "created_at", b"created_at", "error", b"error", "extracted_json", b"extracted_json", "fairness_group", b"fairness_group", "metadata", b"metadata", "priority", b"priority", "state_updated_at", b"state_updated_at", "stream_bounds", b"stream_bounds", "thread_id", b"thread_id", "ttl", b"ttl", "updated_at", b"updated_at", "values", b"values"] # noqa: Y015
1460
1468
  def HasField(self, field_name: _HasFieldArgType) -> _builtins.bool: ...
1461
- _ClearFieldArgType: _TypeAlias = _typing.Literal["_extracted_json", b"_extracted_json", "_fairness_group", b"_fairness_group", "_priority", b"_priority", "_ttl", b"_ttl", "config", b"config", "created_at", b"created_at", "error", b"error", "extracted_json", b"extracted_json", "fairness_group", b"fairness_group", "interrupts", b"interrupts", "metadata", b"metadata", "priority", b"priority", "state_updated_at", b"state_updated_at", "status", b"status", "thread_id", b"thread_id", "ttl", b"ttl", "updated_at", b"updated_at", "values", b"values"] # noqa: Y015
1469
+ _ClearFieldArgType: _TypeAlias = _typing.Literal["_extracted_json", b"_extracted_json", "_fairness_group", b"_fairness_group", "_priority", b"_priority", "_stream_bounds", b"_stream_bounds", "_ttl", b"_ttl", "config", b"config", "created_at", b"created_at", "error", b"error", "extracted_json", b"extracted_json", "fairness_group", b"fairness_group", "interrupts", b"interrupts", "metadata", b"metadata", "priority", b"priority", "state_updated_at", b"state_updated_at", "status", b"status", "stream_bounds", b"stream_bounds", "thread_id", b"thread_id", "ttl", b"ttl", "updated_at", b"updated_at", "values", b"values"] # noqa: Y015
1462
1470
  def ClearField(self, field_name: _ClearFieldArgType) -> None: ...
1463
1471
  _WhichOneofReturnType__extracted_json: _TypeAlias = _typing.Literal["extracted_json"] # noqa: Y015
1464
1472
  _WhichOneofArgType__extracted_json: _TypeAlias = _typing.Literal["_extracted_json", b"_extracted_json"] # noqa: Y015
@@ -1466,6 +1474,8 @@ class Thread(_message.Message):
1466
1474
  _WhichOneofArgType__fairness_group: _TypeAlias = _typing.Literal["_fairness_group", b"_fairness_group"] # noqa: Y015
1467
1475
  _WhichOneofReturnType__priority: _TypeAlias = _typing.Literal["priority"] # noqa: Y015
1468
1476
  _WhichOneofArgType__priority: _TypeAlias = _typing.Literal["_priority", b"_priority"] # noqa: Y015
1477
+ _WhichOneofReturnType__stream_bounds: _TypeAlias = _typing.Literal["stream_bounds"] # noqa: Y015
1478
+ _WhichOneofArgType__stream_bounds: _TypeAlias = _typing.Literal["_stream_bounds", b"_stream_bounds"] # noqa: Y015
1469
1479
  _WhichOneofReturnType__ttl: _TypeAlias = _typing.Literal["ttl"] # noqa: Y015
1470
1480
  _WhichOneofArgType__ttl: _TypeAlias = _typing.Literal["_ttl", b"_ttl"] # noqa: Y015
1471
1481
  @_typing.overload
@@ -1475,6 +1485,8 @@ class Thread(_message.Message):
1475
1485
  @_typing.overload
1476
1486
  def WhichOneof(self, oneof_group: _WhichOneofArgType__priority) -> _WhichOneofReturnType__priority | None: ...
1477
1487
  @_typing.overload
1488
+ def WhichOneof(self, oneof_group: _WhichOneofArgType__stream_bounds) -> _WhichOneofReturnType__stream_bounds | None: ...
1489
+ @_typing.overload
1478
1490
  def WhichOneof(self, oneof_group: _WhichOneofArgType__ttl) -> _WhichOneofReturnType__ttl | None: ...
1479
1491
 
1480
1492
  Global___Thread: _TypeAlias = Thread # noqa: Y015
@@ -1536,8 +1548,11 @@ class GetThreadRequest(_message.Message):
1536
1548
  FILTERS_FIELD_NUMBER: _builtins.int
1537
1549
  INCLUDE_TTL_FIELD_NUMBER: _builtins.int
1538
1550
  READ_MASK_FIELD_NUMBER: _builtins.int
1551
+ INCLUDE_STREAM_BOUNDS_FIELD_NUMBER: _builtins.int
1539
1552
  include_ttl: _builtins.bool
1540
1553
  """When true, include TTL information in the response."""
1554
+ include_stream_bounds: _builtins.bool
1555
+ """When true, include the thread's stream bounds in the response."""
1541
1556
  @_builtins.property
1542
1557
  def thread_id(self) -> Global___UUID: ...
1543
1558
  @_builtins.property
@@ -1556,16 +1571,21 @@ class GetThreadRequest(_message.Message):
1556
1571
  filters: _abc.Iterable[Global___AuthFilter] | None = ...,
1557
1572
  include_ttl: _builtins.bool | None = ...,
1558
1573
  read_mask: _field_mask_pb2.FieldMask | None = ...,
1574
+ include_stream_bounds: _builtins.bool | None = ...,
1559
1575
  ) -> None: ...
1560
- _HasFieldArgType: _TypeAlias = _typing.Literal["_include_ttl", b"_include_ttl", "_read_mask", b"_read_mask", "include_ttl", b"include_ttl", "read_mask", b"read_mask", "thread_id", b"thread_id"] # noqa: Y015
1576
+ _HasFieldArgType: _TypeAlias = _typing.Literal["_include_stream_bounds", b"_include_stream_bounds", "_include_ttl", b"_include_ttl", "_read_mask", b"_read_mask", "include_stream_bounds", b"include_stream_bounds", "include_ttl", b"include_ttl", "read_mask", b"read_mask", "thread_id", b"thread_id"] # noqa: Y015
1561
1577
  def HasField(self, field_name: _HasFieldArgType) -> _builtins.bool: ...
1562
- _ClearFieldArgType: _TypeAlias = _typing.Literal["_include_ttl", b"_include_ttl", "_read_mask", b"_read_mask", "filters", b"filters", "include_ttl", b"include_ttl", "read_mask", b"read_mask", "thread_id", b"thread_id"] # noqa: Y015
1578
+ _ClearFieldArgType: _TypeAlias = _typing.Literal["_include_stream_bounds", b"_include_stream_bounds", "_include_ttl", b"_include_ttl", "_read_mask", b"_read_mask", "filters", b"filters", "include_stream_bounds", b"include_stream_bounds", "include_ttl", b"include_ttl", "read_mask", b"read_mask", "thread_id", b"thread_id"] # noqa: Y015
1563
1579
  def ClearField(self, field_name: _ClearFieldArgType) -> None: ...
1580
+ _WhichOneofReturnType__include_stream_bounds: _TypeAlias = _typing.Literal["include_stream_bounds"] # noqa: Y015
1581
+ _WhichOneofArgType__include_stream_bounds: _TypeAlias = _typing.Literal["_include_stream_bounds", b"_include_stream_bounds"] # noqa: Y015
1564
1582
  _WhichOneofReturnType__include_ttl: _TypeAlias = _typing.Literal["include_ttl"] # noqa: Y015
1565
1583
  _WhichOneofArgType__include_ttl: _TypeAlias = _typing.Literal["_include_ttl", b"_include_ttl"] # noqa: Y015
1566
1584
  _WhichOneofReturnType__read_mask: _TypeAlias = _typing.Literal["read_mask"] # noqa: Y015
1567
1585
  _WhichOneofArgType__read_mask: _TypeAlias = _typing.Literal["_read_mask", b"_read_mask"] # noqa: Y015
1568
1586
  @_typing.overload
1587
+ def WhichOneof(self, oneof_group: _WhichOneofArgType__include_stream_bounds) -> _WhichOneofReturnType__include_stream_bounds | None: ...
1588
+ @_typing.overload
1569
1589
  def WhichOneof(self, oneof_group: _WhichOneofArgType__include_ttl) -> _WhichOneofReturnType__include_ttl | None: ...
1570
1590
  @_typing.overload
1571
1591
  def WhichOneof(self, oneof_group: _WhichOneofArgType__read_mask) -> _WhichOneofReturnType__read_mask | None: ...
@@ -2086,6 +2106,41 @@ class StreamThreadRequest(_message.Message):
2086
2106
 
2087
2107
  Global___StreamThreadRequest: _TypeAlias = StreamThreadRequest # noqa: Y015
2088
2108
 
2109
+ @_typing.final
2110
+ class ThreadStreamBounds(_message.Message):
2111
+ """Where a thread's event stream stands. Each id is unset when unknown."""
2112
+
2113
+ DESCRIPTOR: _descriptor.Descriptor
2114
+
2115
+ OLDEST_FIELD_NUMBER: _builtins.int
2116
+ LATEST_FIELD_NUMBER: _builtins.int
2117
+ oldest: _builtins.str
2118
+ """The oldest event still stored. A position before it can't be resumed."""
2119
+ latest: _builtins.str
2120
+ """The newest id issued: the newest stored event or, once those expired,
2121
+ the last event sent to readers.
2122
+ """
2123
+ def __init__(
2124
+ self,
2125
+ *,
2126
+ oldest: _builtins.str | None = ...,
2127
+ latest: _builtins.str | None = ...,
2128
+ ) -> None: ...
2129
+ _HasFieldArgType: _TypeAlias = _typing.Literal["_latest", b"_latest", "_oldest", b"_oldest", "latest", b"latest", "oldest", b"oldest"] # noqa: Y015
2130
+ def HasField(self, field_name: _HasFieldArgType) -> _builtins.bool: ...
2131
+ _ClearFieldArgType: _TypeAlias = _typing.Literal["_latest", b"_latest", "_oldest", b"_oldest", "latest", b"latest", "oldest", b"oldest"] # noqa: Y015
2132
+ def ClearField(self, field_name: _ClearFieldArgType) -> None: ...
2133
+ _WhichOneofReturnType__latest: _TypeAlias = _typing.Literal["latest"] # noqa: Y015
2134
+ _WhichOneofArgType__latest: _TypeAlias = _typing.Literal["_latest", b"_latest"] # noqa: Y015
2135
+ _WhichOneofReturnType__oldest: _TypeAlias = _typing.Literal["oldest"] # noqa: Y015
2136
+ _WhichOneofArgType__oldest: _TypeAlias = _typing.Literal["_oldest", b"_oldest"] # noqa: Y015
2137
+ @_typing.overload
2138
+ def WhichOneof(self, oneof_group: _WhichOneofArgType__latest) -> _WhichOneofReturnType__latest | None: ...
2139
+ @_typing.overload
2140
+ def WhichOneof(self, oneof_group: _WhichOneofArgType__oldest) -> _WhichOneofReturnType__oldest | None: ...
2141
+
2142
+ Global___ThreadStreamBounds: _TypeAlias = ThreadStreamBounds # noqa: Y015
2143
+
2089
2144
  @_typing.final
2090
2145
  class GetThreadStorageRequest(_message.Message):
2091
2146
  DESCRIPTOR: _descriptor.Descriptor
@@ -3097,8 +3152,36 @@ class CancelAcceptedBeforeResponse(_message.Message):
3097
3152
 
3098
3153
  Global___CancelAcceptedBeforeResponse: _TypeAlias = CancelAcceptedBeforeResponse # noqa: Y015
3099
3154
 
3155
+ @_typing.final
3156
+ class RunSearchCursor(_message.Message):
3157
+ """A run's position in the search order, created_at DESC then run_id DESC."""
3158
+
3159
+ DESCRIPTOR: _descriptor.Descriptor
3160
+
3161
+ CREATED_AT_FIELD_NUMBER: _builtins.int
3162
+ RUN_ID_FIELD_NUMBER: _builtins.int
3163
+ @_builtins.property
3164
+ def created_at(self) -> _timestamp_pb2.Timestamp: ...
3165
+ @_builtins.property
3166
+ def run_id(self) -> Global___UUID: ...
3167
+ def __init__(
3168
+ self,
3169
+ *,
3170
+ created_at: _timestamp_pb2.Timestamp | None = ...,
3171
+ run_id: Global___UUID | None = ...,
3172
+ ) -> None: ...
3173
+ _HasFieldArgType: _TypeAlias = _typing.Literal["created_at", b"created_at", "run_id", b"run_id"] # noqa: Y015
3174
+ def HasField(self, field_name: _HasFieldArgType) -> _builtins.bool: ...
3175
+ _ClearFieldArgType: _TypeAlias = _typing.Literal["created_at", b"created_at", "run_id", b"run_id"] # noqa: Y015
3176
+ def ClearField(self, field_name: _ClearFieldArgType) -> None: ...
3177
+ def WhichOneof(self, oneof_group: _Never) -> None: ...
3178
+
3179
+ Global___RunSearchCursor: _TypeAlias = RunSearchCursor # noqa: Y015
3180
+
3100
3181
  @_typing.final
3101
3182
  class SearchRunsRequest(_message.Message):
3183
+ """Runs come back newest first, ties on created_at broken by the larger run_id."""
3184
+
3102
3185
  DESCRIPTOR: _descriptor.Descriptor
3103
3186
 
3104
3187
  THREAD_ID_FIELD_NUMBER: _builtins.int
@@ -3107,6 +3190,7 @@ class SearchRunsRequest(_message.Message):
3107
3190
  OFFSET_FIELD_NUMBER: _builtins.int
3108
3191
  STATUS_FIELD_NUMBER: _builtins.int
3109
3192
  SELECT_FIELD_NUMBER: _builtins.int
3193
+ BEFORE_FIELD_NUMBER: _builtins.int
3110
3194
  limit: _builtins.int
3111
3195
  offset: _builtins.int
3112
3196
  status: _enum_run_status_pb2.RunStatus.ValueType
@@ -3116,6 +3200,12 @@ class SearchRunsRequest(_message.Message):
3116
3200
  def filters(self) -> _containers.RepeatedCompositeFieldContainer[Global___AuthFilter]: ...
3117
3201
  @_builtins.property
3118
3202
  def select(self) -> _containers.RepeatedScalarFieldContainer[_builtins.str]: ...
3203
+ @_builtins.property
3204
+ def before(self) -> Global___RunSearchCursor:
3205
+ """Only runs that sort after this position, exclusive. Pass the last run of the
3206
+ previous page to read the next one. Can't be combined with a nonzero offset.
3207
+ """
3208
+
3119
3209
  def __init__(
3120
3210
  self,
3121
3211
  *,
@@ -3125,11 +3215,14 @@ class SearchRunsRequest(_message.Message):
3125
3215
  offset: _builtins.int | None = ...,
3126
3216
  status: _enum_run_status_pb2.RunStatus.ValueType | None = ...,
3127
3217
  select: _abc.Iterable[_builtins.str] | None = ...,
3218
+ before: Global___RunSearchCursor | None = ...,
3128
3219
  ) -> None: ...
3129
- _HasFieldArgType: _TypeAlias = _typing.Literal["_limit", b"_limit", "_offset", b"_offset", "_status", b"_status", "limit", b"limit", "offset", b"offset", "status", b"status", "thread_id", b"thread_id"] # noqa: Y015
3220
+ _HasFieldArgType: _TypeAlias = _typing.Literal["_before", b"_before", "_limit", b"_limit", "_offset", b"_offset", "_status", b"_status", "before", b"before", "limit", b"limit", "offset", b"offset", "status", b"status", "thread_id", b"thread_id"] # noqa: Y015
3130
3221
  def HasField(self, field_name: _HasFieldArgType) -> _builtins.bool: ...
3131
- _ClearFieldArgType: _TypeAlias = _typing.Literal["_limit", b"_limit", "_offset", b"_offset", "_status", b"_status", "filters", b"filters", "limit", b"limit", "offset", b"offset", "select", b"select", "status", b"status", "thread_id", b"thread_id"] # noqa: Y015
3222
+ _ClearFieldArgType: _TypeAlias = _typing.Literal["_before", b"_before", "_limit", b"_limit", "_offset", b"_offset", "_status", b"_status", "before", b"before", "filters", b"filters", "limit", b"limit", "offset", b"offset", "select", b"select", "status", b"status", "thread_id", b"thread_id"] # noqa: Y015
3132
3223
  def ClearField(self, field_name: _ClearFieldArgType) -> None: ...
3224
+ _WhichOneofReturnType__before: _TypeAlias = _typing.Literal["before"] # noqa: Y015
3225
+ _WhichOneofArgType__before: _TypeAlias = _typing.Literal["_before", b"_before"] # noqa: Y015
3133
3226
  _WhichOneofReturnType__limit: _TypeAlias = _typing.Literal["limit"] # noqa: Y015
3134
3227
  _WhichOneofArgType__limit: _TypeAlias = _typing.Literal["_limit", b"_limit"] # noqa: Y015
3135
3228
  _WhichOneofReturnType__offset: _TypeAlias = _typing.Literal["offset"] # noqa: Y015
@@ -3137,6 +3230,8 @@ class SearchRunsRequest(_message.Message):
3137
3230
  _WhichOneofReturnType__status: _TypeAlias = _typing.Literal["status"] # noqa: Y015
3138
3231
  _WhichOneofArgType__status: _TypeAlias = _typing.Literal["_status", b"_status"] # noqa: Y015
3139
3232
  @_typing.overload
3233
+ def WhichOneof(self, oneof_group: _WhichOneofArgType__before) -> _WhichOneofReturnType__before | None: ...
3234
+ @_typing.overload
3140
3235
  def WhichOneof(self, oneof_group: _WhichOneofArgType__limit) -> _WhichOneofReturnType__limit | None: ...
3141
3236
  @_typing.overload
3142
3237
  def WhichOneof(self, oneof_group: _WhichOneofArgType__offset) -> _WhichOneofReturnType__offset | None: ...
@@ -1,61 +1,33 @@
1
+ """Edition-selected runtime modules.
2
+
3
+ Each ``langgraph_runtime.<name>`` stub replaces itself in ``sys.modules`` with
4
+ the active edition's module on first import, so importing one never imports
5
+ the others.
6
+ """
7
+
8
+ import importlib
1
9
  import importlib.util
2
10
  import os
3
11
  import sys
4
- import types
5
-
6
- import structlog
7
12
 
8
- logger = structlog.stdlib.get_logger(__name__)
9
13
 
10
- try:
11
- RUNTIME_EDITION = os.environ["LANGGRAPH_RUNTIME_EDITION"]
12
- RUNTIME_PACKAGE = f"langgraph_runtime_{RUNTIME_EDITION}"
13
- except KeyError:
14
- raise ValueError(
15
- "LANGGRAPH_RUNTIME_EDITION environment variable is not set."
16
- " Expected LANGGRAPH_RUNTIME_EDITION to be set to one of:\n"
17
- " - inmem\n"
18
- " - postgres\n"
19
- " - community\n"
20
- ) from None
21
-
22
- from langgraph_api.feature_flags import INMEM_USES_CORE # noqa: E402
23
-
24
- if INMEM_USES_CORE:
25
- # Go core persists everything; Python only runs graphs.
26
- backend = types.SimpleNamespace(
27
- checkpoint=importlib.import_module("langgraph_api.runtime.checkpoint"),
28
- database=importlib.import_module("langgraph_api.runtime.database"),
29
- encryption=importlib.import_module("langgraph_api.runtime.encryption"),
30
- ops=importlib.import_module("langgraph_api.grpc.ops"),
31
- routes=importlib.import_module("langgraph_api.runtime.routes"),
32
- store=importlib.import_module("langgraph_api.runtime.store"),
14
+ def _alias(name: str) -> None:
15
+ edition = os.environ.get("LANGGRAPH_RUNTIME_EDITION")
16
+ if not edition:
17
+ raise ValueError(
18
+ "LANGGRAPH_RUNTIME_EDITION environment variable is not set."
19
+ " Expected LANGGRAPH_RUNTIME_EDITION to be set to one of:\n"
20
+ " - inmem\n"
21
+ " - postgres\n"
22
+ )
23
+ package = (
24
+ "langgraph_api.runtime"
25
+ if edition == "inmem"
26
+ else f"langgraph_runtime_{edition}"
33
27
  )
34
- logger.info("Using the in-memory runtime on Go core")
35
- elif importlib.util.find_spec(RUNTIME_PACKAGE):
36
- backend = importlib.import_module(RUNTIME_PACKAGE)
37
- logger.info(f"Using {RUNTIME_PACKAGE}")
38
- else:
39
- raise ImportError(
40
- "Langgraph runtime backend not found. Please install with "
41
- f'`pip install "langgraph-runtime-{RUNTIME_EDITION}"`'
42
- ) from None
43
-
44
- # All runtime backends share the same API
45
- for module_name in (
46
- "checkpoint",
47
- "database",
48
- "lifespan",
49
- "ops",
50
- "retry",
51
- "store",
52
- "metrics",
53
- "routes",
54
- ):
55
- mod = getattr(backend, module_name, None)
56
- if mod is None and module_name in ("lifespan", "retry", "metrics"):
57
- # The shared modules import the backend modules registered above.
58
- mod = importlib.import_module("langgraph_api.runtime." + module_name)
59
- if mod is not None:
60
- globals()[module_name] = mod
61
- sys.modules["langgraph_runtime." + module_name] = mod
28
+ if importlib.util.find_spec(package.partition(".")[0]) is None:
29
+ raise ImportError(
30
+ "Langgraph runtime backend not found. Please install with "
31
+ f'`pip install "langgraph-runtime-{edition}"`'
32
+ )
33
+ sys.modules[name] = importlib.import_module(f"{package}.{name.rpartition('.')[2]}")
@@ -1,4 +1,8 @@
1
1
  from typing import TYPE_CHECKING
2
2
 
3
3
  if TYPE_CHECKING:
4
- from langgraph_runtime_inmem.checkpoint import * # noqa: F403
4
+ from langgraph_api.runtime.checkpoint import * # noqa: F403
5
+ else:
6
+ from langgraph_runtime import _alias
7
+
8
+ _alias(__name__)
@@ -1,4 +1,8 @@
1
1
  from typing import TYPE_CHECKING
2
2
 
3
3
  if TYPE_CHECKING:
4
- from langgraph_runtime_inmem.database import * # noqa: F403
4
+ from langgraph_api.runtime.database import * # noqa: F403
5
+ else:
6
+ from langgraph_runtime import _alias
7
+
8
+ _alias(__name__)
@@ -1,15 +1,8 @@
1
- """Runtime-selected Python encryption structure."""
1
+ from typing import TYPE_CHECKING
2
2
 
3
- from langgraph_runtime import backend
3
+ if TYPE_CHECKING:
4
+ from langgraph_api.runtime.encryption import * # noqa: F403
5
+ else:
6
+ from langgraph_runtime import _alias
4
7
 
5
- decrypt_fields = backend.encryption.decrypt_fields
6
- encrypt_fields = backend.encryption.encrypt_fields
7
- encryption_fields = backend.encryption.encryption_fields
8
- should_skip_encryption = backend.encryption.should_skip_encryption
9
-
10
- __all__ = [
11
- "decrypt_fields",
12
- "encrypt_fields",
13
- "encryption_fields",
14
- "should_skip_encryption",
15
- ]
8
+ _alias(__name__)
@@ -1,11 +1,8 @@
1
- """Route discovery facade for runtime packages.
1
+ from typing import TYPE_CHECKING
2
2
 
3
- This module discovers and exposes internal routes from the active runtime.
4
- Routes are loaded based on MIGRATIONS_PATH which determines the runtime type.
5
- """
3
+ if TYPE_CHECKING:
4
+ from langgraph_api.runtime.routes import * # noqa: F403
5
+ else:
6
+ from langgraph_runtime import _alias
6
7
 
7
- from collections.abc import Callable
8
-
9
- from starlette.routing import Route
10
-
11
- get_internal_routes: Callable[[], list[Route]] | None = None
8
+ _alias(__name__)
@@ -1,4 +1,8 @@
1
1
  from typing import TYPE_CHECKING
2
2
 
3
3
  if TYPE_CHECKING:
4
- from langgraph_runtime_inmem.store import * # noqa: F403
4
+ from langgraph_api.runtime.store import * # noqa: F403
5
+ else:
6
+ from langgraph_runtime import _alias
7
+
8
+ _alias(__name__)
openapi.json CHANGED
@@ -4134,12 +4134,68 @@
4134
4134
  "tags": ["MCP"]
4135
4135
  }
4136
4136
  },
4137
+ "/": {
4138
+ "get": {
4139
+ "tags": ["System"],
4140
+ "summary": "Root Health Check",
4141
+ "description": "Check the health status of the server. Alias of `/ok` for load balancers. Optionally check database connectivity.",
4142
+ "operationId": "health_check_root_get",
4143
+ "security": [],
4144
+ "parameters": [
4145
+ {
4146
+ "name": "check_db",
4147
+ "in": "query",
4148
+ "required": false,
4149
+ "schema": {
4150
+ "type": "integer",
4151
+ "enum": [0, 1],
4152
+ "default": 0,
4153
+ "title": "Check Database",
4154
+ "description": "Whether to check database connectivity (0=false, 1=true)"
4155
+ }
4156
+ }
4157
+ ],
4158
+ "responses": {
4159
+ "200": {
4160
+ "description": "Success",
4161
+ "content": {
4162
+ "application/json": {
4163
+ "schema": {
4164
+ "type": "object",
4165
+ "properties": {
4166
+ "ok": {
4167
+ "type": "boolean",
4168
+ "const": true,
4169
+ "title": "OK",
4170
+ "description": "Indicates the server is healthy"
4171
+ }
4172
+ },
4173
+ "required": ["ok"],
4174
+ "title": "HealthResponse"
4175
+ }
4176
+ }
4177
+ }
4178
+ },
4179
+ "500": {
4180
+ "description": "Internal Server Error",
4181
+ "content": {
4182
+ "application/json": {
4183
+ "schema": {
4184
+ "$ref": "#/components/schemas/ErrorResponse"
4185
+ }
4186
+ }
4187
+ }
4188
+ }
4189
+ }
4190
+ }
4191
+ },
4137
4192
  "/info": {
4138
4193
  "get": {
4139
4194
  "tags": ["System"],
4140
4195
  "summary": "Server Information",
4141
4196
  "description": "Get server version information, feature flags, and metadata.",
4142
4197
  "operationId": "server_info_info_get",
4198
+ "security": [],
4143
4199
  "responses": {
4144
4200
  "200": {
4145
4201
  "description": "Success",
@@ -4189,6 +4245,7 @@
4189
4245
  "summary": "System Metrics",
4190
4246
  "description": "Get system metrics in Prometheus or JSON format for monitoring and observability.",
4191
4247
  "operationId": "system_metrics_metrics_get",
4248
+ "security": [],
4192
4249
  "parameters": [
4193
4250
  {
4194
4251
  "name": "format",
@@ -4232,6 +4289,7 @@
4232
4289
  "summary": "API Documentation",
4233
4290
  "description": "A local reference to the Agent Server API documentation.",
4234
4291
  "operationId": "docs_get",
4292
+ "security": [],
4235
4293
  "responses": {
4236
4294
  "200": {
4237
4295
  "description": "Success",
@@ -4248,6 +4306,7 @@
4248
4306
  "summary": "Health Check",
4249
4307
  "description": "Check the health status of the server. Optionally check database connectivity.",
4250
4308
  "operationId": "health_check_ok_get",
4309
+ "security": [],
4251
4310
  "parameters": [
4252
4311
  {
4253
4312
  "name": "check_db",
@@ -1,4 +0,0 @@
1
- from typing import TYPE_CHECKING
2
-
3
- if TYPE_CHECKING:
4
- from langgraph_runtime_inmem.lifespan import * # noqa: F403
@@ -1,4 +0,0 @@
1
- from typing import TYPE_CHECKING
2
-
3
- if TYPE_CHECKING:
4
- from langgraph_runtime_inmem.metrics import * # noqa: F403
langgraph_runtime/ops.py DELETED
@@ -1,4 +0,0 @@
1
- from typing import TYPE_CHECKING
2
-
3
- if TYPE_CHECKING:
4
- from langgraph_runtime_inmem.ops import * # noqa: F403
@@ -1,4 +0,0 @@
1
- from typing import TYPE_CHECKING
2
-
3
- if TYPE_CHECKING:
4
- from langgraph_runtime_inmem.queue import * # noqa: F403
@@ -1,4 +0,0 @@
1
- from typing import TYPE_CHECKING
2
-
3
- if TYPE_CHECKING:
4
- from langgraph_runtime_inmem.retry import * # noqa: F403