Skip to content

feat(AIC-3211): expose graph traversal path in ProviderGraphResponse - #39

Draft
ld-paul wants to merge 1 commit into
mainfrom
devin/1787780927-graph-path
Draft

ld-paul wants to merge 1 commit into
mainfrom
devin/1787780927-graph-path

Conversation

@ld-paul

@ld-paul ld-paul commented Aug 26, 2026

Copy link
Copy Markdown
Contributor

Summary

graph().invoke() already accumulates the traversal path and each node's response internally (it sends the path as $ld:ai:graph:path), but ProviderGraphResponse dropped both — so an app cannot tell which branch the router picked. This returns them.

Closes AIC-3211.

 export type ProviderGraphResponse = {
   response: string;
   usage: TokenUsage;
   judgeResults?: ProviderResponse['judgeResults'];
+  path: string[];
+  nodes?: Record<string, ProviderResponse>;
 };
  • path is required: every graph execution path is knowable, including the native runners (toClaudeAgents(), toOpenAIAgents(), toLangGraph()), which already track it.
  • nodes is optional: native runners delegate traversal to the framework and do not produce a ProviderResponse per node.
  • Purely additive — no behavior or telemetry change.
Implementation details

Reported by Ben in #proj-turnkey-ai-sdk: he had a route badge showing which node the router picked, and had to scrap it when switching to graph().invoke().

graph().invoke()'s accumulate() already pushes node.key into path and stores nodes[node.key] = res; the return statement just omitted them. The three native-graph.ts runners already build a path array for their own telemetry and now return it.

The fine-grained alternative that exists today — resolveGraph() + def.route(), which returns {...response, next} — is documented alongside the new fields.

Verified with make code-check, make build, make typecheck, and make test (all packages pass). A new test asserts path order and per-node responses on a two-node graph.

Graph-level streaming (AIC-3210) is the other half of Ben's report and follows in a separate PR.

Link to Devin session: https://app.devin.ai/sessions/978ca9b3c9634c60abb7385a945d17bc
Requested by: @ld-paul

…raphResponse

Co-Authored-By: Paul Loeb <ploeb@launchdarkly.com>
@devin-ai-integration

Copy link
Copy Markdown
Contributor

🤖 Devin AI Engineer

I'll be helping with this pull request! Here's what you should know:

✅ I will automatically:

  • Address comments on this PR. Add '(aside)' to your comment to have me ignore it.
  • Look at CI failures and help fix them

Note: I can only respond to comments from users who have write access to this repository.

⚙️ Control Options:

  • Disable automatic comment, CI, and merge conflict monitoring

@devin-ai-integration

Copy link
Copy Markdown
Contributor

@cursor review

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

devin-ai PR was created by Devin AI

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant