Skip to content

refactor(harness)!: consolidate the LangGraph harness + remove tracing handler#430

Merged
declan-scale merged 2 commits into
nextfrom
declan-scale/harness-langgraph-consolidation
Jun 23, 2026
Merged

refactor(harness)!: consolidate the LangGraph harness + remove tracing handler#430
declan-scale merged 2 commits into
nextfrom
declan-scale/harness-langgraph-consolidation

Conversation

@declan-scale

@declan-scale declan-scale commented Jun 23, 2026

Copy link
Copy Markdown
Contributor

Summary

Fourth slice of #425. Consolidates the LangGraph harness filesystem and removes the deprecated tracing handler.

Breaking

  • Removed create_langgraph_tracing_handler (and its handler class). Span tracing is now derived from the canonical stream by UnifiedEmitter.

Consolidation

  • _langgraph_async.py + _langgraph_messages.py + _langgraph_tracing.py collapsed into _langgraph_sync.py (emit_langgraph_messages, convert_langgraph_to_agentex_events) and _langgraph_turn.py (stream_langgraph_events).
  • adk/__init__.py re-wired (langgraph imports only; pydantic untouched here).
  • Comment-only refresh in core/harness/auto_send.py / tracer.py; harness.md + CHANGELOG.

Public facade names are unchanged apart from the removed handler. All in-repo consumers (tutorials, templates) were migrated in #428/#429.

Test plan

  • pytest langgraph sync/async/temporal + conformance — 45 passed
  • import agentex.lib.adk clean; handler gone from __all__

Notes

Stacked on #429. Retarget to next after the chain merges.

🤖 Generated with Claude Code

Greptile Summary

Collapses five LangGraph harness files (_langgraph_async.py, _langgraph_messages.py, _langgraph_tracing.py, plus the pre-existing _langgraph_sync.py and _langgraph_turn.py) into two canonical modules, and removes the deprecated create_langgraph_tracing_handler as a hard breaking change. All public facade names (stream_langgraph_events, emit_langgraph_messages, convert_langgraph_to_agentex_events, LangGraphTurn) are preserved.

  • stream_langgraph_events moves from _langgraph_async.py_langgraph_turn.py; emit_langgraph_messages moves from _langgraph_messages.py_langgraph_sync.py; both implementations are byte-for-byte identical to the deleted originals.
  • AgentexLangGraphTracingHandler / create_langgraph_tracing_handler are deleted entirely; span tracing is now derived from the canonical stream by UnifiedEmitter.
  • Test deduplication: three copies of the in-memory _FakeTracing test double are consolidated into a new tests/lib/core/harness/_fakes.py; test_langgraph_sync_unified.py is absorbed into test_langgraph_sync.py.

Confidence Score: 5/5

Safe to merge — all moved functions are byte-for-byte identical to their deleted originals, the public facade is unchanged, and the full test suite (45 tests) passes.

This is a pure filesystem consolidation: no logic was altered, only file locations changed. Each moved symbol (stream_langgraph_events, emit_langgraph_messages) is identical to what it replaces. The only net-new code is the _fakes.py test helper consolidation and the addition of stream_langgraph_events to _langgraph_turn.py. The single comment to fix is a misleading docstring in a test file.

No files require special attention.

Important Files Changed

Filename Overview
src/agentex/lib/adk/init.py Re-wires LangGraph imports: stream_langgraph_events now sourced from _langgraph_turn, emit_langgraph_messages from _langgraph_sync; create_langgraph_tracing_handler removed from public surface and __all__.
src/agentex/lib/adk/_modules/_langgraph_turn.py Absorbs stream_langgraph_events from the deleted _langgraph_async.py; implementation is identical — LangGraphTurn + UnifiedEmitter.auto_send_turn with workflow_now_if_in_workflow(). Module-level doc comment cleaned up (ticket refs removed).
src/agentex/lib/adk/_modules/_langgraph_sync.py Absorbs emit_langgraph_messages verbatim from the deleted _langgraph_messages.py; logic is unchanged. Module now owns both the streaming converter and the non-streaming message emitter.
src/agentex/lib/adk/_modules/_langgraph_async.py Deleted — stream_langgraph_events moved to _langgraph_turn.py.
src/agentex/lib/adk/_modules/_langgraph_messages.py Deleted — emit_langgraph_messages moved to _langgraph_sync.py.
src/agentex/lib/adk/_modules/_langgraph_tracing.py Deleted — AgentexLangGraphTracingHandler and create_langgraph_tracing_handler removed as a documented breaking change; no replacement needed since UnifiedEmitter derives spans from the canonical stream.
tests/lib/adk/test_langgraph_sync.py Merges test_langgraph_sync_unified.py (passthrough + span derivation tests) into this file; replaces the deleted TestLangGraphTracingHandlerBackwardCompat. Module-level autouse=True _real_langchain_core fixture correctly covers the new test classes.
tests/lib/adk/test_langgraph_sync_unified.py Deleted — content absorbed into test_langgraph_sync.py.
tests/lib/core/harness/_fakes.py New shared module extracting FakeTracing/FakeSpan from three duplicated test-local implementations; exposes convenience properties started_names, started_pairs, ended_outputs to keep shape-2/shape-3 assertions clean.
tests/lib/core/harness/test_harness_langgraph_async.py Removes local _FakeTracing/_FakeSpan; imports FakeTracing from _fakes. Doc updated to reflect that Full tool events now produce spans (previously asserted they didn't).
tests/lib/core/harness/test_harness_langgraph_sync.py Same _FakeTracing dedup as the async harness test; logic unchanged.
tests/lib/core/harness/test_harness_langgraph_temporal.py Import of stream_langgraph_events updated to its new home in _langgraph_turn; one docstring phrase about "Redis-streaming code" is misleading but harmless.
tests/lib/adk/test_langgraph_async.py Single-line import path update: stream_langgraph_events now from _langgraph_turn instead of the deleted _langgraph_async.

Flowchart

%%{init: {'theme': 'neutral'}}%%
flowchart TD
    subgraph before["Before (5 files)"]
        A1[_langgraph_async.py\nstream_langgraph_events]
        A2[_langgraph_messages.py\nemit_langgraph_messages]
        A3[_langgraph_tracing.py\ncreate_langgraph_tracing_handler\nAgentexLangGraphTracingHandler]
        A4[_langgraph_sync.py\nconvert_langgraph_to_agentex_events]
        A5[_langgraph_turn.py\nLangGraphTurn]
    end

    subgraph after["After (2 files)"]
        B1[_langgraph_turn.py\nLangGraphTurn\nstream_langgraph_events]
        B2[_langgraph_sync.py\nconvert_langgraph_to_agentex_events\nemit_langgraph_messages]
        B3[REMOVED\ncreate_langgraph_tracing_handler]
    end

    A1 -->|moved to| B1
    A5 -->|stays in| B1
    A2 -->|moved to| B2
    A4 -->|stays in| B2
    A3 -->|deleted| B3

    B1 & B2 --> C[adk/__init__.py\npublic surface unchanged]
Loading
%%{init: {'theme': 'base', 'themeVariables': {"darkMode": true, "background": "#0d1117", "primaryColor": "#21262d", "primaryTextColor": "#e6edf3", "primaryBorderColor": "#8b949e", "lineColor": "#8b949e", "textColor": "#e6edf3", "edgeLabelBackground": "#161b22", "actorBkg": "#21262d", "actorBorder": "#8b949e", "actorTextColor": "#e6edf3", "actorLineColor": "#8b949e", "signalColor": "#8b949e", "signalTextColor": "#e6edf3", "noteBkgColor": "#373320", "noteBorderColor": "#d4a72c", "noteTextColor": "#f0e6c0", "labelBoxBkgColor": "#21262d", "labelBoxBorderColor": "#8b949e", "labelTextColor": "#e6edf3", "loopTextColor": "#e6edf3", "activationBkgColor": "#30363d", "activationBorderColor": "#8b949e"}}}%%
flowchart TD
    subgraph before["Before (5 files)"]
        A1[_langgraph_async.py\nstream_langgraph_events]
        A2[_langgraph_messages.py\nemit_langgraph_messages]
        A3[_langgraph_tracing.py\ncreate_langgraph_tracing_handler\nAgentexLangGraphTracingHandler]
        A4[_langgraph_sync.py\nconvert_langgraph_to_agentex_events]
        A5[_langgraph_turn.py\nLangGraphTurn]
    end

    subgraph after["After (2 files)"]
        B1[_langgraph_turn.py\nLangGraphTurn\nstream_langgraph_events]
        B2[_langgraph_sync.py\nconvert_langgraph_to_agentex_events\nemit_langgraph_messages]
        B3[REMOVED\ncreate_langgraph_tracing_handler]
    end

    A1 -->|moved to| B1
    A5 -->|stays in| B1
    A2 -->|moved to| B2
    A4 -->|stays in| B2
    A3 -->|deleted| B3

    B1 & B2 --> C[adk/__init__.py\npublic surface unchanged]
Loading

Reviews (9): Last reviewed commit: "docs(changelog): scope breaking-change t..." | Re-trigger Greptile

Comment thread tests/lib/adk/test_langgraph_sync.py
@declan-scale declan-scale force-pushed the declan-scale/templates-unified-surface branch from a6a4a30 to fb4111f Compare June 23, 2026 15:23
@declan-scale declan-scale force-pushed the declan-scale/harness-langgraph-consolidation branch from 4bb6bc7 to 86da19c Compare June 23, 2026 15:25
@declan-scale

Copy link
Copy Markdown
Contributor Author

@greptile review

2 similar comments
@declan-scale

Copy link
Copy Markdown
Contributor Author

@greptile review

@declan-scale

Copy link
Copy Markdown
Contributor Author

@greptile review

@declan-scale declan-scale force-pushed the declan-scale/templates-unified-surface branch from fb4111f to c9f7ab7 Compare June 23, 2026 19:53
@declan-scale declan-scale force-pushed the declan-scale/harness-langgraph-consolidation branch from 58aaeb4 to 66cc86b Compare June 23, 2026 19:53
@declan-scale declan-scale force-pushed the declan-scale/templates-unified-surface branch from c9f7ab7 to 8debccd Compare June 23, 2026 19:56
@declan-scale declan-scale force-pushed the declan-scale/harness-langgraph-consolidation branch from 66cc86b to 8dba84c Compare June 23, 2026 19:56
@declan-scale declan-scale force-pushed the declan-scale/templates-unified-surface branch from 8debccd to 758d5f8 Compare June 23, 2026 20:53
Base automatically changed from declan-scale/templates-unified-surface to next June 23, 2026 21:05
@stainless-app stainless-app Bot force-pushed the next branch 2 times, most recently from c5c0a3a to 37c7d9d Compare June 23, 2026 21:14
@declan-scale declan-scale force-pushed the declan-scale/harness-langgraph-consolidation branch from 8dba84c to 940e00d Compare June 23, 2026 22:04
declan-scale and others added 2 commits June 23, 2026 18:25
… handler

Collapse _langgraph_async / _langgraph_messages / _langgraph_tracing into
_langgraph_sync (emit_langgraph_messages, convert helpers) and _langgraph_turn
(stream_langgraph_events). Span tracing is now derived from the canonical
stream by UnifiedEmitter, so create_langgraph_tracing_handler is removed.

Public facade names are unchanged except the removed handler. All in-repo
consumers were migrated to the unified surface in the preceding PRs.

BREAKING CHANGE: create_langgraph_tracing_handler is removed.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Address Greptile review: the breaking-change entry listed
create_pydantic_ai_tracing_handler as removed, but that handler is still
exported here and is only removed in the following PR. Narrow this entry to
the LangGraph handler actually removed in this change.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@declan-scale declan-scale force-pushed the declan-scale/harness-langgraph-consolidation branch from 940e00d to c98b52e Compare June 23, 2026 22:29
@declan-scale declan-scale merged commit a3fb5ad into next Jun 23, 2026
55 checks passed
@declan-scale declan-scale deleted the declan-scale/harness-langgraph-consolidation branch June 23, 2026 22:42
@stainless-app stainless-app Bot mentioned this pull request Jun 23, 2026
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.

2 participants