Skip to content

feat!: consolidate graph metric summary into LDAIGraphMetricSummary#1362

Merged
jsonbailey merged 1 commit intofeat/next-ai-releasefrom
jb/rename-ai-graph-metrics
May 7, 2026
Merged

feat!: consolidate graph metric summary into LDAIGraphMetricSummary#1362
jsonbailey merged 1 commit intofeat/next-ai-releasefrom
jb/rename-ai-graph-metrics

Conversation

@jsonbailey
Copy link
Copy Markdown
Contributor

@jsonbailey jsonbailey commented May 6, 2026

Summary

JS already had two duplicate graph-metric-summary interfaces:

Both describe the same spec concept (AIGraphMetricSummary in AIRUNNER §2.5). This PR consolidates them into the single LDAIGraphMetricSummary (JS LD-prefix convention used by all sibling types like LDAIMetrics, LDAIMetricSummary, LDAIGraphMetrics) and adds the missing nodeMetrics field.

Required vs. optional fields

The consolidated type's optionality matches the actual runtime contract — preserving the type precision the old AIGraphMetricSummary provided:

  • Required: success, path, nodeMetrics. The managed layer sources these from LDAIGraphMetrics where they are required, so consumers of ManagedGraphResult.metrics can rely on them being present.
  • Optional: durationMs, tokens, resumptionToken. Genuinely may not be tracked depending on runner.

For the tracker's incremental view, LDGraphTracker.getSummary() now returns Partial<LDAIGraphMetricSummary> to express that fields populate as tracking calls arrive. LDGraphTrackerImpl._summary is similarly typed.

Coordination

This is one of three coordinated PRs renaming/aligning the graph metric summary types:

Files changed

  • packages/sdk/server-ai/src/api/graph/types.ts — added nodeMetrics to LDAIGraphMetricSummary; tightened success/path/nodeMetrics to required; removed the duplicate AIGraphMetricSummary interface; updated ManagedGraphResult.metrics to LDAIGraphMetricSummary.
  • packages/sdk/server-ai/src/api/graph/LDGraphTracker.tsgetSummary() returns Partial<LDAIGraphMetricSummary>.
  • packages/sdk/server-ai/src/LDGraphTrackerImpl.ts_summary field and getSummary() return are Partial<LDAIGraphMetricSummary>.
  • packages/sdk/server-ai/src/api/graph/ManagedAgentGraph.ts — switched to LDAIGraphMetricSummary.

Breaking changes

  • AIGraphMetricSummary is removed. Consumers should import LDAIGraphMetricSummary from @launchdarkly/server-sdk-ai.
  • LDAIGraphMetricSummary.success, path, and nodeMetrics are now required (previously optional). Consumers of ManagedGraphResult.metrics benefit; consumers who built LDAIGraphMetricSummary literals from the tracker should switch to Partial<LDAIGraphMetricSummary>.
  • LDGraphTracker.getSummary() now returns Partial<LDAIGraphMetricSummary> instead of LDAIGraphMetricSummary to reflect the incremental population. Consumers reading getSummary().success etc. were already getting boolean | undefined at runtime; the change just makes the type honest.

