Skip to content

Conversation

@viniciusdsmello
Copy link
Contributor

Pull Request

Summary

Refactored AsyncOpenlayerHandler to use a boolean flag for external trace detection instead of storing trace object reference. Improves code clarity and simplifies the integration pattern for external systems (e.g., LangFlow).

Changes

  • Updated all conditional checks to use a boolean flag instead of None checks
  • Updated langchain imports to support newer versions.

Context

Supports LangFlow integration where the handler needs to detect if it's operating within an external trace context. When an external context exists, the handler creates standalone traces in _traces_by_root for integration by the external system instead of uploading independently.

The refactor simplifies this by storing only a boolean flag captured at initialization, since we only need to know "was there an external trace?" not the trace object itself.

Testing

  • Manual testing with LangFlow integration
  • Verified nested LangChain steps appear correctly in Openlayer UI
  • Confirmed no duplicate trace uploads
  • Validated trace hierarchy structure

@gustavocidornelas gustavocidornelas merged commit 01fa425 into main Nov 24, 2025
5 checks passed
@gustavocidornelas gustavocidornelas deleted the vini/improves-lanchain-callback-context-management branch November 24, 2025 19:49
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