feat: Migrate LangGraph runner to AgentGraphRunnerResult; clean up legacy shape detection#156
Draft
jsonbailey wants to merge 1 commit intojb/aic-2174/openai-graph-runnerfrom
Draft
Conversation
9733a28 to
44501e3
Compare
0539ba1 to
404670d
Compare
44501e3 to
142e041
Compare
404670d to
f132154
Compare
142e041 to
fb3c0f6
Compare
f132154 to
eb1004c
Compare
fb3c0f6 to
b3547b0
Compare
eb1004c to
8a049e2
Compare
b3547b0 to
1d4ddb2
Compare
8a049e2 to
cea3780
Compare
1d4ddb2 to
6201d09
Compare
cea3780 to
f27f9b8
Compare
6201d09 to
ef4216c
Compare
f27f9b8 to
d892533
Compare
ef4216c to
8ecce16
Compare
d892533 to
13ee088
Compare
8ecce16 to
09af502
Compare
13ee088 to
3159524
Compare
09af502 to
43bc879
Compare
…cy shape detection Updates LangGraphAgentGraphRunner to return AgentGraphRunnerResult with GraphMetrics (success, path, duration_ms, usage, node_metrics) instead of the legacy AgentGraphResult. Adds collect_node_metrics() to LDMetricsCallbackHandler for pure data extraction. Removes the transitional AgentGraphResult detection branch from ManagedAgentGraph now that both the OpenAI and LangGraph runners return AgentGraphRunnerResult. All graph-level and per-node tracking events are driven exclusively by the managed layer. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
3159524 to
2c5671d
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
LangGraphAgentGraphRunner.run()to returnAgentGraphRunnerResult(withGraphMetrics) instead of the legacyAgentGraphResultshapecollect_node_metrics()toLDMetricsCallbackHandlerfor pure data extraction (no LD tracker calls from the runner)isinstance(raw_result, AgentGraphRunnerResult)detection branch fromManagedAgentGraph— now that both OpenAI and LangGraph runners return the new shape, the bridge is dead codeManagedAgentGraph._flush_graph_tracking()test_langgraph_agent_graph_runner.pyto verify runner returnsAgentGraphRunnerResultand does NOT call graph tracker directlytest_tracking_langgraph.pyto verify events via handlerflush()or result shape; removes direct runner → graph tracker assertionsStack position
This is PR 11-langchain, stacked on:
After this PR, the legacy
AgentGraphResultshape is fully retired from production code.Test plan
make testpasses inpackages/ai-providers/server-ai-langchain(81 tests)uv run pytest packages/sdk/server-ai/tests/passes (149 tests)make testpasses inpackages/ai-providers/server-ai-openai(40 tests)🤖 Generated with Claude Code
Note
Medium Risk
Changes the agent-graph runner return type and shifts graph/per-node tracking responsibility to
ManagedAgentGraph, which can affect downstream integrations expecting the legacyAgentGraphResultshape or runner-driven tracking behavior.Overview
Migrates
LangGraphAgentGraphRunner.run()to returnAgentGraphRunnerResultwithGraphMetrics(including path, duration, total token usage, and per-nodeLDAIMetrics) instead of the legacyAgentGraphResult, and removes runner-side graph tracker calls and per-run eval-task plumbing.Simplifies
ManagedAgentGraphto require the new runner result shape and to emit all graph-level and per-node LaunchDarkly tracking events fromresult.metrics.node_metrics.Updates the LangChain callback handler to deprecate
flush()for production tracking and adds a purecollect_node_metrics()extractor, plus adjusts tests to assert the new result fields (content,duration_ms,path) and to verify tracking now occurs via the managed layer (including running some integration tests throughManagedAgentGraph).Reviewed by Cursor Bugbot for commit 0daafb6. Bugbot is set up for automated code reviews on this repo. Configure here.