langgraph-api 0.19.0.dev8__py3-none-any.whl → 0.19.0.dev10__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 CHANGED
@@ -1 +1 @@
1
- __version__ = "0.19.0.dev8"
1
+ __version__ = "0.19.0.dev10"
@@ -347,11 +347,13 @@ async def get_checkpointer(
347
347
  )
348
348
 
349
349
  from langgraph_api.feature_flags import ( # noqa: PLC0415
350
+ INMEM_USES_CORE,
350
351
  IS_POSTGRES_BACKEND,
351
352
  PREFER_GRPC_CHECKPOINTER,
352
353
  )
353
354
 
354
- if IS_POSTGRES_BACKEND and PREFER_GRPC_CHECKPOINTER:
355
+ # Inmem on Go core has no Python checkpointer.
356
+ if INMEM_USES_CORE or (IS_POSTGRES_BACKEND and PREFER_GRPC_CHECKPOINTER):
355
357
  return cast(
356
358
  "FullCheckpointerProtocol",
357
359
  GrpcCheckpointer(
@@ -287,7 +287,7 @@ custom_app_lifespan = (
287
287
 
288
288
 
289
289
  if "__inmem" in MIGRATIONS_PATH:
290
- from langgraph_runtime_inmem.routes import get_internal_routes
290
+ from langgraph_runtime.routes import get_internal_routes
291
291
 
292
292
  if get_internal_routes is not None:
293
293
  for route in get_internal_routes():
@@ -122,7 +122,12 @@ def _exclude_metadata_kwargs(payload: dict) -> dict:
122
122
  return {"exclude_metadata": exclude_metadata}
123
123
 
124
124
 
125
- _THREAD_TIME_RANGE_FIELDS = ("created_after", "created_before")
125
+ _THREAD_TIME_RANGE_FIELDS = (
126
+ "created_after",
127
+ "created_before",
128
+ "state_updated_after",
129
+ "state_updated_before",
130
+ )
126
131
 
127
132
 
128
133
  def _time_range_kwargs(payload: dict) -> dict:
langgraph_api/cli.py CHANGED
@@ -16,6 +16,8 @@ from concurrent.futures import ThreadPoolExecutor
16
16
  from concurrent.futures import TimeoutError as FutureTimeoutError
17
17
  from typing import Literal
18
18
 
19
+ from langgraph_api import embedded_core
20
+
19
21
  if typing.TYPE_CHECKING:
20
22
  from packaging.version import Version
21
23
 
@@ -299,7 +301,24 @@ def run_server(
299
301
  continue
300
302
  to_patch[k] = v
301
303
 
302
- with patch_environment(**to_patch):
304
+ def _env(name: str, default: str = "") -> str:
305
+ if env_vars and name in env_vars:
306
+ return env_vars[name]
307
+ return os.getenv(name, default)
308
+
309
+ use_core = runtime_edition == "inmem" and _env(
310
+ "FF_INMEM_CORE", "false"
311
+ ).lower() in ("true", "1", "yes")
312
+ if use_core:
313
+ to_patch[embedded_core.ADDRESS_ENV] = ""
314
+ core = (
315
+ embedded_core.start(None if disable_persistence else embedded_core.SQLITE_PATH)
316
+ if use_core
317
+ else contextlib.nullcontext(None)
318
+ )
319
+ with patch_environment(**to_patch), core as core_address:
320
+ if core_address is not None:
321
+ os.environ[embedded_core.ADDRESS_ENV] = core_address
303
322
  is_ssl = ssl_certfile is not None and ssl_keyfile is not None
304
323
  local_url = _resolve_server_url(
305
324
  host,
@@ -207,6 +207,12 @@ LANGGRAPH_CLOUD_LICENSE_KEY = env("LANGGRAPH_CLOUD_LICENSE_KEY", cast=str, defau
207
207
  # When true, the Go core-server owns Postgres schema setup (DB migrations +
208
208
  # vector index)
209
209
  DB_MIGRATION_BY_CORE_API = env("DB_MIGRATION_BY_CORE_API", cast=bool, default=True)
210
+ # Bounds core-server startup, including migrations, and how long Python waits
211
+ # for it. Core-server reads the same env var. Keep under the startup probe.
212
+ # Not in public docs: infrastructure, set by platform
213
+ STARTUP_TIMEOUT_SECONDS = env("STARTUP_TIMEOUT_SECONDS", cast=float, default=270.0)
214
+ if STARTUP_TIMEOUT_SECONDS <= 0:
215
+ STARTUP_TIMEOUT_SECONDS = 270.0
210
216
 
211
217
  # redis
212
218
  # Not in public docs: infrastructure, set by platform
@@ -0,0 +1,124 @@
1
+ from __future__ import annotations
2
+
3
+ import logging
4
+ import os
5
+ import subprocess
6
+ import tempfile
7
+ import time
8
+ from contextlib import contextmanager
9
+ from pathlib import Path
10
+ from typing import TYPE_CHECKING
11
+
12
+ try:
13
+ from langgraph_api_core_bin import binary_path
14
+ except ImportError:
15
+ binary_path = None
16
+
17
+ if TYPE_CHECKING:
18
+ from collections.abc import Iterator
19
+
20
+ logger = logging.getLogger(__name__)
21
+
22
+ # Hands the address of a core started by ``langgraph dev`` to its server process.
23
+ ADDRESS_ENV = "LANGGRAPH_EMBEDDED_CORE_ADDRESS"
24
+ SQLITE_PATH = os.path.join(".langgraph_api", "core.sqlite")
25
+ # Local data formats this version no longer reads. Add a pattern whenever a
26
+ # change drops local dev data instead of migrating it.
27
+ DROPPED_LOCAL_DATA = (
28
+ "*.pckl", # Python in-memory runtime
29
+ )
30
+
31
+
32
+ @contextmanager
33
+ def start(sqlite_path: str | None = None) -> Iterator[str]:
34
+ """Run Go core on SQLite; in-memory unless ``sqlite_path`` is given."""
35
+ if binary_path is None:
36
+ raise RuntimeError(
37
+ "Local development requires the inmem extra: "
38
+ "pip install 'langgraph-api[inmem]'"
39
+ )
40
+
41
+ with tempfile.TemporaryDirectory(prefix="langgraph-core-") as temp_dir:
42
+ address_file = Path(temp_dir, "address")
43
+ env = os.environ.copy()
44
+ env.update(
45
+ DATABASE_URI="",
46
+ DISPATCH_MODE="single-process",
47
+ LANGGRAPH_STORE_BACKEND="grpc",
48
+ LSD_GRPC_SERVER_ADDRESS="127.0.0.1:0",
49
+ PPROF_ADDR="127.0.0.1:0",
50
+ )
51
+ # An empty DATABASE_URI falls back to POSTGRES_URI, which sqlite_only cores refuse.
52
+ env.pop("POSTGRES_URI", None)
53
+ env.pop("REDIS_URI", None)
54
+ env.pop("REDIS_URI_CUSTOM", None)
55
+ env["LOG_LEVEL"] = _core_log_level(env.get("LOG_LEVEL", ""))
56
+ # Core exits when this pipe closes, so it never outlives this process.
57
+ args = [
58
+ binary_path(),
59
+ "-apply-db-schema",
60
+ "-exit-on-stdin-close",
61
+ "-address-file",
62
+ address_file,
63
+ ]
64
+ if sqlite_path:
65
+ Path(sqlite_path).parent.mkdir(parents=True, exist_ok=True)
66
+ _warn_dropped_local_data(Path(sqlite_path).parent)
67
+ args += ["-sqlite-path", sqlite_path]
68
+ process = subprocess.Popen(
69
+ args,
70
+ env=env,
71
+ stdin=subprocess.PIPE,
72
+ )
73
+ try:
74
+ yield _wait_for_address(process, address_file)
75
+ finally:
76
+ if process.poll() is None:
77
+ process.terminate()
78
+ try:
79
+ process.wait(timeout=5)
80
+ except subprocess.TimeoutExpired:
81
+ process.kill()
82
+ process.wait()
83
+
84
+
85
+ def _core_log_level(level: str) -> str:
86
+ """Map Python's LOG_LEVEL to core's; unknown values make core log at INFO.
87
+
88
+ Defaults to WARN: core's startup INFO logs drown out the dev server.
89
+ """
90
+ level = {"WARNING": "WARN", "CRITICAL": "ERROR"}.get(level.upper(), level.upper())
91
+ return level if level in ("DEBUG", "INFO", "WARN", "ERROR", "FATAL") else "WARN"
92
+
93
+
94
+ def _warn_dropped_local_data(data_dir: Path) -> None:
95
+ dropped = sorted(
96
+ str(f) for pattern in DROPPED_LOCAL_DATA for f in data_dir.glob(pattern)
97
+ )
98
+ if dropped:
99
+ logger.warning(
100
+ "Ignoring local data from an older format that this version no longer "
101
+ "reads; threads, runs and store items saved there won't appear: %s",
102
+ ", ".join(dropped),
103
+ )
104
+
105
+
106
+ def _wait_for_address(
107
+ process: subprocess.Popen[bytes], address_file: Path, timeout: float = 30
108
+ ) -> str:
109
+ deadline = time.monotonic() + timeout
110
+ while time.monotonic() < deadline:
111
+ if process.poll() is not None:
112
+ raise RuntimeError(
113
+ f"LangGraph API core exited with code {process.returncode}"
114
+ )
115
+ try:
116
+ if address := address_file.read_text().strip():
117
+ return address
118
+ except FileNotFoundError:
119
+ pass
120
+ time.sleep(0.05)
121
+ raise RuntimeError("Timed out waiting for LangGraph API core to start")
122
+
123
+
124
+ __all__ = ["ADDRESS_ENV", "SQLITE_PATH", "start"]
@@ -788,10 +788,25 @@ class ThreadRunManager:
788
788
  sanitize_reserved_keys(params)
789
789
  config = params.get("config") if _is_record(params.get("config")) else {}
790
790
 
791
- # ``input.respond`` checked its interrupts already and always resumes;
792
- # the lookups below can wait seconds on a busy thread.
791
+ # The fork target arrives only via ``config.configurable.checkpoint_id``
792
+ # (the SDK folds its ergonomic ``forkFrom`` option into this field
793
+ # client-side, so there is a single way to provide it). Extract it
794
+ # here and map it onto the top-level ``checkpoint_id`` / ``checkpoint``
795
+ # fields of ``run_payload`` below: ``create_valid_run``, the shared
796
+ # run-creation path also used by the legacy REST run-create endpoints,
797
+ # reads the fork target from those fields (UUID-validating it and
798
+ # injecting it back into ``config.configurable``), so populating them is
799
+ # what makes the run replay from the requested checkpoint rather than
800
+ # the thread's latest state.
801
+ checkpoint_id = _checkpoint_id_from_run_start_config(params)
802
+
803
+ # Only a plain run.start needs the lookups below, which can wait seconds
804
+ # on a busy thread: ``input.respond`` checked its interrupts already and
805
+ # always resumes, and a fork starts a new run from its checkpoint
806
+ # whatever the thread's latest one waits on.
793
807
  force_resume = params.get("force_resume")
794
- current_run = None if force_resume else await self._fetch_current_run()
808
+ infer_resume = not force_resume and checkpoint_id is None
809
+ current_run = await self._fetch_current_run() if infer_resume else None
795
810
 
796
811
  current_status = None
797
812
  if current_run is not None:
@@ -802,7 +817,7 @@ class ThreadRunManager:
802
817
  )
803
818
 
804
819
  has_interrupts = False
805
- if params.get("input") is not None and not force_resume:
820
+ if params.get("input") is not None and infer_resume:
806
821
  has_interrupts = await self._has_pending_interrupts()
807
822
  if has_interrupts and not keyed_by_interrupt_id(params["input"]):
808
823
  # One answer can't say which of several pending interrupts it is
@@ -831,18 +846,6 @@ class ThreadRunManager:
831
846
  },
832
847
  }
833
848
 
834
- # The fork target arrives only via ``config.configurable.checkpoint_id``
835
- # (the SDK folds its ergonomic ``forkFrom`` option into this field
836
- # client-side, so there is a single way to provide it). Extract it
837
- # here and map it onto the top-level ``checkpoint_id`` / ``checkpoint``
838
- # fields of ``run_payload`` below: ``create_valid_run`` — the shared
839
- # run-creation path also used by the legacy REST run-create endpoints —
840
- # reads the fork target from those fields (UUID-validating it and
841
- # injecting it back into ``config.configurable``), so populating them is
842
- # what makes the run replay from the requested checkpoint rather than
843
- # the thread's latest state.
844
- checkpoint_id = _checkpoint_id_from_run_start_config(params)
845
-
846
849
  run_payload: dict[str, Any] = {
847
850
  "assistant_id": assistant_id,
848
851
  "input": None if is_resume else params.get("input"),
@@ -20,7 +20,13 @@ USE_DURABILITY = LANGGRAPH_PY_MINOR >= (0, 6)
20
20
  _RUNTIME_EDITION = os.getenv("LANGGRAPH_RUNTIME_EDITION", "inmem")
21
21
  IS_POSTGRES_BACKEND = _RUNTIME_EDITION == "postgres"
22
22
  IS_INMEM_BACKEND = _RUNTIME_EDITION == "inmem"
23
- IS_POSTGRES_OR_GRPC_BACKEND = IS_POSTGRES_BACKEND
23
+ # Opt-in: run the in-memory runtime on Go core with SQLite.
24
+ INMEM_USES_CORE = IS_INMEM_BACKEND and os.getenv("FF_INMEM_CORE", "false").lower() in (
25
+ "true",
26
+ "1",
27
+ "yes",
28
+ )
29
+ IS_POSTGRES_OR_GRPC_BACKEND = IS_POSTGRES_BACKEND or INMEM_USES_CORE
24
30
  # Server-side kill switch for the Protocol v2 event-streaming surface
25
31
  # (#3296). When false, the v2 routes are not registered (clients hit a
26
32
  # 404), and ``_create_or_resume_run`` rejects any direct call with a
@@ -58,7 +64,7 @@ def _resolve_prefer_grpc_checkpointer(
58
64
 
59
65
 
60
66
  # When true on the postgres runtime, use ``GrpcCheckpointer``.
61
- # Inmem edition is unaffected (``IS_POSTGRES_BACKEND`` is false there).
67
+ # Inmem on Go core always uses it; Python inmem never does.
62
68
  # Custom checkpointer (``backend=custom`` in ``LANGGRAPH_CHECKPOINTER``) and
63
69
  # Mongo (``backend=mongo``) is also unaffected.
64
70
  # langgraph < 0.5 keeps Send() packets in checkpoint["pending_sends"], which only
@@ -90,7 +90,7 @@ _thread_local = threading.local()
90
90
 
91
91
 
92
92
  GRPC_HEALTHCHECK_TIMEOUT = 5.0
93
- GRPC_INIT_TIMEOUT = 60.0
93
+ GRPC_INIT_TIMEOUT = config.STARTUP_TIMEOUT_SECONDS
94
94
  GRPC_INIT_PROBE_INTERVAL = 0.5
95
95
 
96
96
 
@@ -380,6 +380,8 @@ class Threads(Authenticated):
380
380
  exclude_metadata: list[dict[str, Any]] | None = None,
381
381
  created_after: datetime | None = None,
382
382
  created_before: datetime | None = None,
383
+ state_updated_after: datetime | None = None,
384
+ state_updated_before: datetime | None = None,
383
385
  raw_values: bool = False,
384
386
  ctx: Any = None,
385
387
  ) -> tuple[AsyncIterator[Thread], int | None]:
@@ -405,6 +407,8 @@ class Threads(Authenticated):
405
407
  "values_json": json_dumpb_optional(values),
406
408
  "created_after": created_after,
407
409
  "created_before": created_before,
410
+ "state_updated_after": state_updated_after,
411
+ "state_updated_before": state_updated_before,
408
412
  "limit": limit,
409
413
  "offset": offset,
410
414
  "sort_by": _map_threads_sort_by(sort_by),
@@ -462,6 +466,8 @@ class Threads(Authenticated):
462
466
  exclude_metadata: list[dict[str, Any]] | None = None,
463
467
  created_after: datetime | None = None,
464
468
  created_before: datetime | None = None,
469
+ state_updated_after: datetime | None = None,
470
+ state_updated_before: datetime | None = None,
465
471
  ctx: Any = None,
466
472
  ) -> int:
467
473
  metadata = metadata or {}
@@ -483,6 +489,8 @@ class Threads(Authenticated):
483
489
  "values_json": json_dumpb_optional(values),
484
490
  "created_after": created_after,
485
491
  "created_before": created_before,
492
+ "state_updated_after": state_updated_after,
493
+ "state_updated_before": state_updated_before,
486
494
  }
487
495
  if exclude_metadata:
488
496
  request_kwargs["exclude_metadata_json"] = json_dumpb(exclude_metadata)
langgraph_api/logging.py CHANGED
@@ -22,6 +22,8 @@ WARNING_ONLY_LOGGERS = (
22
22
  "psycopg",
23
23
  "mcp.server.streamable_http",
24
24
  "mcp.server.streamable_http_manager",
25
+ # Logs every file write under the reload dirs, including core.sqlite.
26
+ "watchfiles.main",
25
27
  )
26
28
  for library_logger in WARNING_ONLY_LOGGERS:
27
29
  logging.getLogger(library_logger).setLevel(logging.WARNING)
@@ -0,0 +1,6 @@
1
+ async def start_checkpoint_ingestion_loop() -> None:
2
+ pass
3
+
4
+
5
+ async def stop_checkpoint_ingestion_loop() -> None:
6
+ pass
@@ -0,0 +1,38 @@
1
+ from collections.abc import AsyncIterator
2
+ from contextlib import asynccontextmanager
3
+ from typing import Any
4
+
5
+
6
+ class CoreApiConnectionProto:
7
+ """No-op connection for operations persisted through Go core."""
8
+
9
+ @asynccontextmanager
10
+ async def pipeline(self):
11
+ yield None
12
+
13
+ @asynccontextmanager
14
+ async def transaction(self):
15
+ yield None
16
+
17
+
18
+ @asynccontextmanager
19
+ async def connect(
20
+ *, supports_core_api: bool = True, __test__: bool = False
21
+ ) -> AsyncIterator[Any]:
22
+ yield CoreApiConnectionProto()
23
+
24
+
25
+ async def start_pool() -> None:
26
+ pass
27
+
28
+
29
+ async def stop_pool() -> None:
30
+ pass
31
+
32
+
33
+ async def healthcheck(*, check_db: bool = True) -> None:
34
+ pass
35
+
36
+
37
+ def pool_stats(*args: Any, **kwargs: Any) -> dict[str, dict[str, int]]:
38
+ return {}
@@ -9,7 +9,9 @@ from langchain_core.runnables.config import RunnableConfig, var_child_runnable_c
9
9
  from langgraph.constants import CONF
10
10
  from starlette.applications import Starlette
11
11
 
12
+ from langgraph_api import config, embedded_core
12
13
  from langgraph_api.config import BG_JOB_SHUTDOWN_GRACE_PERIOD_SECS
14
+ from langgraph_api.feature_flags import INMEM_USES_CORE
13
15
  from langgraph_api.runtime import queue
14
16
  from langgraph_license.validation import (
15
17
  check_license_periodically,
@@ -33,6 +35,54 @@ async def lifespan(
33
35
  cancel_event: asyncio.Event | None = None,
34
36
  with_cron_scheduler: bool = True,
35
37
  taskset: set[asyncio.Task] | None = None,
38
+ ):
39
+ async with (
40
+ _embedded_core(),
41
+ _lifespan(
42
+ app,
43
+ cancel_event=cancel_event,
44
+ with_cron_scheduler=with_cron_scheduler,
45
+ taskset=taskset,
46
+ ),
47
+ ):
48
+ yield
49
+
50
+
51
+ @asynccontextmanager
52
+ async def _embedded_core():
53
+ """Run Go core as a child process for the in-memory runtime.
54
+
55
+ LSD_GRPC_SERVER_ADDRESS is ignored: the in-memory runtime only talks to its
56
+ own SQLite core, never to an external one.
57
+ """
58
+ if not INMEM_USES_CORE:
59
+ yield
60
+ return
61
+ if os.environ.get("LSD_GRPC_SERVER_ADDRESS"):
62
+ logger.warning(
63
+ "Ignoring LSD_GRPC_SERVER_ADDRESS: the in-memory runtime runs its own core"
64
+ )
65
+ if address := os.environ.get(embedded_core.ADDRESS_ENV):
66
+ config.LSD_GRPC_SERVER_ADDRESS = address
67
+ yield
68
+ return
69
+
70
+ persist = os.getenv("LANGGRAPH_DISABLE_FILE_PERSISTENCE", "false").lower() != "true"
71
+ core = embedded_core.start(embedded_core.SQLITE_PATH if persist else None)
72
+ config.LSD_GRPC_SERVER_ADDRESS = await asyncio.to_thread(core.__enter__)
73
+ try:
74
+ yield
75
+ finally:
76
+ await asyncio.to_thread(core.__exit__, None, None, None)
77
+
78
+
79
+ @asynccontextmanager
80
+ async def _lifespan(
81
+ app: Starlette | None,
82
+ *,
83
+ cancel_event: asyncio.Event | None,
84
+ with_cron_scheduler: bool,
85
+ taskset: set[asyncio.Task] | None,
36
86
  ):
37
87
  # Import at point of use to avoid circular dependencies
38
88
  from langgraph_api import ( # noqa: PLC0415
@@ -0,0 +1,56 @@
1
+ """Internal routes for the in-memory runtime on Go core."""
2
+
3
+ import asyncio
4
+
5
+ from langgraph_grpc_common.proto import core_api_pb2 as pb
6
+ from langgraph_runtime_inmem import routes as inmem_routes
7
+
8
+ from langgraph_api import config
9
+ from langgraph_api._checkpointer._adapter import CHECKPOINTER_STACK
10
+ from langgraph_api.grpc.client import get_shared_client
11
+ from langgraph_api.grpc.ops.threads import proto_to_thread
12
+ from langgraph_api.route import ApiRequest, ApiResponse, ApiRoute
13
+
14
+
15
+ async def truncate(request: ApiRequest):
16
+ """Truncate all core data (for testing)."""
17
+ if config.USE_CUSTOM_CHECKPOINTER:
18
+ inner = getattr(CHECKPOINTER_STACK, "inner", None)
19
+ if inner is not None and hasattr(inner, "clear"):
20
+ await asyncio.to_thread(inner.clear)
21
+
22
+ client = await get_shared_client()
23
+ await client.admin.Truncate(
24
+ pb.TruncateRequest(
25
+ runs=True,
26
+ threads=True,
27
+ assistants=True,
28
+ checkpointer=True,
29
+ store=True,
30
+ )
31
+ )
32
+ return ApiResponse({"ok": True})
33
+
34
+
35
+ async def debug_get_raw_thread(request: ApiRequest):
36
+ """Return raw thread from core without decryption (for testing)."""
37
+ client = await get_shared_client()
38
+ thread = await client.threads.Get(
39
+ pb.GetThreadRequest(thread_id=pb.UUID(value=request.path_params["thread_id"]))
40
+ )
41
+ return ApiResponse(proto_to_thread(thread))
42
+
43
+
44
+ def get_internal_routes():
45
+ """Deploy routes from the Python runtime, with internal routes backed by core."""
46
+ routes = inmem_routes.get_internal_routes()
47
+ if not routes:
48
+ return routes
49
+ return [r for r in routes if not r.path.startswith("/internal/")] + [
50
+ ApiRoute(
51
+ "/internal/debug/thread/{thread_id}",
52
+ debug_get_raw_thread,
53
+ methods=["GET"],
54
+ ),
55
+ ApiRoute("/internal/truncate", truncate, methods=["POST"]),
56
+ ]
@@ -0,0 +1,44 @@
1
+ import threading
2
+ from typing import Any
3
+
4
+ from langgraph_grpc_common.store import GrpcStore
5
+
6
+ import langgraph_api.config as api_config
7
+ from langgraph_api.encryption.context import get_encryption_context
8
+ from langgraph_api.graph import resolve_embeddings
9
+
10
+ _STORE_CONFIG: api_config.StoreConfig = {}
11
+
12
+
13
+ def set_store_config(config: api_config.StoreConfig) -> None:
14
+ global _STORE_CONFIG
15
+ _STORE_CONFIG = config.copy()
16
+ if "index" not in _STORE_CONFIG or not _STORE_CONFIG["index"]:
17
+ return
18
+ _STORE_CONFIG["index"]["embed"] = resolve_embeddings(_STORE_CONFIG["index"])
19
+
20
+
21
+ _STORE = threading.local()
22
+
23
+
24
+ def start_store() -> None:
25
+ _STORE.store = GrpcStore(
26
+ api_config.LSD_GRPC_SERVER_ADDRESS,
27
+ index=_STORE_CONFIG.get("index"),
28
+ ttl=_STORE_CONFIG.get("ttl"),
29
+ encryption_context_provider=get_encryption_context
30
+ if api_config.LANGGRAPH_ENCRYPTION
31
+ else None,
32
+ )
33
+
34
+
35
+ def get_store_config() -> api_config.StoreConfig:
36
+ return _STORE_CONFIG
37
+
38
+
39
+ def Store(*args: Any, **kwargs: Any) -> GrpcStore:
40
+ if not hasattr(_STORE, "store"):
41
+ if not _STORE_CONFIG and api_config.STORE_CONFIG:
42
+ set_store_config(api_config.STORE_CONFIG)
43
+ start_store()
44
+ return _STORE.store
langgraph_api/store.py CHANGED
@@ -19,7 +19,7 @@ from langgraph_api.encryption.middleware import (
19
19
  encrypt_request,
20
20
  )
21
21
  from langgraph_api.encryption.shared import ENCRYPTION_CONTEXT_KEY
22
- from langgraph_api.feature_flags import IS_POSTGRES_BACKEND
22
+ from langgraph_api.feature_flags import IS_POSTGRES_OR_GRPC_BACKEND
23
23
  from langgraph_api.timing import profiled_import
24
24
  from langgraph_api.utils.config import run_in_executor
25
25
 
@@ -48,12 +48,12 @@ async def get_store() -> BaseStore:
48
48
  # Go core encrypts the postgres built-in store, and custom stores own their data
49
49
  # format and remain plaintext here; only the in-memory store is encrypted here.
50
50
  def _bypass_store_encryption() -> bool:
51
- return IS_POSTGRES_BACKEND or CUSTOM_STORE is not None
51
+ return IS_POSTGRES_OR_GRPC_BACKEND or CUSTOM_STORE is not None
52
52
 
53
53
 
54
54
  def _bypass_store_decryption(item: dict[str, Any]) -> bool:
55
55
  if CUSTOM_STORE is None:
56
- return IS_POSTGRES_BACKEND
56
+ return IS_POSTGRES_OR_GRPC_BACKEND
57
57
  value = item.get("value")
58
58
  return not isinstance(value, dict) or ENCRYPTION_CONTEXT_KEY not in value
59
59
 
langgraph_api/stream.py CHANGED
@@ -914,6 +914,8 @@ async def consume(
914
914
  stream_modes.add("messages")
915
915
  stream_modes.add("metadata")
916
916
  stream_modes.add("control")
917
+ # No run stream carries it, but a resumed thread stream replays it.
918
+ stream_modes.add("interrupts")
917
919
 
918
920
  if FF_ASYNC_PUBLISH_QUEUE:
919
921
  await _consume_async_queue(
@@ -1,13 +1,14 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: langgraph-api
3
- Version: 0.19.0.dev8
3
+ Version: 0.19.0.dev10
4
4
  Author-email: Will Fu-Hinthorn <will@langchain.dev>, Josh Rogers <josh@langchain.dev>, Parker Rule <parker@langchain.dev>
5
5
  License: Elastic-2.0
6
6
  License-File: LICENSE
7
7
  Requires-Python: >=3.11
8
8
  Requires-Dist: anyio>=4.14.2
9
9
  Requires-Dist: cloudpickle>=3.0.0
10
- Requires-Dist: cryptography>=50.0.0
10
+ Requires-Dist: cryptography<49,>=48.0.1; sys_platform == 'darwin' and platform_machine == 'x86_64'
11
+ Requires-Dist: cryptography>=50.0.0; sys_platform != 'darwin' or platform_machine != 'x86_64'
11
12
  Requires-Dist: grpcio-health-checking<1.82.0,>=1.81.0
12
13
  Requires-Dist: grpcio-tools==1.81.1
13
14
  Requires-Dist: grpcio<1.86.0,>=1.85.0
@@ -42,6 +43,10 @@ Requires-Dist: uvloop>=0.18.0; platform_system != 'Windows'
42
43
  Requires-Dist: watchfiles>=0.13
43
44
  Requires-Dist: websockets>=13.0
44
45
  Requires-Dist: zstandard>=0.23.0
46
+ Provides-Extra: inmem
47
+ Requires-Dist: blockbuster<2.0.0,>=1.5.24; extra == 'inmem'
48
+ Requires-Dist: langgraph-api-core-bin<0.20.0.dev0,>=0.19.0.dev0; extra == 'inmem'
49
+ Requires-Dist: langgraph>=0.5; extra == 'inmem'
45
50
  Description-Content-Type: text/markdown
46
51
 
47
52
  # LangGraph API