Skip to content

refactor(agents): rename the graph span to launchdarkly.graph for consistency - #112

Merged
apucacao merged 2 commits into
mainfrom
ag/rename-graph-span-clean
Sep 25, 2026
Merged

apucacao merged 2 commits into
mainfrom
ag/rename-graph-span-clean

Conversation

@apucacao

@apucacao apucacao commented Sep 25, 2026 •

Copy link
Copy Markdown
Contributor

Summary

js-ai-sdk#16 merged today and moved the graph span under the launchdarkly. prefix. Before, the graph span carried ld.ai.graph.key while the invoke_agent root carried launchdarkly.graph.key, so one graph key had two names. ld.ai. is where LaunchDarkly keeps metric and event keys, so it stays reserved for those. This PR makes the same rename in the three Python native_graph.py handlers, so both SDKs emit the same span again:

before after
ld.ai.graph launchdarkly.graph
ld.ai.graph.key launchdarkly.graph.key
ld.ai.graph.path launchdarkly.graph.path

This isn't a new convention. It brings the graph span in line with one both SDKs already follow. Every other LaunchDarkly-owned attribute the handlers write is already under launchdarkly.:

  • launchdarkly.operation.type
  • launchdarkly.config.key
  • launchdarkly.variation.key
  • launchdarkly.run.id
  • launchdarkly.graph.key (on the invoke_agent root)
  • launchdarkly.run.cancelled
  • launchdarkly.stream.abandoned

The graph span and its two attributes were the only LaunchDarkly-specific span names still under ld.ai.. After this PR there are none in either SDK, and the rule is written down in js-ai-sdk's AGENTS.md: anything LaunchDarkly owns that isn't an OTel semantic convention goes under launchdarkly., span names included.

The contract doc already said to make this rename once #16 merged.

Nothing reads the old names. gonfalon and observability have no references to any of them.

Testing

  • uv run pytest on the parity test and the three test_native_graph.py files: 152 passed, 11 skipped.
  • ruff check and ruff format --check pass on the changed files.
  • Leaving the full suite and mypy to CI.

Original branch: ag/rename-graph-span


Note

Overview
Aligns Python native graph telemetry with js-ai-sdk #16 by renaming graph OpenTelemetry spans and attributes from ld.ai.graph / ld.ai.graph.key / ld.ai.graph.path to launchdarkly.graph, launchdarkly.graph.key, and launchdarkly.graph.path.

The same rename is applied in all three native_graph.py implementations (claude-agents, langchain-agents, openai-agents). TELEMETRY-CONTRACT.md is updated to document the new names and rationale (launchdarkly. for LD-owned span data; ld.ai. reserved for metrics/events). Tests and tests/test_cross_handler_parity.py vocabulary lock / span-name regex are updated to match.

$ld:ai:* metric/event keys are unchanged—only trace span names and attributes.

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

The graph span carried ld.ai.graph.key while the invoke_agent root
carried launchdarkly.graph.key, so one graph key had two attribute
names. js-ai-sdk #16 fixed this in TypeScript by moving the graph span,
its key and its path under launchdarkly., and keeping ld.ai. for metric
and event keys. This makes the same rename in the three native_graph.py
handlers so both SDKs emit the same names again:

  ld.ai.graph       -> launchdarkly.graph
  ld.ai.graph.key   -> launchdarkly.graph.key
  ld.ai.graph.path  -> launchdarkly.graph.path

The parity test's vocabulary lock and span-name pattern move with it.
launchdarkly.graph.key was already in the lock as a root attribute, so
it is listed once.
The span table, the conversation-id section and section 10 still named
ld.ai.graph, and section 10 said to rename only if js-ai-sdk #16 merged.
It has, so the contract now names launchdarkly.graph and says why the
prefix changed. The span table pointed at section 8 for the graph span;
it now points at section 10, where the graph span is described.
@apucacao
apucacao marked this pull request as ready for review September 25, 2026 15:29
@apucacao apucacao changed the title refactor(agents): rename the graph span to launchdarkly.graph to match the TypeScript SDK refactor(agents): rename the graph span to launchdarkly.graph for consistency Sep 25, 2026
@apucacao
apucacao merged commit 3a78bd8 into main Sep 25, 2026
8 checks passed
@apucacao
apucacao deleted the ag/rename-graph-span-clean branch September 25, 2026 16:32
donei003 added a commit that referenced this pull request Sep 26, 2026
…trajectory into stream judges

CI was failing the cross-handler vocabulary lock: graph().stream()'s root
span and its key attribute regressed to ld.ai.graph / ld.ai.graph.key,
the names main renamed away from in #112/b16dfda. Both call sites
(invoke's and stream's span creation) are fixed, along with the one doc
comment and test file that named the old span.

Also two review findings (Devin + Cursor Bugbot) on the merge:
stream_node and stream_route's multi-edge branch discarded the
trajectory execute_and_stream now renders before calling run_judges, so
a streamed graph node's judge saw no tool calls while the same node
invoked without streaming did. Both now carry it through, matching
run_node. Added regression tests for each path.

Co-Authored-By: Claude Sonnet 5 <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