langgraph-api 0.19.0.dev1__py3-none-any.whl → 0.19.0.dev3__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.dev1"
1
+ __version__ = "0.19.0.dev3"
@@ -101,10 +101,9 @@ CHECKPOINT_MAX_BATCH_SIZE: int | None = env(
101
101
  )
102
102
  CHECKPOINT_BATCH_DELAY: float = env("CHECKPOINT_BATCH_DELAY", cast=float, default=0.0)
103
103
 
104
- RESUMABLE_STREAM_TTL_SECONDS = env(
105
- "RESUMABLE_STREAM_TTL_SECONDS",
106
- cast=int,
107
- default=120, # 2 minutes
104
+ # The Go core also reads 0 as the default.
105
+ RESUMABLE_STREAM_TTL_SECONDS = (
106
+ env("RESUMABLE_STREAM_TTL_SECONDS", cast=int, default=120) or 120 # 2 minutes
108
107
  )
109
108
 
110
109
 
@@ -138,6 +137,7 @@ AES_JSON_DISALLOWED_KEYS = frozenset(
138
137
  "langgraph_plan",
139
138
  "langgraph_host",
140
139
  "langgraph_api_url",
140
+ "langgraph_graph_load_ms",
141
141
  "langgraph_request_id",
142
142
  "langgraph_auth_user_id",
143
143
  "langgraph_auth_permissions",
@@ -201,9 +201,19 @@ def _validate_aes_rotation(
201
201
 
202
202
  _validate_aes_rotation(PREFER_GRPC_CHECKPOINTER, is_postgres=IS_POSTGRES_BACKEND)
203
203
 
204
+ LANGGRAPH_CLOUD_LICENSE_KEY = env("LANGGRAPH_CLOUD_LICENSE_KEY", cast=str, default="")
205
+
206
+ # When true, the Go core-server owns Postgres schema setup (DB migrations +
207
+ # vector index)
208
+ DB_MIGRATION_BY_CORE_API = env("DB_MIGRATION_BY_CORE_API", cast=bool, default=False)
209
+
204
210
  # redis
205
211
  # Not in public docs: infrastructure, set by platform
206
- REDIS_URI = env("REDIS_URI_CUSTOM", cast=str, default="") or env("REDIS_URI", cast=str)
212
+ REDIS_URI = env("REDIS_URI_CUSTOM", cast=str, default="") or (
213
+ env("REDIS_URI", cast=str, default="")
214
+ if DB_MIGRATION_BY_CORE_API and not LANGGRAPH_CLOUD_LICENSE_KEY
215
+ else env("REDIS_URI", cast=str)
216
+ )
207
217
  REDIS_CLUSTER = env("REDIS_CLUSTER", cast=bool, default=False)
208
218
  AGENT_REDIS_IAM_AUTH_PROVIDER = env(
209
219
  "AGENT_REDIS_IAM_AUTH_PROVIDER", cast=str, default=""
@@ -342,9 +352,6 @@ WEBHOOKS_ENABLED = HTTP_CONFIG and HTTP_CONFIG.get("disable_webhooks")
342
352
  STORE_CONFIG = env(
343
353
  "LANGGRAPH_STORE", cast=_parse.parse_schema(StoreConfig), default=None
344
354
  )
345
- # When true, the Go core-server owns Postgres schema setup (DB migrations +
346
- # vector index)
347
- DB_MIGRATION_BY_CORE_API = env("DB_MIGRATION_BY_CORE_API", cast=bool, default=False)
348
355
 
349
356
 
350
357
  def _validate_mount_prefix(mount_prefix: str | None) -> str | None:
@@ -662,8 +669,6 @@ WEBHOOKS_CONFIG = env(
662
669
 
663
670
  # license
664
671
 
665
- LANGGRAPH_CLOUD_LICENSE_KEY = env("LANGGRAPH_CLOUD_LICENSE_KEY", cast=str, default="")
666
-
667
672
  # Products that are built on top of langgraph-api can be configured
668
673
  # to check for additional claims in the LangSmith license key. By default,
669
674
  # no additional claims are checked. The `lgp_enabled` claim is always
langgraph_api/stream.py CHANGED
@@ -1,4 +1,5 @@
1
1
  import asyncio
2
+ import time
2
3
  import uuid
3
4
  from collections.abc import AsyncIterator, Callable
4
5
  from contextlib import AsyncExitStack, aclosing, asynccontextmanager, suppress
@@ -192,19 +193,21 @@ async def astream_state(
192
193
  # Remove the internal marker before the graph receives or persists the configuration.
193
194
  context_provided_by_caller = configurable.pop("__context_provided__", False)
194
195
  stack = AsyncExitStack()
196
+ store = await api_store.get_store()
197
+ checkpointer = None if temporary else await api_checkpointer.get_checkpointer()
198
+ graph_load_start = time.perf_counter()
195
199
  graph = await stack.enter_async_context(
196
200
  get_graph(
197
201
  configurable["graph_id"],
198
202
  config,
199
- store=(await api_store.get_store()),
200
- checkpointer=None
201
- if temporary
202
- else await api_checkpointer.get_checkpointer(),
203
+ store=store,
204
+ checkpointer=checkpointer,
203
205
  access_context="threads.create_run",
204
206
  run_id=run_id,
205
207
  context=context,
206
208
  )
207
209
  )
210
+ graph_load_ms = round((time.perf_counter() - graph_load_start) * 1000, 2)
208
211
 
209
212
  # Filter context with the request's authentication context when the graph is remote.
210
213
  if context and USE_RUNTIME_CONTEXT_API:
@@ -294,8 +297,11 @@ async def astream_state(
294
297
  config["metadata"]["langgraph_plan"] = PLAN
295
298
  config["metadata"]["langgraph_host"] = HOST
296
299
  config["metadata"]["langgraph_api_url"] = USER_API_URL
297
- # attach node counter
298
300
  if not is_remote_pregel:
301
+ # For remote (JS) graphs this would only time building the proxy, not
302
+ # the sidecar's graph load.
303
+ config["metadata"]["langgraph_graph_load_ms"] = graph_load_ms
304
+ # attach node counter
299
305
  configurable["__pregel_node_finished"] = incr_nodes
300
306
 
301
307
  # attach run_id to config
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: langgraph-api
3
- Version: 0.19.0.dev1
3
+ Version: 0.19.0.dev3
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
@@ -1,4 +1,4 @@
1
- langgraph_api/__init__.py,sha256=M3VEOvigObbwk6P59vFF1BinDCBC8ZKVvjJQebbGyB4,28
1
+ langgraph_api/__init__.py,sha256=VBDEIy7Vb-IrNwLGaSF_SAR_DuCR75O5rU9DdR47kpo,28
2
2
  langgraph_api/_factory_utils.py,sha256=_FqW0olMu2PGLsnRq0ylt3a4jDCe12YIFHExMXI6Nyo,5976
3
3
  langgraph_api/asgi_transport.py,sha256=XApY3lIWBZTMbbsl8dDJzl0cLGirmAGE0SifqZUnXvs,11896
4
4
  langgraph_api/asyncio.py,sha256=uC6et0GgUd3YHGMOw31bldbIvo0_8BTeiLLM74TZDlU,12742
@@ -33,7 +33,7 @@ langgraph_api/server.py,sha256=9WfBir5cgkaO-mUwIuv-XsteR4aTuSiKevhW8vXYt_Y,11262
33
33
  langgraph_api/sse.py,sha256=wF80kUI6KOPX7SATUvRxIAwpoJFN5rrien9FY1dRSgE,6477
34
34
  langgraph_api/state.py,sha256=Py8HG8k7u0FRAj4Ok89_uR9GerkyeFm90gSMTbWWQX0,8356
35
35
  langgraph_api/store.py,sha256=OXcdQSVCDKOzfS8S2aJHXbfuI5iYRoQBiW9WYKnCyx8,7122
36
- langgraph_api/stream.py,sha256=Xh-CSbp54z667hOusqm6uzeMfB41t4LqUUMHB_V326c,37338
36
+ langgraph_api/stream.py,sha256=L_yiFG2b-h3zpmBJ9W4KAg-ruatF88-drBXv20oinrQ,37683
37
37
  langgraph_api/stream_v2.py,sha256=AieeCAXQsthy9n6crCibMB7unbN1W_o1xkpJ2v11RSY,10822
38
38
  langgraph_api/traceblock.py,sha256=GhgAtLhAQ8Z8LHtRQq3par-rfPpRBQp2Q7WBACJq1NI,677
39
39
  langgraph_api/tracing_session.py,sha256=gmfv-BW1XRar6suVur1P4rTVKWkjElDEb2hhkBduWOs,728
@@ -86,7 +86,7 @@ langgraph_api/auth/studio_user.py,sha256=Lx3eMsRA8gxZ3--ApL09hDW84A6qIncaZoBZjSg
86
86
  langgraph_api/auth/langsmith/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
87
87
  langgraph_api/auth/langsmith/backend.py,sha256=gaSuZC8JO32XHe8IdqttNpBGO6PCVrtXaq1Negc7vX0,3857
88
88
  langgraph_api/auth/langsmith/client.py,sha256=79kwCVeHU64nsHsxWipfZhf44lM6vfs2nlfTxlJF6LU,4142
89
- langgraph_api/config/__init__.py,sha256=AwJY2YAHEp1cC21osYzFek6tWihfAWAzeKF6Xde9edI,34154
89
+ langgraph_api/config/__init__.py,sha256=-AysHspSuA4xTxk7jKcJkU955loGQnYVrKP9m7sywGo,34357
90
90
  langgraph_api/config/_parse.py,sha256=RpfZgFAPJlRMv13AzGr3kAYbIrqHcgjzO8IgeboTw4A,3922
91
91
  langgraph_api/config/schemas.py,sha256=wRiUzjtdls89XPIrNsPfuJX2iBLsde_QE2mVzjEQCzU,21856
92
92
  langgraph_api/encryption/__init__.py,sha256=gaCZ00CocSbqSqrDn6XJHaSp2CZCnC8qnrD9G4fbzyI,363
@@ -267,8 +267,8 @@ langgraph_grpc_common/proto/store_pb2.py,sha256=VWJ7wtzL9pVmZZKbxMzOzCoiFn58bB2g
267
267
  langgraph_grpc_common/proto/store_pb2.pyi,sha256=atXejijuYEb9tE0stGQdZcfA9ucMFj-ytTMwvkxwviM,29322
268
268
  langgraph_grpc_common/proto/store_pb2_grpc.py,sha256=Kyt8eV2NXkjh3be_BYytGdD19kNf74961cruonMvCrw,3300
269
269
  langgraph_grpc_common/proto/store_pb2_grpc.pyi,sha256=oS1h2cDoq2OjyM8xazcmc8LwRDC5oCAD0zto2QUmPQw,2027
270
- langgraph_api-0.19.0.dev1.dist-info/METADATA,sha256=6E3a5A5326VS22Ix2iEEVhWS8kWBeEfSD7_kqWSv6BU,5939
271
- langgraph_api-0.19.0.dev1.dist-info/WHEEL,sha256=2iZrJkDIkeDh0k9SikKMqFuRP-ua6mb4Ir1AsER4BEw,87
272
- langgraph_api-0.19.0.dev1.dist-info/entry_points.txt,sha256=hGedv8n7cgi41PypMfinwS_HfCwA7xJIfS0jAp8htV8,78
273
- langgraph_api-0.19.0.dev1.dist-info/licenses/LICENSE,sha256=SCVQGLQfwOllsRFa9-Z3m8IYu4pnR9Vh2oANUCJiKqI,3860
274
- langgraph_api-0.19.0.dev1.dist-info/RECORD,,
270
+ langgraph_api-0.19.0.dev3.dist-info/METADATA,sha256=dNbUDQ0aFkHsreCVgrlp61xg7rwRnbkjX6UlMQDNjkk,5939
271
+ langgraph_api-0.19.0.dev3.dist-info/WHEEL,sha256=2iZrJkDIkeDh0k9SikKMqFuRP-ua6mb4Ir1AsER4BEw,87
272
+ langgraph_api-0.19.0.dev3.dist-info/entry_points.txt,sha256=hGedv8n7cgi41PypMfinwS_HfCwA7xJIfS0jAp8htV8,78
273
+ langgraph_api-0.19.0.dev3.dist-info/licenses/LICENSE,sha256=SCVQGLQfwOllsRFa9-Z3m8IYu4pnR9Vh2oANUCJiKqI,3860
274
+ langgraph_api-0.19.0.dev3.dist-info/RECORD,,