langgraph-executor 0.0.1a2__tar.gz → 0.0.1a3__tar.gz

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 (34) hide show
  1. {langgraph_executor-0.0.1a2 → langgraph_executor-0.0.1a3}/PKG-INFO +1 -1
  2. langgraph_executor-0.0.1a3/langgraph_executor/__init__.py +1 -0
  3. {langgraph_executor-0.0.1a2 → langgraph_executor-0.0.1a3}/langgraph_executor/executor_base.py +27 -3
  4. langgraph_executor-0.0.1a2/langgraph_executor/__init__.py +0 -1
  5. {langgraph_executor-0.0.1a2 → langgraph_executor-0.0.1a3}/.gitignore +0 -0
  6. {langgraph_executor-0.0.1a2 → langgraph_executor-0.0.1a3}/README.md +0 -0
  7. {langgraph_executor-0.0.1a2 → langgraph_executor-0.0.1a3}/langgraph_executor/common.py +0 -0
  8. {langgraph_executor-0.0.1a2 → langgraph_executor-0.0.1a3}/langgraph_executor/example.py +0 -0
  9. {langgraph_executor-0.0.1a2 → langgraph_executor-0.0.1a3}/langgraph_executor/execute_task.py +0 -0
  10. {langgraph_executor-0.0.1a2 → langgraph_executor-0.0.1a3}/langgraph_executor/executor.py +0 -0
  11. {langgraph_executor-0.0.1a2 → langgraph_executor-0.0.1a3}/langgraph_executor/extract_graph.py +0 -0
  12. {langgraph_executor-0.0.1a2 → langgraph_executor-0.0.1a3}/langgraph_executor/info_logger.py +0 -0
  13. {langgraph_executor-0.0.1a2 → langgraph_executor-0.0.1a3}/langgraph_executor/pb/__init__.py +0 -0
  14. {langgraph_executor-0.0.1a2 → langgraph_executor-0.0.1a3}/langgraph_executor/pb/executor_pb2.py +0 -0
  15. {langgraph_executor-0.0.1a2 → langgraph_executor-0.0.1a3}/langgraph_executor/pb/executor_pb2.pyi +0 -0
  16. {langgraph_executor-0.0.1a2 → langgraph_executor-0.0.1a3}/langgraph_executor/pb/executor_pb2_grpc.py +0 -0
  17. {langgraph_executor-0.0.1a2 → langgraph_executor-0.0.1a3}/langgraph_executor/pb/executor_pb2_grpc.pyi +0 -0
  18. {langgraph_executor-0.0.1a2 → langgraph_executor-0.0.1a3}/langgraph_executor/pb/graph_pb2.py +0 -0
  19. {langgraph_executor-0.0.1a2 → langgraph_executor-0.0.1a3}/langgraph_executor/pb/graph_pb2.pyi +0 -0
  20. {langgraph_executor-0.0.1a2 → langgraph_executor-0.0.1a3}/langgraph_executor/pb/graph_pb2_grpc.py +0 -0
  21. {langgraph_executor-0.0.1a2 → langgraph_executor-0.0.1a3}/langgraph_executor/pb/graph_pb2_grpc.pyi +0 -0
  22. {langgraph_executor-0.0.1a2 → langgraph_executor-0.0.1a3}/langgraph_executor/pb/runtime_pb2.py +0 -0
  23. {langgraph_executor-0.0.1a2 → langgraph_executor-0.0.1a3}/langgraph_executor/pb/runtime_pb2.pyi +0 -0
  24. {langgraph_executor-0.0.1a2 → langgraph_executor-0.0.1a3}/langgraph_executor/pb/runtime_pb2_grpc.py +0 -0
  25. {langgraph_executor-0.0.1a2 → langgraph_executor-0.0.1a3}/langgraph_executor/pb/runtime_pb2_grpc.pyi +0 -0
  26. {langgraph_executor-0.0.1a2 → langgraph_executor-0.0.1a3}/langgraph_executor/pb/types_pb2.py +0 -0
  27. {langgraph_executor-0.0.1a2 → langgraph_executor-0.0.1a3}/langgraph_executor/pb/types_pb2.pyi +0 -0
  28. {langgraph_executor-0.0.1a2 → langgraph_executor-0.0.1a3}/langgraph_executor/pb/types_pb2_grpc.py +0 -0
  29. {langgraph_executor-0.0.1a2 → langgraph_executor-0.0.1a3}/langgraph_executor/pb/types_pb2_grpc.pyi +0 -0
  30. {langgraph_executor-0.0.1a2 → langgraph_executor-0.0.1a3}/langgraph_executor/py.typed +0 -0
  31. {langgraph_executor-0.0.1a2 → langgraph_executor-0.0.1a3}/langgraph_executor/server.py +0 -0
  32. {langgraph_executor-0.0.1a2 → langgraph_executor-0.0.1a3}/langgraph_executor/setup.sh +0 -0
  33. {langgraph_executor-0.0.1a2 → langgraph_executor-0.0.1a3}/langgraph_executor/stream_utils.py +0 -0
  34. {langgraph_executor-0.0.1a2 → langgraph_executor-0.0.1a3}/pyproject.toml +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: langgraph-executor
