Skip to content

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

Open
@lightsofapollo

Description

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

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions