Skip to content

feat: add agent graph tracker#89

Open
andrewklatzke wants to merge 2 commits intomainfrom
aklatzke/REL-12055/agent-graph-tracking
Open

feat: add agent graph tracker#89
andrewklatzke wants to merge 2 commits intomainfrom
aklatzke/REL-12055/agent-graph-tracking

Conversation

@andrewklatzke
Copy link
Contributor

@andrewklatzke andrewklatzke commented Feb 5, 2026

Requirements

  • I have added test coverage for new or changed functionality
  • I have followed the repository's pull request submission guidelines
  • I have validated my changes against all supported platform versions

Describe the solution you've provided

Implements the AIGraphTracker class to handle tracking events for agent graphs in the SDK.

Describe alternatives you've considered

This is the primary implementation of the tracker. It's broken into its own tracker rather than polluting the interface of the BaseTracker or AiConfigTracker since this is a separate entity that has its own interaction & metric patterns.

Additional context

This implements the following events to be tracked:

Edge-level metrics

$ld:ai:graph:redirect<{ sourceKey, redirectedTarget }>
$ld:ai:graph:handoff_success<{ sourceKey, targetKey }>
$ld:ai:graph:handoff_failure<{ sourceKey, targetKey }>

Node level metrics

$ld:ai:graph:node_invocation<{ graphKey, configKey }>
$ld:ai:graph:tool_call<{ graphKey, configKey, toolKey }>
<judge_metrics><{ graphKey, configKey }> (judge on a specific node)

Graph metrics

$ld:ai:graph:invocation_success
$ld:ai:graph:invocation_failure
$ld:ai:graph:latency (total latency of the entire graph invocation)
$ld:ai:graph:total_tokens (total token usage of the graph invocation)
$ld:ai:graph:path<{ graphKey, ...configKey }>
<judge_metrics><{ graphKey }> (judges on final output)

Note

Medium Risk
Introduces new analytics/telemetry behavior and changes the agent_graph return object shape by attaching a tracker, which could affect consumers and increase event volume/cost if used incorrectly.

Overview
Adds a new AIGraphTracker that can emit graph-, node-, and edge-level LaunchDarkly events (invocation success/failure, latency, tokens, path, redirects/handoffs, tool calls, and judge metric scores).

LDAIClient.agent_graph() now builds a tracker from flag variation metadata and attaches it to every returned AgentGraphDefinition (including disabled/invalid graphs), and AgentGraphDefinition exposes it via get_tracker(); AIGraphTracker is also exported from ldai.__init__.

Written by Cursor Bugbot for commit f07f60e. This will update automatically on new commits. Configure here.

@andrewklatzke andrewklatzke requested a review from a team as a code owner February 5, 2026 00:53
@@ -1,11 +1,11 @@
"""Graph implementation for managing AI agent graphs."""

from dataclasses import dataclass
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Unused import here, not sure why it wasn't picked up in previous lint

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.

1 participant