3
- Version: 0.0.1a2
3
+ Version: 0.0.1a3
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
@@ -0,0 +1 @@
1
+ __version__ = "0.0.1a3"
@@ -65,6 +65,15 @@ class LangGraphExecutorServicer(executor_pb2_grpc.LangGraphExecutorServicer):
65
65
  subgraph_map: dict[str, str],
66
66
  get_graph: GetGraph,
67
67
  logger: Logger | None = None,
68
+ on_message: Callable[
69
+ [
70
+ BaseMessageChunk,
71
+ dict[str, Any],
72
+ ],
73
+ None,
74
+ ]
75
+ | None = None,
76
+ on_custom: Callable[[Any], None] | None = None,
68
77
  ):
69
78
  """Initialize the servicer with compiled graphs.
70
79
 
@@ -82,6 +91,8 @@ class LangGraphExecutorServicer(executor_pb2_grpc.LangGraphExecutorServicer):
82
91
  self.get_graph = get_graph
83
92
  _patch_base_message_with_ids()
84
93
  self._graph_definition_cache: dict[str, executor_pb2.GetGraphResponse] = {}
94
+ self.on_message = on_message
95
+ self.on_custom = on_custom
85
96
 
86
97
  async def ListGraphs(
87
98
  self, request: Any, context: grpc.aio.ServicerContext
@@ -181,7 +192,9 @@ class LangGraphExecutorServicer(executor_pb2_grpc.LangGraphExecutorServicer):
181
192
  stream_queue = asyncio.Queue()
182
193
 
183
194
  custom_stream_writer = (
184
- _create_custom_stream_writer(stream_queue, self.logger)
195
+ _create_custom_stream_writer(
196
+ stream_queue, self.logger, on_custom=self.on_custom
197
+ )
185
198
  if stream_custom
186
199
  else None
187
200
  )
@@ -196,6 +209,7 @@ class LangGraphExecutorServicer(executor_pb2_grpc.LangGraphExecutorServicer):
196
209
  stream_callback,
197
210
  logger=self.logger,
198
211
  stream_queue=stream_queue,
212
+ on_message=self.on_message,
199
213
  ),
200
214
  task.id,
201
215
  )
@@ -362,13 +376,16 @@ async def _run_task(
362
376
 
363
377
  def stream_callback(
364
378
  message: BaseMessageChunk,
365
- metadata: dict,
379
+ metadata: dict[str, Any],
366
380
  *,
367
381
  logger: Logger,
368
382
  stream_queue: asyncio.Queue[executor_pb2.ExecuteTaskResponse],
383
+ on_message: Callable[[BaseMessageChunk, dict[str, Any]], None] | None = None,
369
384
  ):
370
385
  """Callback to capture stream chunks and queue them."""
371
386
  try:
387
+ if on_message is not None:
388
+ on_message(message, metadata)
372
389
  stream_queue.put_nowait(
373
390
  executor_pb2.ExecuteTaskResponse(
374
391
  message_or_message_chunk=_extract_output_message(message)
@@ -378,12 +395,19 @@ def stream_callback(
378
395
  logger.warning(f"Failed to create stream chunk: {e}", exc_info=True)
379
396
 
380
397
 
381
- def _create_custom_stream_writer(stream_queue: asyncio.Queue[Any], logger: Logger):
398
+ def _create_custom_stream_writer(
399
+ stream_queue: asyncio.Queue[Any],
400
+ logger: Logger,
401
+ *,
402
+ on_custom: Callable[[Any], None] | None = None,
403
+ ):
382
404
  """Create a proper stream_writer function for custom mode (like langgraph does)."""
383
405
 
384
406
  def stream_writer(content):
385
407
  """Custom stream writer that creates CustomStreamEvent messages."""
386
408
  try:
409
+ if on_custom is not None:
410
+ on_custom(content)
387
411
  # Create payload struct (like langgraph does)
388
412
  payload = Struct()
389
413
  if isinstance(content, str):
@@ -1 +0,0 @@
1
- __version__ = "0.0.1a2"