langgraph icon indicating copy to clipboard operation
langgraph copied to clipboard

Frontend stops receiving stream events midway but the stream continues on langsmith

Open pranavpandey2511 opened this issue 3 months ago • 2 comments

Checked other resources

  • [x] This is a bug, not a usage question. For questions, please use the LangChain Forum (https://forum.langchain.com/).
  • [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

Deployment ID for langsmith deployment: baf23c1f-3fbb-4e43-b6e1-0f02198e299b
Langsmith Trace ID: 01997bc0-5a07-7614-be09-bdef0741a4ba

The issue appears in our self-hosted deployment as well

Error Message and Stack Trace (if applicable)


Description

The multi-agent system fails intermittently where it stops sending event stream to the frontend midway but the stream gets completed on Langsmith.

We have a multi-agent system with a super agent and multiple other agents as tools, added system diagram below.

The problem is that the graph is executed successfully sometimes but intermittently fails where we never receive on_chain_end event on the frontend and therefore the user never sees the full final response. The same graph actually gets executed in the background and the complete trace is logged to langsmith.

graph TD
    %% User Input
    User[User Query] --> Entry[System Entry Point]
    
    %% Main Orchestration Layer
    Entry --> Supervisor[Supervisor Agent<br/>Query Router]
    
    %% Agent Selection Logic
    Supervisor --> Decision{Query Analysis}
    
    %% Specialized Agents
    Decision -->|Web Search| Agent1[Agent 1<br/>Web Information]
    Decision -->|Document Search| Agent2[Agent 2<br/>Internal Documents]
    Decision -->|Database Query| Agent3[Agent 3<br/>Database Access]
    Decision -->|Content Extraction| Agent4[Agent 4<br/>Content Extraction]
    Decision -->|Document Creation| Agent5[Agent 5<br/>Document Generation]
    Decision -->|External Integration| Agent6[Agent 6<br/>External Systems]
    
    %% Data Sources
    Agent1 --> WebSearch[Web Search APIs]
    Agent2 --> VectorDB[Vector Database]
    Agent3 --> LawDB[Legal Database]
    Agent4 --> WebContent[Web Content]
    Agent6 --> ExternalSystem[External Systems]
    
    %% Response Flow
    Agent1 --> Response[Response Synthesis]
    Agent2 --> Response
    Agent3 --> Response
    Agent4 --> Response
    Agent5 --> Response
    Agent6 --> Response
    
    %% Final Output
    Response --> FinalOutput[Final Response]
    FinalOutput --> User
    
    %% Configuration Layer
    Config[Configuration System] -.-> Supervisor
    Config -.-> Agent1
    Config -.-> Agent2
    Config -.-> Agent3
    Config -.-> Agent4
    Config -.-> Agent5
    Config -.-> Agent6
    
    %% Styling
    classDef userClass fill:#e1f5fe,stroke:#01579b,stroke-width:2px
    classDef agentClass fill:#f3e5f5,stroke:#4a148c,stroke-width:2px
    classDef dataClass fill:#e8f5e8,stroke:#1b5e20,stroke-width:2px
    classDef configClass fill:#fff3e0,stroke:#e65100,stroke-width:2px
    
    class User,Entry userClass
    class Supervisor,Agent1,Agent2,Agent3,Agent4,Agent5,Agent6 agentClass
    class WebSearch,VectorDB,LawDB,WebContent,ExternalSystem,Response,FinalOutput dataClass
    class Config configClass

System Info

System Information

OS: Linux OS Version: #1 SMP Fri Nov 29 17:22:03 UTC 2024 Python Version: 3.11.13 (main, Aug 13 2025, 11:05:25) [GCC 14.2.0]

Package Information

langchain_core: 0.3.74 langchain: 0.3.27 langchain_community: 0.3.27 langsmith: 0.4.23 langchain_anthropic: 0.3.18 langchain_google_vertexai: 2.0.28 langchain_mcp_adapters: 0.1.9 langchain_openai: 0.3.30 langchain_pinecone: 0.2.11 langchain_tests: 0.3.20 langchain_text_splitters: 0.3.9 langgraph_api: 0.4.11 langgraph_cli: 0.3.6 langgraph_license: Installed. No version info available. langgraph_runtime: Installed. No version info available. langgraph_runtime_inmem: 0.10.0 langgraph_runtime_postgres: Installed. No version info available. langgraph_sdk: 0.2.5

Optional packages not installed

langserve

Other Dependencies

aiohttp<4.0.0,>=3.8.3: Installed. No version info available. anthropic<1,>=0.60.0: Installed. No version info available. anthropic[vertexai]: Installed. No version info available. async-timeout<5.0.0,>=4.0.0;: Installed. No version info available. blockbuster<2.0.0,>=1.5.24: Installed. No version info available. bottleneck: 1.6.0 click>=8.1.7: Installed. No version info available. cloudpickle>=3.0.0: Installed. No version info available. cryptography<45.0,>=42.0.0: Installed. No version info available. dataclasses-json<0.7,>=0.5.7: Installed. No version info available. google-cloud-aiplatform: 1.117.0 google-cloud-storage: 2.19.0 httpx: 0.28.1 httpx-sse: 0.4.1 httpx-sse<1.0.0,>=0.4.0: Installed. No version info available. httpx<1,>=0.23.0: Installed. No version info available. httpx<1,>=0.25.0: Installed. No version info available. httpx>=0.25.0: Installed. No version info available. httpx>=0.25.2: Installed. No version info available. jsonpatch<2.0,>=1.33: Installed. No version info available. jsonschema-rs<0.30,>=0.20.0: 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<1.0.0,>=0.3.34: Installed. No version info available. langchain-core<1.0.0,>=0.3.63: 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.72: Installed. No version info available. langchain-core<1.0.0,>=0.3.74: Installed. No version info available. langchain-core>=0.3.64: 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-mistralai;: Installed. No version info available. langchain-ollama;: Installed. No version info available. langchain-openai;: Installed. No version info available. langchain-openai>=0.3.11: Installed. No version info available. langchain-perplexity;: Installed. No version info available. langchain-tests<1.0.0,>=0.3.7: Installed. No version info available. langchain-text-splitters<1.0.0,>=0.3.9: 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-api<0.3.0,>=0.2.67;: Installed. No version info available. langgraph-checkpoint>=2.0.23: Installed. No version info available. langgraph-checkpoint>=2.0.25: Installed. No version info available. langgraph-runtime-inmem<0.12.0,>=0.11.0: Installed. No version info available. langgraph-runtime-inmem>=0.6.0;: Installed. No version info available. langgraph-sdk>=0.1.0;: Installed. No version info available. langgraph-sdk>=0.2.0: Installed. No version info available. langgraph>=0.2: Installed. No version info available. langgraph>=0.4.0: Installed. No version info available. langsmith-pyo3>=0.1.0rc2;: 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. numexpr: 2.13.0 numpy>=1.26.2;: Installed. No version info available. numpy>=1.26.4: Installed. No version info available. numpy>=2.1.0;: Installed. No version info available. openai-agents>=0.0.3;: Installed. No version info available. openai<2.0.0,>=1.99.9: Installed. No version info available. opentelemetry-api>=1.30.0;: Installed. No version info available. opentelemetry-exporter-otlp-proto-http>=1.30.0;: Installed. No version info available. opentelemetry-sdk>=1.30.0;: Installed. No version info available. orjson>=3.10.1: Installed. No version info available. orjson>=3.9.14;: Installed. No version info available. orjson>=3.9.7: Installed. No version info available. packaging>=23.2: Installed. No version info available. pinecone[asyncio]<8.0.0,>=6.0.0: Installed. No version info available. pyarrow: 19.0.1 pydantic: 2.11.7 pydantic-settings<3.0.0,>=2.4.0: Installed. No version info available. pydantic<3,>=1: 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. pyjwt>=2.9.0: Installed. No version info available. pytest-asyncio<1,>=0.20: Installed. No version info available. pytest-benchmark: 5.1.0 pytest-codspeed: 4.0.0 pytest-recording: 0.13.4 pytest-socket<1,>=0.6.0: Installed. No version info available. pytest<9,>=7: Installed. No version info available. pytest>=7.0.0;: Installed. No version info available. python-dotenv>=0.8.0;: Installed. No version info available. PyYAML>=5.3: Installed. No version info available. requests-toolbelt>=1.0.0: Installed. No version info available. requests<3,>=2: Installed. No version info available. requests>=2.0.0: Installed. No version info available. rich>=13.9.4;: Installed. No version info available. SQLAlchemy<3,>=1.4: Installed. No version info available. sse-starlette<2.2.0,>=2.1.0: Installed. No version info available. sse-starlette>=2: Installed. No version info available. starlette>=0.37: Installed. No version info available. starlette>=0.38.6: Installed. No version info available. structlog<26,>=24.1.0: Installed. No version info available. structlog>23: Installed. No version info available. syrupy<5,>=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. tenacity>=8.0.0: Installed. No version info available. tiktoken<1,>=0.7: Installed. No version info available. truststore>=0.1: Installed. No version info available. typing-extensions>=4.14.0: Installed. No version info available. typing-extensions>=4.7: Installed. No version info available. uvicorn>=0.26.0: Installed. No version info available. validators: 0.35.0 vcrpy>=7.0: Installed. No version info available. vcrpy>=7.0.0;: Installed. No version info available. watchfiles>=0.13: Installed. No version info available. zstandard>=0.23.0: Installed. No version info available.

pranavpandey2511 avatar Sep 26 '25 06:09 pranavpandey2511

@hinthornw Our team has been in touch with regarding the same issue, can you please help with this? It has been a long running issue with Langgraph for us.

Here's the discussion link FYR: https://github.com/langchain-ai/langgraph/discussions/4210

pranavpandey2511 avatar Sep 26 '25 06:09 pranavpandey2511

+1

Our issue is very similar to this bug report as well as the discussion in #4210. In our case, the main script never seems to receive responses from an async call with an exception for the LLM interaction. The error is logged in the trace itself, but never caught or logged in the scripts output.

david-AH avatar Oct 23 '25 19:10 david-AH