langgraph-api 0.12.0.dev22__py3-none-any.whl → 0.12.0.dev23__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.12.0.dev22"
1
+ __version__ = "0.12.0.dev23"
@@ -2,6 +2,7 @@
2
2
 
3
3
  from __future__ import annotations
4
4
 
5
+ import copy
5
6
  import inspect
6
7
  import typing
7
8
  from collections.abc import Callable
@@ -151,6 +152,7 @@ def is_for_execution(access_context: AccessContext) -> bool:
151
152
  def build_server_runtime(
152
153
  access_context: AccessContext,
153
154
  store: BaseStore,
155
+ context: Any | None = None,
154
156
  ) -> ServerRuntime:
155
157
  """Construct the appropriate ServerRuntime variant for the access context."""
156
158
  from langgraph_api.utils import get_auth_ctx # noqa: PLC0415
@@ -162,6 +164,8 @@ def build_server_runtime(
162
164
  access_context=access_context,
163
165
  user=user,
164
166
  store=store,
167
+ # copy.copy (not dict()) shallow-copies a dict yet preserves a dataclass/Pydantic context.
168
+ context=copy.copy(context) if context is not None else None,
165
169
  )
166
170
  return _ReadRuntime(
167
171
  access_context=access_context,
langgraph_api/graph.py CHANGED
@@ -356,6 +356,7 @@ async def get_graph(
356
356
  store: BaseStore,
357
357
  access_context: AccessContext,
358
358
  run_id: str | None = None,
359
+ context: Any | None = None,
359
360
  ) -> AsyncIterator[Pregel]:
360
361
  """Return the runnable."""
361
362
  from langgraph_api.utils import config as lg_config # noqa: PLC0415
@@ -387,7 +388,13 @@ async def get_graph(
387
388
  )
388
389
  var_child_runnable_config.set(config)
389
390
 
390
- value = invoke_factory(value, graph_id, config, server_runtime)
391
+ # Only the factory runtime carries context; the parent stays context-less.
392
+ factory_runtime = (
393
+ build_server_runtime(access_context, store, context)
394
+ if USE_RUNTIME_CONTEXT_API and context is not None
395
+ else server_runtime
396
+ )
397
+ value = invoke_factory(value, graph_id, config, factory_runtime)
391
398
  try:
392
399
  async with _generate_graph(
393
400
  value, graph_id, run_id=run_id, access_context=access_context
langgraph_api/stream.py CHANGED
@@ -187,6 +187,7 @@ async def astream_state(
187
187
  else await api_checkpointer.get_checkpointer(),
188
188
  access_context="threads.create_run",
189
189
  run_id=run_id,
190
+ context=context,
190
191
  )
191
192
  )
192
193
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: langgraph-api
3
- Version: 0.12.0.dev22
3
+ Version: 0.12.0.dev23
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,5 +1,5 @@
1
- langgraph_api/__init__.py,sha256=31NPyKqDoZwGlri-MWZ1Lg9OcNtBiCIvIQsCjSMT7uE,29
2
- langgraph_api/_factory_utils.py,sha256=5JsiJbg_YocVSryN2jwoZTg03-eyymlWMK6sKCmXwz0,5756
1
+ langgraph_api/__init__.py,sha256=D_MErKdFTUAyWjQ4kY9e3m0R7Bl3vp9JLX92YYbNmUI,29
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=smqyAoO9nIyPPQRw1IVSCh85fwoZP4PEo-5dDhxGruc,10676
5
5
  langgraph_api/cache.py,sha256=LuB3Te0UdXC8a-uEJoRHoe5XsgXulXI59f_Q6DCJNKc,13005
@@ -8,7 +8,7 @@ langgraph_api/command.py,sha256=d-k8h6H4ix1n7fSZ-Zb01NbSkEyqrD6cMKfDFXEIYEw,821
8
8
  langgraph_api/cron_scheduler.py,sha256=OwFzCwD86pfMNpfm9Z8bBS_WY9bBfDxGnq8_7wXurdA,6016
9
9
  langgraph_api/errors.py,sha256=zlMW99wAzNkz2xfik-HMkl_wMqmRFvs1j8V-_DZbAUc,2553
10
10
  langgraph_api/feature_flags.py,sha256=P7yQ9jXMHO3dPWv51iWGAVrPg3LbR9m4aCT_7t1UtZw,2624
11
- langgraph_api/graph.py,sha256=fKlnNv4Wn1ThYiRsYgT7A4EVvJssymWtI12gnNJQIVU,37734
11
+ langgraph_api/graph.py,sha256=j8MxvABzz1XPmC_2rrCuSc_LcVB8t_yV6H8dYWA_yYU,38048
12
12
  langgraph_api/http.py,sha256=7hPxKbj-xoAKcm7iucBpT5nM_hXOgGVCPbBsCD693Cw,6977
13
13
  langgraph_api/http_metrics.py,sha256=etxbZNmYxdb58DVLNkHP7S-N6njXPTiQh2OWKMaIZi8,5336
14
14
  langgraph_api/http_metrics_utils.py,sha256=sjxF7SYGTzY0Wz_G0dzatsYNnWr31S6ujej4JmBG2yo,866
@@ -29,7 +29,7 @@ langgraph_api/server.py,sha256=1eAZPim0Pkgh5oGS4EvW-_7Zh_82iGOZtR1rpX08FoA,11216
29
29
  langgraph_api/sse.py,sha256=cChZ7raQUHp8p5BreE_5wMBR8lFO0n7746sV8_HQOrc,4822
30
30
  langgraph_api/state.py,sha256=A6jx2OpcVmiFNBafjZ2tX1x6s_AhBk5EW2drd-vaqIc,4396
31
31
  langgraph_api/store.py,sha256=i-jVfWzDEmPESVofh1tNWbo0HMLiLz_BSKKV4QjN-dE,5027
32
- langgraph_api/stream.py,sha256=rJIGe8rEeS6QxQfsDKomUBRED6ZPIF-ALtx4D8Gw0JQ,33348
32
+ langgraph_api/stream.py,sha256=aojVBhTTQYnTp31dhS1EebiJyIMHuxzLUrnR74RcBuM,33377
33
33
  langgraph_api/stream_v2.py,sha256=KCIsPf6gs_jrIdZ8D2VTEi5c5p5aRNpVNhMP4kzjp2g,10824
34
34
  langgraph_api/traceblock.py,sha256=GhgAtLhAQ8Z8LHtRQq3par-rfPpRBQp2Q7WBACJq1NI,677
35
35
  langgraph_api/tracing_session.py,sha256=gmfv-BW1XRar6suVur1P4rTVKWkjElDEb2hhkBduWOs,728
@@ -236,8 +236,8 @@ langgraph_grpc_common/proto/store_pb2.py,sha256=uAYM7OcdEOK12iRcPYihC2suSeCo_Qdb
236
236
  langgraph_grpc_common/proto/store_pb2.pyi,sha256=_dcxyxV8moR6H67qU42r2h2p_Ub-PZSHs3OoS9KMdSY,27782
237
237
  langgraph_grpc_common/proto/store_pb2_grpc.py,sha256=wSD65QgFkYTkPTHcf7VhyI2FQ7UH_RgIf3vQW3VYlsM,3324
238
238
  langgraph_grpc_common/proto/store_pb2_grpc.pyi,sha256=oS1h2cDoq2OjyM8xazcmc8LwRDC5oCAD0zto2QUmPQw,2027
239
- langgraph_api-0.12.0.dev22.dist-info/METADATA,sha256=M4jOTXtygUqW6Fe7xtPKiz8_i-DAB4lQRNUTtVKza6k,4631
240
- langgraph_api-0.12.0.dev22.dist-info/WHEEL,sha256=lCkmxWfQsSc9CfIClYeavTdQeEX2toPqufh9gI35EQA,87
241
- langgraph_api-0.12.0.dev22.dist-info/entry_points.txt,sha256=hGedv8n7cgi41PypMfinwS_HfCwA7xJIfS0jAp8htV8,78
242
- langgraph_api-0.12.0.dev22.dist-info/licenses/LICENSE,sha256=ZPwVR73Biwm3sK6vR54djCrhaRiM4cAD2zvOQZV8Xis,3859
243
- langgraph_api-0.12.0.dev22.dist-info/RECORD,,
239
+ langgraph_api-0.12.0.dev23.dist-info/METADATA,sha256=flhOOukAiF3Syto5OvYb-p6dDQyQKIZxWwuBzTyoWso,4631
240
+ langgraph_api-0.12.0.dev23.dist-info/WHEEL,sha256=lCkmxWfQsSc9CfIClYeavTdQeEX2toPqufh9gI35EQA,87
241
+ langgraph_api-0.12.0.dev23.dist-info/entry_points.txt,sha256=hGedv8n7cgi41PypMfinwS_HfCwA7xJIfS0jAp8htV8,78
242
+ langgraph_api-0.12.0.dev23.dist-info/licenses/LICENSE,sha256=ZPwVR73Biwm3sK6vR54djCrhaRiM4cAD2zvOQZV8Xis,3859
243
+ langgraph_api-0.12.0.dev23.dist-info/RECORD,,