Skip to content

feat!: Move graph_key to AIConfigTracker instantiation#134

Merged
jsonbailey merged 3 commits intomainfrom
jb/aic-2238/graphkey-on-tracker-init
Apr 16, 2026
Merged

feat!: Move graph_key to AIConfigTracker instantiation#134
jsonbailey merged 3 commits intomainfrom
jb/aic-2238/graphkey-on-tracker-init

Conversation

@jsonbailey
Copy link
Copy Markdown
Contributor

@jsonbailey jsonbailey commented Apr 15, 2026

Summary

  • Removes graph_key as an optional parameter from all LDAIConfigTracker tracking methods
  • Adds graph_key as an optional parameter to LDAIConfigTracker.__init__() — set once at construction, included automatically in all emitted events
  • agent_graph() now uses the internal __evaluate_agent() path when fetching node configs, passing the graph key so each node tracker is born with graph_key set
  • Fixes a variable shadowing bug in agent_graph() where the comprehension variable key shadowed the outer key parameter

Breaking Change

graph_key has been removed from all LDAIConfigTracker tracking methods. Pass it to the constructor instead:

# Before
tracker.track_duration(500, graph_key="my-graph")

# After
tracker = LDAIConfigTracker(..., graph_key="my-graph")
tracker.track_duration(500)

Test plan

  • All existing tracker tests updated to pass graph_key at construction
  • New test: test_agent_graph_node_trackers_have_graph_key verifies node trackers carry the parent graph key
  • Run full test suite in dev container

🤖 Generated with Claude Code


Note

Medium Risk
This is a breaking API change that touches core telemetry emission paths for agent graphs across providers; mistakes could drop graphKey correlation or alter metrics payloads.

Overview
Breaking change: LDAIConfigTracker no longer accepts graph_key on individual track_* calls; graphKey is now set once via LDAIConfigTracker(..., graph_key=...) and automatically included in emitted config-level events.

Updates LangGraph and OpenAI agent-graph runners/callbacks to stop threading the graph tracker into per-node metric flushes/tool-call tracking, and changes LDAIClient.agent_graph() to instantiate node trackers with the parent graph key (also fixing a comprehension variable shadowing bug). Tests are updated accordingly and a new test asserts graph node trackers carry the graph key.

Reviewed by Cursor Bugbot for commit 4549a47. Bugbot is set up for automated code reviews on this repo. Configure here.

jsonbailey and others added 2 commits April 15, 2026 17:28
graph_key is now set once at tracker construction time rather than
passed as an optional parameter to every tracking method. When
agent_graph() builds nodes it uses the internal __evaluate_agent()
path so each node tracker is born with graph_key set to the parent
graph's key. Public tracking methods no longer accept graph_key.

BREAKING CHANGE: The graph_key parameter has been removed from all
LDAIConfigTracker tracking methods (track_duration, track_success,
track_error, track_tokens, track_tool_call, track_tool_calls,
track_feedback, track_eval_scores, track_judge_response,
track_time_to_first_token, track_metrics_of, track_metrics_of_async).
Pass graph_key to the LDAIConfigTracker constructor instead.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Remove graph_key kwarg from tracker method calls in langchain and
openai provider packages. Fix line length in client.py. Update test
helpers to pass graph_key at node tracker construction.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@jsonbailey jsonbailey force-pushed the jb/aic-2238/graphkey-on-tracker-init branch from e5b7cd1 to 7624cf3 Compare April 15, 2026 22:30
@jsonbailey jsonbailey marked this pull request as ready for review April 15, 2026 22:31
@jsonbailey jsonbailey requested a review from a team as a code owner April 15, 2026 22:31
…r runners

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
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 4549a47. Configure here.

Comment thread packages/sdk/server-ai/src/ldai/client.py
@jsonbailey jsonbailey merged commit 20fff24 into main Apr 16, 2026
47 checks passed
@jsonbailey jsonbailey deleted the jb/aic-2238/graphkey-on-tracker-init branch April 16, 2026 15:50
@github-actions github-actions Bot mentioned this pull request Apr 16, 2026
jsonbailey added a commit that referenced this pull request Apr 22, 2026
🤖 I have created a release *beep* *boop*
---


<details><summary>launchdarkly-server-sdk-ai: 0.18.0</summary>

##
[0.18.0](launchdarkly-server-sdk-ai-0.17.0...launchdarkly-server-sdk-ai-0.18.0)
(2026-04-21)


### ⚠ BREAKING CHANGES

* Add per-execution runId, at-most-once tracking, and cross-process
tracker resumption
([#133](#133))
* rename track_latency to track_duration on AIGraphTracker
([#138](#138))
* Move graph_key to AIConfigTracker instantiation
([#134](#134))
* Flatten JudgeResponse and EvalScore into new JudgeResult
([#132](#132))

### Features

* Add per-execution runId, at-most-once tracking, and cross-process
tracker resumption
([#133](#133))
([68685cd](68685cd))
* Flatten JudgeResponse and EvalScore into new JudgeResult
([#132](#132))
([af4e463](af4e463))
* Move graph_key to AIConfigTracker instantiation
([#134](#134))
([20fff24](20fff24))
* rename track_latency to track_duration on AIGraphTracker
([#138](#138))
([05758a7](05758a7))
</details>

<details><summary>launchdarkly-server-sdk-ai-langchain: 0.5.0</summary>

##
[0.5.0](launchdarkly-server-sdk-ai-langchain-0.4.1...launchdarkly-server-sdk-ai-langchain-0.5.0)
(2026-04-21)


### ⚠ BREAKING CHANGES

* Add per-execution runId, at-most-once tracking, and cross-process
tracker resumption
([#133](#133))
* rename track_latency to track_duration on AIGraphTracker
([#138](#138))
* Move graph_key to AIConfigTracker instantiation
([#134](#134))

### Features

* Add per-execution runId, at-most-once tracking, and cross-process
tracker resumption
([#133](#133))
([68685cd](68685cd))
* Move graph_key to AIConfigTracker instantiation
([#134](#134))
([20fff24](20fff24))
* rename track_latency to track_duration on AIGraphTracker
([#138](#138))
([05758a7](05758a7))
</details>

<details><summary>launchdarkly-server-sdk-ai-openai: 0.4.0</summary>

##
[0.4.0](launchdarkly-server-sdk-ai-openai-0.3.0...launchdarkly-server-sdk-ai-openai-0.4.0)
(2026-04-21)


### ⚠ BREAKING CHANGES

* Add per-execution runId, at-most-once tracking, and cross-process
tracker resumption
([#133](#133))
* rename track_latency to track_duration on AIGraphTracker
([#138](#138))
* Move graph_key to AIConfigTracker instantiation
([#134](#134))

### Features

* Add per-execution runId, at-most-once tracking, and cross-process
tracker resumption
([#133](#133))
([68685cd](68685cd))
* Move graph_key to AIConfigTracker instantiation
([#134](#134))
([20fff24](20fff24))
* rename track_latency to track_duration on AIGraphTracker
([#138](#138))
([05758a7](05758a7))
</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**
> Release-only changes, but they publish new versions that include
breaking API updates (tracker lifecycle changes, `track_latency` rename,
judge result flattening) that can impact downstream consumers.
> 
> **Overview**
> Publishes new releases for `launchdarkly-server-sdk-ai` (**0.18.0**)
and the LangChain/OpenAI provider packages (**0.5.0** / **0.4.0**),
updating the release manifest, package versions, and changelogs.
> 
> Updates provider dependencies to require
`launchdarkly-server-sdk-ai>=0.18.0`, and refreshes release
documentation (`PROVENANCE.md`) and `ldai.__version__` to match the new
SDK version.
> 
> <sup>Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit
eecee01. 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>
Co-authored-by: jsonbailey <jbailey@launchdarkly.com>
Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.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