Skip to content

Conversation

@hassiebp
Copy link
Contributor

@hassiebp hassiebp commented May 6, 2025

Important

LangchainCallbackHandler now ignores GraphBubbleUp exceptions in on_chain_error, preventing them from being logged as errors.

  • Behavior:
    • on_chain_error in LangchainCallbackHandler now ignores exceptions of type GraphBubbleUp from langgraph.errors, not logging them as errors.
    • Introduces CONTROL_FLOW_EXCEPTION_TYPES set to store exception types to be ignored.
  • Imports:
    • Adds Set and Type to imports in langchain.py.
    • Attempts to import GraphBubbleUp from langgraph.errors and adds it to CONTROL_FLOW_EXCEPTION_TYPES if available.

This description was created by Ellipsis for a43ebe7. You can customize this summary. It will automatically update as commits are pushed.

Greptile Summary

Disclaimer: Experimental PR review

Enhanced LangChain callback handler to properly handle control flow exceptions from LangGraph, preventing GraphBubbleUp exceptions from being logged as errors in Langfuse.

  • Added CONTROL_FLOW_EXCEPTION_TYPES set in langfuse/callback/langchain.py to track special exception types
  • Added support for LangGraph's GraphBubbleUp exception in control flow handling
  • Modified error handling logic to avoid marking control flow exceptions as errors
  • Improved integration between LangGraph and Langfuse by allowing expected control flow exceptions

Co-authored-by: Hassieb Pakzad <68423100+hassiebp@users.noreply.github.com>
@hassiebp hassiebp changed the title feat(langgraph): ignore control flow exceptions in LangChain callback (#1169) fix(langgraph): ignore control flow exceptions in LangChain callback (#1169) May 6, 2025
@hassiebp hassiebp enabled auto-merge (squash) May 6, 2025 11:51
Copy link
Contributor

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

1 file(s) reviewed, no comment(s)
Edit PR Review Bot Settings | Greptile

@hassiebp hassiebp disabled auto-merge May 6, 2025 12:53
@hassiebp hassiebp merged commit e46d08d into main May 6, 2025
8 of 10 checks passed
@hassiebp hassiebp deleted the langchain-control-flow-exceptions branch May 6, 2025 12:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants