langgraph-executor 0.0.1a3__py3-none-any.whl → 0.0.1a5__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.
@@ -1 +1 @@
1
- __version__ = "0.0.1a3"
1
+ __version__ = "0.0.1a5"
@@ -3,7 +3,14 @@ import contextlib
3
3
  import functools
4
4
  import logging
5
5
  import uuid
6
- from collections.abc import AsyncIterator, Callable, Collection, Iterator, Sequence
6
+ from collections.abc import (
7
+ AsyncIterator,
8
+ Awaitable,
9
+ Callable,
10
+ Collection,
11
+ Iterator,
12
+ Sequence,
13
+ )
7
14
  from typing import Any, Protocol, cast
8
15
 
9
16
  import grpc
@@ -17,6 +24,7 @@ from langgraph.pregel import Pregel
17
24
  from langgraph.pregel._algo import apply_writes
18
25
  from langgraph.pregel._checkpoint import channels_from_checkpoint
19
26
  from langgraph.pregel._retry import arun_with_retry
27
+ from langgraph.store.base import BaseStore
20
28
  from langgraph.types import PregelExecutableTask
21
29
 
22
30
  from langgraph_executor.common import (
@@ -74,6 +82,7 @@ class LangGraphExecutorServicer(executor_pb2_grpc.LangGraphExecutorServicer):
74
82
  ]
75
83
  | None = None,
76
84
  on_custom: Callable[[Any], None] | None = None,
85
+ get_store: Callable[[], Awaitable[BaseStore]] | None = None,
77
86
  ):
78
87
  """Initialize the servicer with compiled graphs.
79
88
 
@@ -93,6 +102,7 @@ class LangGraphExecutorServicer(executor_pb2_grpc.LangGraphExecutorServicer):
93
102
  self._graph_definition_cache: dict[str, executor_pb2.GetGraphResponse] = {}
94
103
  self.on_message = on_message
95
104
  self.on_custom = on_custom
105
+ self.get_store = get_store
96
106
 
97
107
  async def ListGraphs(
98
108
  self, request: Any, context: grpc.aio.ServicerContext
@@ -119,7 +129,7 @@ class LangGraphExecutorServicer(executor_pb2_grpc.LangGraphExecutorServicer):
119
129
  if (resp := self._graph_definition_cache.get(name)) is not None:
120
130
  return resp
121
131
  async with self.get_graph(name, RunnableConfig()) as graph:
122
- graph_definition = extract_graph(graph)
132
+ graph_definition = extract_graph(graph, name=name)
123
133
 
124
134
  resp = executor_pb2.GetGraphResponse(
125
135
  graph_definition=graph_definition,
@@ -185,6 +195,7 @@ class LangGraphExecutorServicer(executor_pb2_grpc.LangGraphExecutorServicer):
185
195
  try:
186
196
  request = await _get_init_request(request_iterator)
187
197
  config = reconstruct_config(request.task.config)
198
+ store = await self.get_store() if self.get_store is not None else None
188
199
  async with self.get_graph(request.graph_name, config) as graph:
189
200
  stream_messages = "messages" in request.stream_modes
190
201
  stream_custom = "custom" in request.stream_modes
@@ -200,7 +211,10 @@ class LangGraphExecutorServicer(executor_pb2_grpc.LangGraphExecutorServicer):
200
211
  )
201
212
 
202
213
  task = reconstruct_task(
203
- request, graph, custom_stream_writer=custom_stream_writer
214
+ request,
215
+ graph,
216
+ custom_stream_writer=custom_stream_writer,
217
+ store=store,
204
218
  )
205
219
  if stream_messages:
206
220
  # Create and inject callback handler
@@ -117,14 +117,14 @@ def extract_trigger_to_nodes(
117
117
  return trigger_map
118
118
 
119
119
 
120
- def extract_graph(graph: Pregel) -> graph_pb2.GraphDefinition:
120
+ def extract_graph(graph: Pregel, name: str | None = None) -> graph_pb2.GraphDefinition:
121
121
  """Extract graph information from a compiled LangGraph graph.
122
122
 
123
123
  Returns a protobuf message that contains all relevant orchestration information about the graph
124
124
  """
125
125
  # Handle input_channels and output_channels oneof
126
126
  graph_def = graph_pb2.GraphDefinition(
127
- name=str(graph.name),
127
+ name=name or str(graph.name),
128
128
  channels=extract_channels(graph.channels),
129
129
  interrupt_before_nodes=list(graph.interrupt_before_nodes),
130
130
  interrupt_after_nodes=list(graph.interrupt_after_nodes),
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: langgraph-executor
3
- Version: 0.0.1a3
3
+ Version: 0.0.1a5
4
4
  Summary: LangGraph python RPC server executable by the langgraph-go orchestrator.
5
5
  Requires-Python: >=3.11
6
6
  Requires-Dist: grpcio>=1.73.1
@@ -1,10 +1,10 @@
1
- langgraph_executor/__init__.py,sha256=dgul-AYnyeoAY6LEjAiyLevJTWAk_zu9Q7ZsFLlpg_I,24
1
+ langgraph_executor/__init__.py,sha256=hnxg6uqHJBODcRxoMFMM27CIubX0_co8v5RtgPUluHE,24
2
2
  langgraph_executor/common.py,sha256=w75Bqbrj5LOtiWoOOdIi45yVB05xYXDAnokwg7MgDQE,13688
3
3
  langgraph_executor/example.py,sha256=TcfxgC9VfpZFliWnuVdJMllCDa8ji7vrSCRWnmdsUA8,900
4
4
  langgraph_executor/execute_task.py,sha256=_m-WyVODhShI29qzkK0DXSPoTY4E_izbuaT7F_fVZVw,7262
5
5
  langgraph_executor/executor.py,sha256=oUg6q8WWjAIwuh2ik76IbCPMKfmegT5ePZsWFnvR4WE,5296
6
- langgraph_executor/executor_base.py,sha256=xDbtX9r9lpmxDnF0yfKX6i_tXCgf6nss6qdXAHTn_c4,19253
7
- langgraph_executor/extract_graph.py,sha256=f7NNeZigRQlTAYg_-mV8eBgQ9q8kuThCDwLjRO6wReQ,6365
6
+ langgraph_executor/executor_base.py,sha256=-7oIHIQOik9c7kjGnDj2ScQdulAgoGhkIw0Ku34Sfu4,19608
7
+ langgraph_executor/extract_graph.py,sha256=RnHgIqJBYJ05rjjanpPNSWUaSqJ66c4M0wfcn0WTAGk,6398
8
8
  langgraph_executor/info_logger.py,sha256=kgoVnMxm_aloHal89NHfH_Qb9eixrqD0dHmgnrm_vL4,3110
9
9
  langgraph_executor/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
10
10
  langgraph_executor/server.py,sha256=EVwZjsO2S0qhhU9C_4e85gfrxyOCo3H72bBi28vSFIw,5134
@@ -27,6 +27,6 @@ langgraph_executor/pb/types_pb2.py,sha256=rUboWBthlLM-iJOmZZta-HSekwTNFuXfWLaYHe
27
27
  langgraph_executor/pb/types_pb2.pyi,sha256=tBX4LzmfWZ-IYscIeAEBTDC02GWWKEAQVB2JPNHChDc,40957
28
28
  langgraph_executor/pb/types_pb2_grpc.py,sha256=EPv87wCc-6BNJ2xTNcb9d3ictDerK5cBt7qhd7EmJiQ,886
29
29
  langgraph_executor/pb/types_pb2_grpc.pyi,sha256=Dl8kkjhqb6F1Kt24mcFg7ppish4iKVfjRiiBxEjsMMA,413
30
- langgraph_executor-0.0.1a3.dist-info/METADATA,sha256=VBmO8nlI-vAKBpxE5q2_gbTwke-rHuMLNE2EyzqHzKA,433
31
- langgraph_executor-0.0.1a3.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
32
- langgraph_executor-0.0.1a3.dist-info/RECORD,,
30
+ langgraph_executor-0.0.1a5.dist-info/METADATA,sha256=tYs_bT3h2J-eEmU5yewVpNhIei9cWhztP6e_iR70QmY,433
31
+ langgraph_executor-0.0.1a5.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
32
+ langgraph_executor-0.0.1a5.dist-info/RECORD,,