ImportError: cannot import name 'thread_ttl' from 'langgraph_api' #1136

Closed
opened 2026-02-20 17:43:12 -05:00 by yindo · 4 comments
Owner

Originally created by @wenb on GitHub (Feb 5, 2026).

Checked other resources

  • This is a bug, not a usage question.
  • I added a clear and descriptive title that summarizes this issue.
  • I used the GitHub search to find a similar question and didn't find it.
  • I am sure that this is a bug in LangGraph rather than my code.
  • The bug is not resolved by updating to the latest stable version of LangGraph (or the specific integration package).
  • This is not related to the langchain-community package.
  • I posted a self-contained, minimal, reproducible example. A maintainer can copy it and run it AS IS.

Reproduction Steps / Example Code (Python)

python3.11/site-packages/langgraph_runtime_inmem/lifespan.py", line 32, in lifespan
    from langgraph_api import __version__, feature_flags, graph, thread_ttl
ImportError: cannot import name 'thread_ttl' from 'langgraph_api'
python:3.11
langgraph_api:0.7.22

Error Message and Stack Trace (if applicable)


Description

python3.11/site-packages/langgraph_runtime_inmem/lifespan.py", line 32, in lifespan
from langgraph_api import version, feature_flags, graph, thread_ttl
ImportError: cannot import name 'thread_ttl' from 'langgraph_api'

System Info

langgraph dev

Originally created by @wenb on GitHub (Feb 5, 2026). ### Checked other resources - [x] This is a bug, not a usage question. - [x] I added a clear and descriptive title that summarizes this issue. - [x] I used the GitHub search to find a similar question and didn't find it. - [x] I am sure that this is a bug in LangGraph rather than my code. - [x] The bug is not resolved by updating to the latest stable version of LangGraph (or the specific integration package). - [x] This is not related to the langchain-community package. - [x] I posted a self-contained, minimal, reproducible example. A maintainer can copy it and run it AS IS. ### Reproduction Steps / Example Code (Python) ```python python3.11/site-packages/langgraph_runtime_inmem/lifespan.py", line 32, in lifespan from langgraph_api import __version__, feature_flags, graph, thread_ttl ImportError: cannot import name 'thread_ttl' from 'langgraph_api' python:3.11 langgraph_api:0.7.22 ``` ### Error Message and Stack Trace (if applicable) ```shell ``` ### Description python3.11/site-packages/langgraph_runtime_inmem/lifespan.py", line 32, in lifespan from langgraph_api import __version__, feature_flags, graph, thread_ttl ImportError: cannot import name 'thread_ttl' from 'langgraph_api' ### System Info langgraph dev
yindo added the bug label 2026-02-20 17:43:12 -05:00
yindo closed this issue 2026-02-20 17:43:12 -05:00
Author
Owner

@abhigyan631 commented on GitHub (Feb 6, 2026):

I attempted to reproduce this issue with the versions mentioned.

My Environment:

  • langgraph-api==0.7.22
  • langgraph_runtime_inmem==0.23.2

Finding:
Line 32 of lifespan.py in my installed version reads:

from langgraph_api import __version__, feature_flags, graph

Note: thread_ttl is not being imported in version 0.23.2.

I think the issue was already resolved in langgraph_runtime_inmem==0.23.2. The original reporter likely had an older runtime version that attempted to import the missing thread_ttl.

Please let me know if I am missing anything. Would love to recheck my work.

@abhigyan631 commented on GitHub (Feb 6, 2026): I attempted to reproduce this issue with the versions mentioned. **My Environment:** - `langgraph-api==0.7.22` - `langgraph_runtime_inmem==0.23.2` **Finding:** Line 32 of `lifespan.py` in my installed version reads: ```python from langgraph_api import __version__, feature_flags, graph ``` Note: thread_ttl is not being imported in version 0.23.2. I think the issue was already resolved in langgraph_runtime_inmem==0.23.2. The original reporter likely had an older runtime version that attempted to import the missing thread_ttl. Please let me know if I am missing anything. Would love to recheck my work.
Author
Owner

@shubham4576 commented on GitHub (Feb 6, 2026):

Image

Resolution

This issue has already been fixed upstream.

The fix was released in langgraph==0.7.24.
You’re currently using 0.7.22, which still contains this bug.

What to do

Please update the package:

pip install -U langgraph_api
# or
pip install langgraph_api==0.7.24

After upgrading, the ImportError related to thread_ttl should be fully resolved.

Why this works

The missing / mismatched export was corrected in 0.7.24, so no code changes are required on your side—just the version bump.

Let me know if you still see issues after upgrading

