[PR #6522] feat: add batch_send utility function for map-reduce workflows #5097

Closed
opened 2026-02-20 17:51:13 -05:00 by yindo · 0 comments
Owner

Original Pull Request: https://github.com/langchain-ai/langgraph/pull/6522

State: closed
Merged: No


📝 Summary

This PR introduces a new convenience function batch_send() to simplify map-reduce workflows in LangGraph.

🔧 Changes Made

  • Added batch_send() function in libs/langgraph/langgraph/types.py
  • Added comprehensive unit tests in libs/langgraph/tests/test_utils.py
  • Added repository architecture documentation in REPOSITORY_DIAGRAM.md

💡 Example

Before:

def continue_to_jokes(state):
    return [Send("generate_joke", {"subject": s}) for s in state["subjects"]]

After:

from langgraph.types import batch_send

def continue_to_jokes(state):
    return batch_send("generate_joke", [{"subject": s} for s in state["subjects"]])
**Original Pull Request:** https://github.com/langchain-ai/langgraph/pull/6522 **State:** closed **Merged:** No --- ## 📝 Summary This PR introduces a new convenience function `batch_send()` to simplify map-reduce workflows in LangGraph. ## 🔧 Changes Made - Added `batch_send()` function in `libs/langgraph/langgraph/types.py` - Added comprehensive unit tests in `libs/langgraph/tests/test_utils.py` - Added repository architecture documentation in `REPOSITORY_DIAGRAM.md` ## 💡 Example **Before:** ```python def continue_to_jokes(state): return [Send("generate_joke", {"subject": s}) for s in state["subjects"]] ``` **After:** ```python from langgraph.types import batch_send def continue_to_jokes(state): return batch_send("generate_joke", [{"subject": s} for s in state["subjects"]]) ```
yindo added the pull-request label 2026-02-20 17:51:13 -05:00
yindo closed this issue 2026-02-20 17:51:13 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: langchain-ai/langgraph#5097