[PR #6410] docs(langgraph): Fix docstring code examples of task function #5019

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

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

State: closed
Merged: Yes


Hi all,
I found out that the sync and async code examples of the task function in libs/langgraph/langgraph/func/__init__.py have a typo:

    Example: Sync Task
        ```python
        from langgraph.func import entrypoint, task


        @task
        def add_one(a: int) -> int:
            return a + 1


        @entrypoint()
        def add_one(numbers: list[int]) -> list[int]:
            futures = [add_one(n) for n in numbers]
            results = [f.result() for f in futures]
            return results


        # Call the entrypoint
        add_one.invoke([1, 2, 3])  # Returns [2, 3, 4]
        ```

Both task and entrypoint functions have the same name which gives an error.

This is a small PR to fix this

**Original Pull Request:** https://github.com/langchain-ai/langgraph/pull/6410 **State:** closed **Merged:** Yes --- Hi all, I found out that the sync and async code examples of the `task` function in `libs/langgraph/langgraph/func/__init__.py` have a typo: ``` Example: Sync Task ```python from langgraph.func import entrypoint, task @task def add_one(a: int) -> int: return a + 1 @entrypoint() def add_one(numbers: list[int]) -> list[int]: futures = [add_one(n) for n in numbers] results = [f.result() for f in futures] return results # Call the entrypoint add_one.invoke([1, 2, 3]) # Returns [2, 3, 4] ``` ``` Both task and entrypoint functions have the same name which gives an error. This is a small PR to fix this
yindo added the pull-request label 2026-02-20 17:51:06 -05:00
yindo closed this issue 2026-02-20 17:51:06 -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#5019