@shubham4576 commented on GitHub (Feb 6, 2026): <img width="926" height="443" alt="Image" src="https://github.com/user-attachments/assets/22b22c10-1c57-4eb1-b40c-f01106796f69" /> ### Resolution This issue has already been fixed upstream. The fix was released in **`langgraph==0.7.24`**. You’re currently using **`0.7.22`**, which still contains this bug. ### What to do Please update the package: ```bash pip install -U langgraph_api # or pip install langgraph_api==0.7.24 ``` After upgrading, the `ImportError` related to `thread_ttl` should be fully resolved. ### Why this works The missing / mismatched export was corrected in `0.7.24`, so no code changes are required on your side—just the version bump. Let me know if you still see issues after upgrading
Author
Owner

@Jonzky commented on GitHub (Feb 6, 2026):

Personally I had the same issue in langgraph-api-0.7.24 and langgraph-runtime-inmem-0.23.1

Updating langgraph_runtime_inmem to 0.23.2 resolved it for me.

  File "/Users/jonzky/.pyenv/versions/3.13.0/lib/python3.13/site-packages/starlette/routing.py", line 694, in lifespan
    async with self.lifespan_context(app) as maybe_state:
               ~~~~~~~~~~~~~~~~~~~~~^^^^^
  File "/Users/jonzky/.pyenv/versions/3.13.0/lib/python3.13/contextlib.py", line 214, in __aenter__
    return await anext(self.gen)
           ^^^^^^^^^^^^^^^^^^^^^
  File "/Users/jonzky/.pyenv/versions/3.13.0/lib/python3.13/site-packages/langgraph_api/timing/timer.py", line 227, in combined_lifespan
    await stack.enter_async_context(ls(app))
  File "/Users/jonzky/.pyenv/versions/3.13.0/lib/python3.13/contextlib.py", line 668, in enter_async_context
    result = await _enter(cm)
             ^^^^^^^^^^^^^^^^
  File "/Users/jonzky/.pyenv/versions/3.13.0/lib/python3.13/contextlib.py", line 214, in __aenter__
    return await anext(self.gen)
           ^^^^^^^^^^^^^^^^^^^^^
  File "/Users/jonzky/.pyenv/versions/3.13.0/lib/python3.13/site-packages/langgraph_runtime_inmem/lifespan.py", line 32, in lifespan
    from langgraph_api import __version__, feature_flags, graph, thread_ttl
ImportError: cannot import name 'thread_ttl' from 'langgraph_api' (/Users/jonzky/.pyenv/versions/3.13.0/lib/python3.13/site-packages/langgraph_api/__init__.py)```
@Jonzky commented on GitHub (Feb 6, 2026): Personally I had the same issue in langgraph-api-0.7.24 and langgraph-runtime-inmem-0.23.1 Updating langgraph_runtime_inmem to 0.23.2 resolved it for me. ```2026-02-06T12:21:56.873796Z [error ] Traceback (most recent call last): File "/Users/jonzky/.pyenv/versions/3.13.0/lib/python3.13/site-packages/starlette/routing.py", line 694, in lifespan async with self.lifespan_context(app) as maybe_state: ~~~~~~~~~~~~~~~~~~~~~^^^^^ File "/Users/jonzky/.pyenv/versions/3.13.0/lib/python3.13/contextlib.py", line 214, in __aenter__ return await anext(self.gen) ^^^^^^^^^^^^^^^^^^^^^ File "/Users/jonzky/.pyenv/versions/3.13.0/lib/python3.13/site-packages/langgraph_api/timing/timer.py", line 227, in combined_lifespan await stack.enter_async_context(ls(app)) File "/Users/jonzky/.pyenv/versions/3.13.0/lib/python3.13/contextlib.py", line 668, in enter_async_context result = await _enter(cm) ^^^^^^^^^^^^^^^^ File "/Users/jonzky/.pyenv/versions/3.13.0/lib/python3.13/contextlib.py", line 214, in __aenter__ return await anext(self.gen) ^^^^^^^^^^^^^^^^^^^^^ File "/Users/jonzky/.pyenv/versions/3.13.0/lib/python3.13/site-packages/langgraph_runtime_inmem/lifespan.py", line 32, in lifespan from langgraph_api import __version__, feature_flags, graph, thread_ttl ImportError: cannot import name 'thread_ttl' from 'langgraph_api' (/Users/jonzky/.pyenv/versions/3.13.0/lib/python3.13/site-packages/langgraph_api/__init__.py)```
Author
Owner

@hinthornw commented on GitHub (Feb 6, 2026):

Hello! Apologies for this. The fix is to update the version of langgraph-runtime-inmem to
0.23.2 or later, as Jonzky pointed out.

Basically langgraph-runtime-inmem 0.23.0 and 0.23.1 was not forwards compatible with langgraph-api.

@hinthornw commented on GitHub (Feb 6, 2026): Hello! Apologies for this. The fix is to update the version of `langgraph-runtime-inmem` to `0.23.2` or later, as Jonzky pointed out. Basically `langgraph-runtime-inmem` `0.23.0` and `0.23.1` was not forwards compatible with `langgraph-api`.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: langchain-ai/langgraph#1136