Typings for coroutine returned instead of value returned when awaiting async task (functional api) #436

Closed
opened 2026-02-20 17:40:07 -05:00 by yindo · 1 comment
Owner

Originally created by @lightsofapollo on GitHub (Feb 4, 2025).

Originally assigned to: @casparb on GitHub.

Checked other resources

  • This is a bug, not a usage question. For questions, please use GitHub Discussions.
  • I added a clear and detailed title that summarizes the issue.
  • I read what a minimal reproducible example is (https://stackoverflow.com/help/minimal-reproducible-example).
  • I included a self-contained, minimal example that demonstrates the issue INCLUDING all the relevant imports. The code run AS IS to reproduce the issue.

Example Code

@task
async def retrieve():
    return "foo"

Error Message and Stack Trace (if applicable)


Description

Using langggraph functional api with async functions I am getting typing errors. It seems to always return a coroutine instead of the final value when I await it.

Image Image Image

System Info

System Information

OS: Darwin
OS Version: Darwin Kernel Version 24.1.0: Thu Oct 10 21:03:11 PDT 2024; root:xnu-11215.41.3~2/RELEASE_ARM64_T6020
Python Version: 3.12.8 (main, Jan 5 2025, 06:55:30) [Clang 19.1.6 ]

Package Information

langchain_core: 0.3.33
langchain: 0.3.17
langchain_community: 0.3.15
langsmith: 0.3.1
langchain_anthropic: 0.3.4
langchain_experimental: 0.3.4
langchain_google_genai: 2.0.9
langchain_openai: 0.3.2
langchain_text_splitters: 0.3.5
langgraph_sdk: 0.1.51

Optional packages not installed

langserve

Other Dependencies

aiohttp: 3.11.11
anthropic: 0.45.0
async-timeout: Installed. No version info available.
dataclasses-json: 0.6.7
defusedxml: 0.7.1
filetype: 1.2.0
google-generativeai: 0.8.4
httpx: 0.28.1
httpx-sse: 0.4.0
jsonpatch: 1.33
langsmith-pyo3: Installed. No version info available.
numpy: 1.26.4
openai: 1.61.0
orjson: 3.10.15
packaging: 24.2
pydantic: 2.10.6
pydantic-settings: 2.7.1
pytest: Installed. No version info available.
PyYAML: 6.0.2
requests: 2.32.3
requests-toolbelt: 1.0.0
rich: 13.9.4
SQLAlchemy: 2.0.37
tenacity: 9.0.0
tiktoken: 0.8.0
typing-extensions: 4.12.2
zstandard: 0.23.0

Originally created by @lightsofapollo on GitHub (Feb 4, 2025). Originally assigned to: @casparb on GitHub. ### Checked other resources - [x] This is a bug, not a usage question. For questions, please use GitHub Discussions. - [x] I added a clear and detailed title that summarizes the issue. - [x] I read what a minimal reproducible example is (https://stackoverflow.com/help/minimal-reproducible-example). - [x] I included a self-contained, minimal example that demonstrates the issue INCLUDING all the relevant imports. The code run AS IS to reproduce the issue. ### Example Code ```python @task async def retrieve(): return "foo" ``` ### Error Message and Stack Trace (if applicable) ```shell ``` ### Description Using langggraph functional api with async functions I am getting typing errors. It seems to always return a coroutine instead of the final value when I await it. <img width="666" alt="Image" src="https://github.com/user-attachments/assets/7b3503bc-e6d6-4458-b3ce-75cdd77a7d6c" /> <img width="440" alt="Image" src="https://github.com/user-attachments/assets/ab661bd6-2e6c-4368-857d-cc50cf3dc4f0" /> <img width="692" alt="Image" src="https://github.com/user-attachments/assets/2f7af96b-a8aa-46aa-a6bc-8110ac57724b" /> ### System Info System Information ------------------ > OS: Darwin > OS Version: Darwin Kernel Version 24.1.0: Thu Oct 10 21:03:11 PDT 2024; root:xnu-11215.41.3~2/RELEASE_ARM64_T6020 > Python Version: 3.12.8 (main, Jan 5 2025, 06:55:30) [Clang 19.1.6 ] Package Information ------------------- > langchain_core: 0.3.33 > langchain: 0.3.17 > langchain_community: 0.3.15 > langsmith: 0.3.1 > langchain_anthropic: 0.3.4 > langchain_experimental: 0.3.4 > langchain_google_genai: 2.0.9 > langchain_openai: 0.3.2 > langchain_text_splitters: 0.3.5 > langgraph_sdk: 0.1.51 Optional packages not installed ------------------------------- > langserve Other Dependencies ------------------ > aiohttp: 3.11.11 > anthropic: 0.45.0 > async-timeout: Installed. No version info available. > dataclasses-json: 0.6.7 > defusedxml: 0.7.1 > filetype: 1.2.0 > google-generativeai: 0.8.4 > httpx: 0.28.1 > httpx-sse: 0.4.0 > jsonpatch: 1.33 > langsmith-pyo3: Installed. No version info available. > numpy: 1.26.4 > openai: 1.61.0 > orjson: 3.10.15 > packaging: 24.2 > pydantic: 2.10.6 > pydantic-settings: 2.7.1 > pytest: Installed. No version info available. > PyYAML: 6.0.2 > requests: 2.32.3 > requests-toolbelt: 1.0.0 > rich: 13.9.4 > SQLAlchemy: 2.0.37 > tenacity: 9.0.0 > tiktoken: 0.8.0 > typing-extensions: 4.12.2 > zstandard: 0.23.0
yindo closed this issue 2026-02-20 17:40:07 -05:00
Author
Owner

@sydney-runkle commented on GitHub (Jun 11, 2025):

Not able to repro this anymore, feel free to ping or open a new issue if you're still experiencing this type checking issue.

@sydney-runkle commented on GitHub (Jun 11, 2025): Not able to repro this anymore, feel free to ping or open a new issue if you're still experiencing this type checking issue.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: langchain-ai/langgraph#436