-
Notifications
You must be signed in to change notification settings - Fork 3.8k
Description
Checked other resources
- This is a bug, not a usage question. For questions, please use the LangChain Forum (https://forum.langchain.com/).
- 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
async def call_subgraph(state, config):
output = await subgraph.ainvoke(
input=state,
config=config,
)
messages = output["messages"]
messages = messages[-1:]
return {
**output,
"messages": messages,
}
parent_graph.add_node(node="call_subgraph", action=call_subgraph)Error Message and Stack Trace (if applicable)
Description
I use fastapi and graph.astream to provide event stream, when I cancel request, asyncio.CancelledError occurred, and the graph will stopped, but when I set a node to ainvoke subgraph, subgraph will not stop (continue to do ReAct loop) when asyncio.CancelledError occurred
System Info
System Information
OS: Linux
OS Version: #1 SMP PREEMPT_DYNAMIC Thu, 17 Jul 2025 21:05:29 +0000
Python Version: 3.12.11 (main, Jul 11 2025, 22:43:48) [Clang 20.1.4 ]
Package Information
langchain_core: 0.3.69
langchain: 0.3.26
langchain_community: 0.3.27
langsmith: 0.4.8
langchain_anthropic: 0.3.17
langchain_cohere: 0.4.4
langchain_deepseek: 0.1.3
langchain_experimental: 0.3.4
langchain_google_community: 2.0.7
langchain_google_genai: 2.1.8
langchain_mcp_adapters: 0.1.9
langchain_mistralai: 0.2.11
langchain_ollama: 0.3.5
langchain_openai: 0.3.28
langchain_tavily: 0.2.10
langchain_text_splitters: 0.3.8
langchain_xai: 0.2.4
langgraph_sdk: 0.1.74
langgraph_supervisor: 0.0.27
langgraph_swarm: 0.0.13
Optional packages not installed
langserve
Other Dependencies
aiohttp: 3.12.14
aiohttp<4,>=3.9.1: Installed. No version info available.
aiohttp<4.0.0,>=3.8.3: Installed. No version info available.
anthropic<1,>=0.57.0: Installed. No version info available.
async-timeout<5.0.0,>=4.0.0;: Installed. No version info available.
beautifulsoup4: 4.13.4
cohere: 5.16.1
dataclasses-json<0.7,>=0.5.7: Installed. No version info available.
db-dtypes: Installed. No version info available.
filetype: 1.2.0
gapic-google-longrunning: Installed. No version info available.
google-ai-generativelanguage: 0.6.18
google-api-core: 2.25.1
google-api-python-client: 2.176.0
google-auth: 2.40.3
google-auth-httplib2: 0.2.0
google-auth-oauthlib: Installed. No version info available.
google-cloud-aiplatform: Installed. No version info available.
google-cloud-bigquery: Installed. No version info available.
google-cloud-bigquery-storage: Installed. No version info available.
google-cloud-contentwarehouse: Installed. No version info available.
google-cloud-core: 2.4.3
google-cloud-discoveryengine: Installed. No version info available.
google-cloud-documentai: Installed. No version info available.
google-cloud-documentai-toolbox: Installed. No version info available.
google-cloud-speech: Installed. No version info available.
google-cloud-storage: Installed. No version info available.
google-cloud-texttospeech: Installed. No version info available.
google-cloud-translate: Installed. No version info available.
google-cloud-vision: Installed. No version info available.
googlemaps: Installed. No version info available.
grpcio: 1.73.1
httpx: 0.28.1
httpx-sse<1,>=0.3.1: Installed. No version info available.
httpx-sse<1.0.0,>=0.4.0: Installed. No version info available.
httpx<1,>=0.25.2: Installed. No version info available.
httpx>=0.25.2: Installed. No version info available.
jsonpatch<2.0,>=1.33: Installed. No version info available.
langchain-anthropic;: Installed. No version info available.
langchain-aws;: Installed. No version info available.
langchain-azure-ai;: Installed. No version info available.
langchain-cohere;: Installed. No version info available.
langchain-community;: Installed. No version info available.
langchain-core<0.4,>=0.3.36: Installed. No version info available.
langchain-core<0.4.0,>=0.3.40: Installed. No version info available.
langchain-core<1.0.0,>=0.3.47: Installed. No version info available.
langchain-core<1.0.0,>=0.3.51: Installed. No version info available.
langchain-core<1.0.0,>=0.3.62: Installed. No version info available.
langchain-core<1.0.0,>=0.3.66: Installed. No version info available.
langchain-core<1.0.0,>=0.3.68: Installed. No version info available.
langchain-core<1.0.0,>=0.3.69: Installed. No version info available.
langchain-core>=0.3.40: Installed. No version info available.
langchain-deepseek;: Installed. No version info available.
langchain-fireworks;: Installed. No version info available.
langchain-google-genai;: Installed. No version info available.
langchain-google-vertexai;: Installed. No version info available.
langchain-groq;: Installed. No version info available.
langchain-huggingface;: Installed. No version info available.
langchain-mistralai;: Installed. No version info available.
langchain-ollama;: Installed. No version info available.
langchain-openai;: Installed. No version info available.
langchain-openai<0.4,>=0.3.18: Installed. No version info available.
langchain-openai<1.0.0,>=0.3.9: Installed. No version info available.
langchain-perplexity;: Installed. No version info available.
langchain-text-splitters<1.0.0,>=0.3.8: Installed. No version info available.
langchain-together;: Installed. No version info available.
langchain-xai;: Installed. No version info available.
langchain<1.0.0,>=0.3.26: Installed. No version info available.
langgraph-prebuilt>=0.1.7: Installed. No version info available.
langgraph>=0.3.5: Installed. No version info available.
langgraph>=0.5: Installed. No version info available.
langsmith-pyo3: Installed. No version info available.
langsmith>=0.1.125: Installed. No version info available.
langsmith>=0.1.17: Installed. No version info available.
langsmith>=0.3.45: Installed. No version info available.
mcp>=1.9.2: Installed. No version info available.
numpy>=1.26.2;: Installed. No version info available.
numpy>=2.1.0;: Installed. No version info available.
ollama<1.0.0,>=0.5.1: Installed. No version info available.
openai-agents: Installed. No version info available.
openai<2.0.0,>=1.86.0: Installed. No version info available.
opentelemetry-api: Installed. No version info available.
opentelemetry-exporter-otlp-proto-http: Installed. No version info available.
opentelemetry-sdk: Installed. No version info available.
orjson: 3.11.0
orjson>=3.10.1: Installed. No version info available.
packaging: 25.0
packaging>=23.2: Installed. No version info available.
pandas: 2.3.1
pyarrow: Installed. No version info available.
pydantic: 2.11.7
pydantic-settings<3.0.0,>=2.4.0: Installed. No version info available.
pydantic<3,>=2: Installed. No version info available.
pydantic<3.0.0,>=2.7.4: Installed. No version info available.
pydantic>=2.7.4: Installed. No version info available.
pytest: Installed. No version info available.
PyYAML>=5.3: Installed. No version info available.
requests: 2.32.4
requests-toolbelt: 1.0.0
requests<3,>=2: Installed. No version info available.
rich: 14.0.0
SQLAlchemy<3,>=1.4: Installed. No version info available.
tenacity!=8.4.0,<10,>=8.1.0: Installed. No version info available.
tenacity!=8.4.0,<10.0.0,>=8.1.0: Installed. No version info available.
tiktoken<1,>=0.7: Installed. No version info available.
tokenizers<1,>=0.15.1: Installed. No version info available.
types-pyyaml: 6.0.12.20250516
typing-extensions>=4.14.0: Installed. No version info available.
typing-extensions>=4.7: Installed. No version info available.
zstandard: 0.23.0