feat: add DeerFlow 2.x observability#248
Conversation
ralf0131
left a comment
There was a problem hiding this comment.
- [Info]
patch.py:_track_graph— Strong-ref fallback list for unhashable graphs could grow without bounds in theory, but in practice graphs are created once per application. Acceptable for current usage.
Code Quality Highlights
- Optional DeerFlow imports are correctly wrapped in try/except (telemetry must not hard-depend on application internals)
_LEGACY_GRAPH_ATTRScleanup ensures graphs aren't misclassified as ReAct/deepagents when marked as DeerFlow - Entry depth via ContextVar prevents nested span creation - CI workflow JSON additions are mechanical (adding deerflow to lint/test matrices) ### Test Coverage - New test files underloongsuite-instrumentation-deerflow/tests/with conftest fixtures -test_response_id.pyfor the sharedresolve_response_idhelper (from #247's util-genai addition)
Note: Reviewed the core patch.py (802 lines) and extended_handler.py changes in detail. CI config, package metadata, and README changes reviewed at a high level.
Automated review by github-manager-bot
SummaryAdds a new FindingsNo blocking issues.
Code Quality Highlights
Test Coverage
Note: Reviewed the core Automated review by github-manager-bot |
Description
This PR adds observability support for ByteDance DeerFlow 2.x as a thin adapter over the existing LoongSuite LangChain and LangGraph instrumentations.
The adapter marks only DeerFlow-created LangGraph graphs with two internal scalar semantics: the framework name and the direct model-decision node name. LangGraph propagates those values through a copy of
RunnableConfig.metadata, and the LangChain tracer uses them to create oneAGENTand exactly oneSTEPper direct model decision. Existing LangGraph prebuilt ReAct detection and DeepAgents behavior remain unchanged.The DeerFlow package adds Gateway and embedded-client
ENTRYlifecycle handling, lead/subagent identity, session and user propagation, correlation attributes, streaming teardown, timeout/error/interruption handling, cached-alias restoration, and concurrency isolation. Direct SDK graph invocation starts atAGENTand does not invent an applicationENTRY.The public package supports the official DeerFlow source distribution at
>=2,<3and intentionally does not depend on the unrelated PyPI placeholder. The README documents local foreground/daemon, Docker development/production, and embedded SDK integration. Local command wrapping and persistent site bootstrap do not require changes to DeerFlow Python source.This PR does not change
loongsuite-distro/src/loongsuite/distro/bootstrap_registry; release registration and version refreshes remain part of the release workflow.Fixes # (N/A)
Type of change
How Has This Been Tested?
tox -e precommittox -c tox-loongsuite.ini -e py312-test-loongsuite-instrumentation-deerflow.stable -- -q(52 passed)tox -c tox-loongsuite.ini -e py312-test-loongsuite-instrumentation-deerflow.current -- -q(52 passed)tox -c tox-loongsuite.ini -e py313-test-loongsuite-instrumentation-deerflow.current -- -q(52 passed)tox -c tox-loongsuite.ini -e lint-loongsuite-instrumentation-deerflowtox -c tox-loongsuite.ini -e py312-test-loongsuite-instrumentation-langchain-latest -- -q(173 passed)tox -c tox-loongsuite.ini -e py312-test-loongsuite-instrumentation-langgraph-latest -- -q(20 passed)tox -c tox-loongsuite.ini -e py312-test-loongsuite-instrumentation-deepagents-latest -- -q(11 passed)tox -e py312-test-util-genai -- -q(271 passed, 1 skipped because optional OSS credentials were not configured)PYTHONPATH=.github/workflows/generate_workflows_lib/src python .github/workflows/generate_workflows.pyPYTHONPATH=.github/workflows/generate_workflows_lib/src python .github/workflows/generate_workflows_loongsuite.pyloongsuite-instrumentproduced oneAGENT -> STEP -> CHAIN -> LLMtree without duplicate core spansAGENT -> STEP -> LLMtree without an application import changemainDoes This PR Require a Core Repo Change?
Checklist:
See contributing.md for styleguide, changelog guidelines, and more.
Validation Evidence
Scope and compatibility
>=2,<3, Python 3.12+.bootstrap_registryhas no diff frommain; publishing metadata is deferred to the release process.main.agentdecision node.Lifecycle and telemetry
ENTRY; direct graph calls begin atAGENT.STEP; two-round tool loops reporttool_callsfollowed bystop.AGENTorSTEPspans.Weaver and CI
gen_ai.framework, an existing LoongSuite extension attribute not yet declared by the external registry; DeerFlow-specific lifecycle validation is otherwise complete.