Test plan

  • yarn workspaces foreach -pR --topological-dev --from '@launchdarkly/server-sdk-ai' run build passes
  • yarn workspace @launchdarkly/server-sdk-ai test passes (230/230)
  • yarn workspace @launchdarkly/server-sdk-ai lint clean
  • Reviewer confirms naming choice (LD-prefix consolidation vs spec's bare AIGraphMetricSummary)

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented May 6, 2026

@launchdarkly/js-sdk-common size report
This is the brotli compressed size of the ESM build.
Compressed size: 26281 bytes
Compressed size limit: 29000
Uncompressed size: 128971 bytes

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented May 6, 2026

@launchdarkly/js-client-sdk size report
This is the brotli compressed size of the ESM build.
Compressed size: 31867 bytes
Compressed size limit: 34000
Uncompressed size: 113634 bytes

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented May 6, 2026

@launchdarkly/browser size report
This is the brotli compressed size of the ESM build.
Compressed size: 179543 bytes
Compressed size limit: 200000
Uncompressed size: 830815 bytes

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented May 6, 2026

@launchdarkly/js-client-sdk-common size report
This is the brotli compressed size of the ESM build.
Compressed size: 38473 bytes
Compressed size limit: 39000
Uncompressed size: 211104 bytes

@jsonbailey jsonbailey marked this pull request as ready for review May 7, 2026 13:48
@jsonbailey jsonbailey requested a review from a team as a code owner May 7, 2026 13:48
@jsonbailey jsonbailey force-pushed the jb/rename-ai-graph-metrics branch 2 times, most recently from 5d7cf3d to d645b30 Compare May 7, 2026 14:38
@jsonbailey jsonbailey changed the title feat!: rename GraphMetricSummary to AIGraphMetricSummary feat!: consolidate graph metric summary into LDAIGraphMetricSummary May 7, 2026
Copy link
Copy Markdown

@cursor cursor Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, have a team admin enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit d645b30. Configure here.

Comment thread packages/sdk/server-ai/src/api/graph/types.ts
The managed-layer `AIGraphMetricSummary` and the tracker-layer
`LDAIGraphMetricSummary` were duplicate interfaces describing the same
spec concept (`AIGraphMetricSummary` in AIRUNNER §2.5). Consolidate to
the single `LDAIGraphMetricSummary` (JS LD-prefix convention) and add
`nodeMetrics` so it can carry per-node summaries from
`ManagedAgentGraph.run()`.

Required vs. optional matches the runtime contract:

- `success`, `path`, `nodeMetrics` are required — the managed layer
  sources these from `LDAIGraphMetrics` where they are required, so the
  type now reflects the actual guarantee.
- `durationMs`, `tokens`, `resumptionToken` remain optional — these
  may not be tracked depending on runner.

For `LDGraphTracker.getSummary()`, which populates incrementally as
tracking calls arrive, the return type is now
`Partial<LDAIGraphMetricSummary>` to express the per-call partial state
explicitly. `LDGraphTrackerImpl._summary` is similarly typed.

`AIGraphMetricSummary` is removed; `ManagedGraphResult.metrics` and
`ManagedAgentGraph` now use `LDAIGraphMetricSummary`.

BREAKING CHANGE: `AIGraphMetricSummary` is removed in favour of
`LDAIGraphMetricSummary`. `LDGraphTracker.getSummary()` now returns
`Partial<LDAIGraphMetricSummary>` instead of `LDAIGraphMetricSummary`
to reflect that the tracker accumulates the summary incrementally;
consumers must check optional fields.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@jsonbailey jsonbailey force-pushed the jb/rename-ai-graph-metrics branch from d645b30 to 37ea4f2 Compare May 7, 2026 14:50
@jsonbailey jsonbailey merged commit c216575 into feat/next-ai-release May 7, 2026
43 checks passed
@jsonbailey jsonbailey deleted the jb/rename-ai-graph-metrics branch May 7, 2026 15:05
@github-actions github-actions Bot mentioned this pull request May 7, 2026
jsonbailey pushed a commit that referenced this pull request May 7, 2026
🤖 I have created a release *beep* *boop*
---


<details><summary>server-sdk-ai: 0.20.0</summary>

##
[0.20.0](server-sdk-ai-v0.19.1...server-sdk-ai-v0.20.0)
(2026-05-07)


### ⚠ BREAKING CHANGES

* Rename LDAIMetrics.usage and LDAIGraphMetrics.usage to .tokens
([#1366](#1366))
* Remove AIProvider deprecated methods and create*/init* aliases
(AIC-2388)
([#1363](#1363))
* Build judge input as string and strip legacy judge config messages
([#1364](#1364))
* Use LDAIGraphMetricSummary for graph metric summary
([#1362](#1362))

### Features

* add Evaluator class for judge orchestration
([#1331](#1331))
([54faa69](54faa69))
* add ManagedAgent with evaluations support
([#1334](#1334))
([7f09c46](7f09c46))
* add ManagedGraphResult, GraphMetricSummary, and ManagedAgentGraph
([#1335](#1335))
([09fa1db](09fa1db))
* introduce ManagedResult, RunnerResult, and LDAIMetricSummary
([#1332](#1332))
([5040122](5040122))
* Remove AIProvider deprecated methods and create*/init* aliases
(AIC-2388)
([#1363](#1363))
([ad66314](ad66314))
* Rename LDAIMetrics.usage and LDAIGraphMetrics.usage to .tokens
([#1366](#1366))
([ff932b7](ff932b7))
* Replace OpenAIProvider with Runner protocol implementation (AIC-2388)
([#1337](#1337))
([e32a955](e32a955))


### Bug Fixes

* Build judge input as string and strip legacy judge config messages
([#1364](#1364))
([c90034b](c90034b))
* Use LDAIGraphMetricSummary for graph metric summary
([#1362](#1362))
([76a4bf2](76a4bf2))
</details>

<details><summary>server-sdk-ai-langchain: 0.7.0</summary>

##
[0.7.0](server-sdk-ai-langchain-v0.6.3...server-sdk-ai-langchain-v0.7.0)
(2026-05-07)


### ⚠ BREAKING CHANGES

* Rename LDAIMetrics.usage and LDAIGraphMetrics.usage to .tokens
([#1366](#1366))
* Remove AIProvider deprecated methods and create*/init* aliases
(AIC-2388)
([#1363](#1363))
* Build judge input as string and strip legacy judge config messages
([#1364](#1364))

### Features

* Remove AIProvider deprecated methods and create*/init* aliases
(AIC-2388)
([#1363](#1363))
([ad66314](ad66314))
* Rename LDAIMetrics.usage and LDAIGraphMetrics.usage to .tokens
([#1366](#1366))
([ff932b7](ff932b7))
* Replace LangChainProvider with Runner protocol implementation
(AIC-2388)
([#1338](#1338))
([113a0d2](113a0d2))


### Bug Fixes

* Build judge input as string and strip legacy judge config messages
([#1364](#1364))
([c90034b](c90034b))


### Dependencies

* The following workspace dependencies were updated
  * devDependencies
    * @launchdarkly/server-sdk-ai bumped from ^0.19.1 to ^0.20.0
  * peerDependencies
    * @launchdarkly/server-sdk-ai bumped from ^0.19.1 to ^0.20.0
</details>

<details><summary>server-sdk-ai-openai: 0.6.0</summary>

##
[0.6.0](server-sdk-ai-openai-v0.5.10...server-sdk-ai-openai-v0.6.0)
(2026-05-07)


### ⚠ BREAKING CHANGES

* Rename LDAIMetrics.usage and LDAIGraphMetrics.usage to .tokens
([#1366](#1366))
* Remove AIProvider deprecated methods and create*/init* aliases
(AIC-2388)
([#1363](#1363))
* Build judge input as string and strip legacy judge config messages
([#1364](#1364))

### Features

* Remove AIProvider deprecated methods and create*/init* aliases
(AIC-2388)
([#1363](#1363))
([ad66314](ad66314))
* Rename LDAIMetrics.usage and LDAIGraphMetrics.usage to .tokens
([#1366](#1366))
([ff932b7](ff932b7))
* Replace OpenAIProvider with Runner protocol implementation (AIC-2388)
([#1337](#1337))
([e32a955](e32a955))


### Bug Fixes

* Build judge input as string and strip legacy judge config messages
([#1364](#1364))
([c90034b](c90034b))


### Dependencies

* The following workspace dependencies were updated
  * devDependencies
    * @launchdarkly/server-sdk-ai bumped from ^0.19.1 to ^0.20.0
  * peerDependencies
    * @launchdarkly/server-sdk-ai bumped from ^0.19.1 to ^0.20.0
</details>

<details><summary>server-sdk-ai-vercel: 0.6.0</summary>

##
[0.6.0](server-sdk-ai-vercel-v0.5.10...server-sdk-ai-vercel-v0.6.0)
(2026-05-07)


### ⚠ BREAKING CHANGES

* Rename LDAIMetrics.usage and LDAIGraphMetrics.usage to .tokens
([#1366](#1366))
* Remove AIProvider deprecated methods and create*/init* aliases
(AIC-2388)
([#1363](#1363))
* Build judge input as string and strip legacy judge config messages
([#1364](#1364))

### Features

* Remove AIProvider deprecated methods and create*/init* aliases
(AIC-2388)
([#1363](#1363))
([ad66314](ad66314))
* Rename LDAIMetrics.usage and LDAIGraphMetrics.usage to .tokens
([#1366](#1366))
([ff932b7](ff932b7))
* replace VercelProvider with Runner protocol implementation (AIC-2388)
([#1339](#1339))
([d5a62de](d5a62de))


### Bug Fixes

* add zod devDependency to Vercel provider (peer dep of ai v5)
([aab6226](aab6226))
* Build judge input as string and strip legacy judge config messages
([#1364](#1364))
([c90034b](c90034b))


### Dependencies

* The following workspace dependencies were updated
  * devDependencies
    * @launchdarkly/server-sdk-ai bumped from ^0.19.1 to ^0.20.0
  * peerDependencies
    * @launchdarkly/server-sdk-ai bumped from ^0.19.1 to ^0.20.0
</details>

---
This PR was generated with [Release
Please](https://github.com/googleapis/release-please). See
[documentation](https://github.com/googleapis/release-please#release-please).

<!-- CURSOR_SUMMARY -->
---

> [!NOTE]
> **Medium Risk**
> This is primarily a versioning/release metadata update, but it ships
breaking API changes in `@launchdarkly/server-sdk-ai` and provider
packages that may require consumer code updates (e.g., metrics field
rename and deprecated method removals).
> 
> **Overview**
> Publishes a new release for `@launchdarkly/server-sdk-ai` (`0.19.1` →
`0.20.0`) and the provider packages (`server-sdk-ai-langchain` `0.6.3` →
`0.7.0`, `server-sdk-ai-openai`/`server-sdk-ai-vercel` `0.5.10` →
`0.6.0`), updating `.release-please-manifest.json`, package versions,
and `sdkInfo.ts`.
> 
> Updates provider `peerDependencies`/`devDependencies` to require
`@launchdarkly/server-sdk-ai@^0.20.0`, and bumps all `server-ai`
examples to depend on the new SDK/provider versions. Changelogs
highlight *breaking changes* including renaming metrics `usage` →
`tokens`, removing deprecated `AIProvider` methods/aliases, and
judge-input/config cleanup (plus additional `server-sdk-ai`
graph/managed result summary changes).
> 
> <sup>Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit
cb3aebc. Bugbot is set up for automated
code reviews on this repo. Configure
[here](https://www.cursor.com/dashboard/bugbot).</sup>
<!-- /CURSOR_SUMMARY -->

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
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