@launchdarkly/server-sdk-ai 0.19.0 → 0.20.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.ts CHANGED
@@ -1,53 +1,6 @@
1
1
  import * as common from '@launchdarkly/js-server-sdk-common';
2
2
  import { LDLogger as LDLogger$1, LDContext, LDFlagValue } from '@launchdarkly/js-server-sdk-common';
3
3
 
4
- /**
5
- * Information about token usage.
6
- */
7
- interface LDTokenUsage {
8
- /**
9
- * Combined token usage.
10
- */
11
- total: number;
12
- /**
13
- * Number of tokens in the input.
14
- */
15
- input: number;
16
- /**
17
- * Number of tokens in the output.
18
- */
19
- output: number;
20
- }
21
-
22
- /**
23
- * Metrics information for AI operations that includes success status and token usage.
24
- * This class combines success/failure tracking with token usage metrics.
25
- */
26
- interface LDAIMetrics {
27
- /**
28
- * Whether the AI operation was successful.
29
- */
30
- success: boolean;
31
- /**
32
- * Token usage information for the operation.
33
- * This will be undefined if no token usage data is available.
34
- */
35
- usage?: LDTokenUsage;
36
- }
37
-
38
- /**
39
- * Structured response from AI models.
40
- */
41
- interface StructuredResponse {
42
- /** The structured data returned by the model */
43
- data: Record<string, unknown>;
44
- /** The raw response from the model */
45
- rawResponse: string;
46
- /**
47
- * Metrics information including success status and token usage.
48
- */
49
- metrics: LDAIMetrics;
50
- }
51
4
  /**
52
5
  * Result from a judge evaluation containing score, reasoning, and metadata.
53
6
  */
@@ -68,6 +21,24 @@ interface LDJudgeResult {
68
21
  reasoning?: string;
69
22
  }
70
23
 
24
+ /**
25
+ * Information about token usage.
26
+ */
27
+ interface LDTokenUsage {
28
+ /**
29
+ * Combined token usage.
30
+ */
31
+ total: number;
32
+ /**
33
+ * Number of tokens in the input.
34
+ */
35
+ input: number;
36
+ /**
37
+ * Number of tokens in the output.
38
+ */
39
+ output: number;
40
+ }
41
+
71
42
  declare function createBedrockTokenUsage(data: {
72
43
  totalTokens?: number;
73
44
  inputTokens?: number;
@@ -94,6 +65,32 @@ declare enum LDFeedbackKind {
94
65
  Negative = "negative"
95
66
  }
96
67
 
68
+ /**
69
+ * Metrics information for AI operations that includes success status and token usage.
70
+ * This class combines success/failure tracking with token usage metrics.
71
+ */
72
+ interface LDAIMetrics {
73
+ /**
74
+ * Whether the AI operation was successful.
75
+ */
76
+ success: boolean;
77
+ /**
78
+ * Token usage information for the operation.
79
+ * This will be undefined if no token usage data is available.
80
+ */
81
+ tokens?: LDTokenUsage;
82
+ /**
83
+ * List of tool call identifiers made during the operation.
84
+ * This will be undefined if no tool calls were made.
85
+ */
86
+ toolCalls?: string[];
87
+ /**
88
+ * Duration of the operation in milliseconds.
89
+ * This will be undefined if duration was not tracked.
90
+ */
91
+ durationMs?: number;
92
+ }
93
+
97
94
  declare function createVercelAISDKTokenUsage(data: {
98
95
  totalTokens?: number;
99
96
  inputTokens?: number;
@@ -103,32 +100,94 @@ declare function createVercelAISDKTokenUsage(data: {
103
100
  }): LDTokenUsage;
104
101
 
105
102
  /**
106
- * Metrics which have been tracked.
103
+ * Summary metrics returned in a ManagedResult or from LDAIConfigTracker.getSummary().
104
+ * Provides a flat view of the key metrics for the completed operation.
107
105
  */
108
106
  interface LDAIMetricSummary {
109
107
  /**
110
- * The duration of generation.
108
+ * Whether the AI operation was successful.
111
109
  */
112
- durationMs?: number;
110
+ success?: boolean;
113
111
  /**
114
- * Information about token usage.
112
+ * Token usage information, if available.
115
113
  */
116
114
  tokens?: LDTokenUsage;
117
115
  /**
118
- * Was generation successful.
116
+ * List of tool call identifiers made during the operation, if any.
119
117
  */
120
- success?: boolean;
118
+ toolCalls?: string[];
121
119
  /**
122
- * Any sentiment about the generation.
120
+ * Duration of the operation in milliseconds, if tracked.
121
+ */
122
+ durationMs?: number;
123
+ /**
124
+ * Time to first token in milliseconds, if tracked.
125
+ */
126
+ timeToFirstTokenMs?: number;
127
+ /**
128
+ * User feedback sentiment for this generation, if provided.
123
129
  */
124
130
  feedback?: {
125
131
  kind: LDFeedbackKind;
126
132
  };
127
133
  /**
128
- * Time to first token for this generation.
134
+ * Resumption token for deferred feedback association.
129
135
  */
130
- timeToFirstTokenMs?: number;
136
+ resumptionToken?: string;
137
+ }
138
+ /**
139
+ * The result returned by a Runner (provider-level) invocation.
140
+ * Providers implement Runner and return RunnerResult from run().
141
+ * This type does NOT include evaluations — those are wired in the managed layer.
142
+ */
143
+ interface RunnerResult {
144
+ /**
145
+ * The text content of the model's response.
146
+ */
147
+ content: string;
148
+ /**
149
+ * Metrics information for the operation.
150
+ */
151
+ metrics: LDAIMetrics;
152
+ /**
153
+ * The raw response object from the provider, if available.
154
+ */
155
+ raw?: unknown;
156
+ /**
157
+ * Parsed structured output, if the provider returned structured data.
158
+ */
159
+ parsed?: Record<string, unknown>;
131
160
  }
161
+ /**
162
+ * The result returned by a managed model invocation (ManagedModel.run()).
163
+ * Includes a promise for asynchronous judge evaluations.
164
+ */
165
+ interface ManagedResult {
166
+ /**
167
+ * The text content of the model's response.
168
+ */
169
+ content: string;
170
+ /**
171
+ * Summarized metrics for this invocation.
172
+ */
173
+ metrics: LDAIMetricSummary;
174
+ /**
175
+ * The raw response object from the provider, if available.
176
+ */
177
+ raw?: unknown;
178
+ /**
179
+ * Parsed structured output, if available.
180
+ */
181
+ parsed?: Record<string, unknown>;
182
+ /**
183
+ * Promise that resolves to the judge evaluation results.
184
+ * This promise encapsulates both evaluation and tracking
185
+ * (tracker.trackJudgeResult is called when it resolves).
186
+ * Awaiting this promise guarantees both evaluation and tracking are complete.
187
+ */
188
+ evaluations: Promise<LDJudgeResult[]>;
189
+ }
190
+
132
191
  /**
133
192
  * The LDAIConfigTracker is used to track various details about AI operations.
134
193
  */
@@ -448,7 +507,7 @@ interface LDAIConfig extends Omit<LDAIConfigDefault, 'enabled'> {
448
507
  * new tracker with a fresh runId. Use createTracker() at the start of each
449
508
  * execution to obtain a tracker, then use it to record metrics for that run.
450
509
  */
451
- createTracker?: () => LDAIConfigTracker;
510
+ createTracker: () => LDAIConfigTracker;
452
511
  }
453
512
  /**
454
513
  * Default Agent-specific AI Config with instructions.
@@ -601,244 +660,136 @@ interface LDAIAgentRequestConfig {
601
660
  type LDAIConfigMode = 'completion' | 'agent' | 'judge';
602
661
 
603
662
  /**
604
- * Chat response structure.
663
+ * Represents a directed edge in an agent graph, connecting a source node to a target node.
605
664
  */
606
- interface ChatResponse {
607
- /**
608
- * The response message from the AI.
609
- */
610
- message: LDMessage;
665
+ interface LDGraphEdge {
611
666
  /**
612
- * Metrics information including success status and token usage.
667
+ * The key of the target AIAgentConfig node.
613
668
  */
614
- metrics: LDAIMetrics;
669
+ key: string;
615
670
  /**
616
- * Promise that resolves to judge evaluation results.
617
- * Only present when judges are configured for evaluation.
671
+ * Optional handoff options that customize how data flows between nodes.
618
672
  */
619
- evaluations?: Promise<LDJudgeResult[]>;
673
+ handoff?: Record<string, unknown>;
620
674
  }
621
-
622
675
  /**
623
- * Abstract base class for AI providers that implement chat model functionality.
624
- * This class provides the contract that all provider implementations must follow
625
- * to integrate with LaunchDarkly's tracking and configuration capabilities.
626
- *
627
- * Following the AICHAT spec recommendation to use base classes with non-abstract methods
628
- * for better extensibility and backwards compatibility.
676
+ * Raw flag value for an agent graph configuration as returned by LaunchDarkly.
677
+ * This represents the data structure delivered by LaunchDarkly for graph configurations.
629
678
  */
630
- declare abstract class AIProvider {
631
- protected readonly logger?: LDLogger$1;
632
- constructor(logger?: LDLogger$1);
633
- /**
634
- * Invoke the chat model with an array of messages.
635
- * This method should convert messages to provider format, invoke the model,
636
- * and return a ChatResponse with the result and metrics.
637
- *
638
- * Default implementation takes no action and returns a placeholder response.
639
- * Provider implementations should override this method.
640
- *
641
- * @param messages Array of LDMessage objects representing the conversation
642
- * @returns Promise that resolves to a ChatResponse containing the model's response
643
- */
644
- invokeModel(_messages: LDMessage[]): Promise<ChatResponse>;
679
+ interface LDAgentGraphFlagValue {
680
+ _ldMeta?: {
681
+ variationKey?: string;
682
+ version?: number;
683
+ enabled?: boolean;
684
+ };
645
685
  /**
646
- * Invoke the chat model with structured output support.
647
- * This method should convert messages to provider format, invoke the model with
648
- * structured output configuration, and return a structured response.
649
- *
650
- * Default implementation takes no action and returns a placeholder response.
651
- * Provider implementations should override this method.
652
- *
653
- * @param messages Array of LDMessage objects representing the conversation
654
- * @param responseStructure Dictionary of output configurations keyed by output name
655
- * @returns Promise that resolves to a structured response
686
+ * The key of the root AIAgentConfig in the graph.
656
687
  */
657
- invokeStructuredModel(_messages: LDMessage[], _responseStructure: Record<string, unknown>): Promise<StructuredResponse>;
688
+ root: string;
658
689
  /**
659
- * Static method that constructs an instance of the provider.
660
- * Each provider implementation must provide their own static create method
661
- * that accepts an AIConfig and returns a configured instance.
662
- *
663
- * @param aiConfig The LaunchDarkly AI configuration
664
- * @param logger Optional logger for the provider
665
- * @returns Promise that resolves to a configured provider instance
690
+ * Object mapping source agent config keys to arrays of target edges.
666
691
  */
667
- static create(aiConfig: LDAIConfigKind, logger?: LDLogger$1): Promise<AIProvider>;
692
+ edges?: Record<string, LDGraphEdge[]>;
668
693
  }
669
-
670
694
  /**
671
- * Judge implementation that handles evaluation functionality and conversation management.
695
+ * Summarized graph-level metrics for a completed graph invocation, as
696
+ * returned by {@link ManagedAgentGraph.run} via {@link ManagedGraphResult.metrics}.
672
697
  *
673
- * According to the AIEval spec, judges are AI Configs with mode: "judge" that evaluate
674
- * other AI Configs using structured output.
698
+ * For the tracker-layer incremental view (where fields populate as tracking
699
+ * calls arrive), see {@link LDGraphTracker.getSummary}, which returns a
700
+ * `Partial<LDAIGraphMetricSummary>`.
675
701
  */
676
- declare class Judge {
677
- private readonly _aiConfig;
678
- private readonly _aiProvider;
679
- private readonly _logger?;
680
- constructor(_aiConfig: LDAIJudgeConfig, _aiProvider: AIProvider, logger?: LDLogger$1);
702
+ interface LDAIGraphMetricSummary {
681
703
  /**
682
- * Gets the evaluation metric key, prioritizing evaluationMetricKey over evaluationMetricKeys.
683
- * Falls back to the first valid (non-empty, non-whitespace) value in evaluationMetricKeys if evaluationMetricKey is not provided.
684
- * Treats empty strings and whitespace-only strings as invalid.
685
- * @returns The evaluation metric key, or undefined if not available
704
+ * Whether the graph invocation succeeded.
686
705
  */
687
- private _getEvaluationMetricKey;
688
- /**
689
- * Evaluates an AI response using the judge's configuration.
690
- *
691
- * @param input The input prompt or question that was provided to the AI
692
- * @param output The AI-generated response to be evaluated
693
- * @param samplingRate Sampling rate (0-1) to determine if evaluation should be processed (defaults to 1)
694
- * @returns Promise that resolves to evaluation results
695
- */
696
- evaluate(input: string, output: string, samplingRate?: number): Promise<LDJudgeResult>;
706
+ success: boolean;
697
707
  /**
698
- * Evaluates an AI response from chat messages and response.
699
- *
700
- * @param messages Array of messages representing the conversation history
701
- * @param response The AI response to be evaluated
702
- * @param samplingRatio Sampling ratio (0-1) to determine if evaluation should be processed (defaults to 1)
703
- * @returns Promise that resolves to evaluation results
708
+ * Execution path through the graph as an ordered array of config keys.
704
709
  */
705
- evaluateMessages(messages: LDMessage[], response: ChatResponse, samplingRatio?: number): Promise<LDJudgeResult>;
710
+ path: string[];
706
711
  /**
707
- * Returns the AI Config used by this judge.
712
+ * Per-node metric summaries keyed by agent config key.
708
713
  */
709
- getAIConfig(): LDAIJudgeConfig;
714
+ nodeMetrics: Record<string, LDAIMetricSummary>;
710
715
  /**
711
- * Returns the AI provider used by this judge.
716
+ * Total graph execution duration in milliseconds, if tracked.
712
717
  */
713
- getProvider(): AIProvider;
718
+ durationMs?: number;
714
719
  /**
715
- * Constructs evaluation messages by combining judge's config messages with input/output.
720
+ * Aggregate token usage across the entire graph invocation, if available.
716
721
  */
717
- private _constructEvaluationMessages;
722
+ tokens?: LDTokenUsage;
718
723
  /**
719
- * Interpolates message content with variables using Mustache templating.
724
+ * Resumption token for deferred feedback association.
720
725
  */
721
- private _interpolateMessage;
722
- /**
723
- * Parses the structured evaluation response. Expects top-level {score, reasoning}.
724
- * Returns score and reasoning, or undefined if parsing fails.
725
- */
726
- private _parseEvaluationResponse;
726
+ resumptionToken?: string;
727
727
  }
728
-
729
728
  /**
730
- * Concrete implementation of TrackedChat that provides chat functionality
731
- * by delegating to an AIProvider implementation.
732
- * This class handles conversation management and tracking, while delegating
733
- * the actual model invocation to the provider.
729
+ * Graph-level metrics for a completed graph run, as returned by a graph runner.
730
+ * Does NOT include handoffs or evaluations — those are managed-layer concerns.
734
731
  */
735
- declare class TrackedChat {
736
- protected readonly aiConfig: LDAICompletionConfig;
737
- protected readonly provider: AIProvider;
738
- protected readonly judges: Record<string, Judge>;
739
- private readonly _logger?;
740
- protected messages: LDMessage[];
741
- constructor(aiConfig: LDAICompletionConfig, provider: AIProvider, judges?: Record<string, Judge>, _logger?: LDLogger$1 | undefined);
742
- /**
743
- * Invoke the chat model with a prompt string.
744
- * This method handles conversation management and tracking, delegating to the provider's invokeModel method.
745
- */
746
- invoke(prompt: string): Promise<ChatResponse>;
747
- /**
748
- * Evaluates the response with all configured judges.
749
- * Returns a promise that resolves to an array of evaluation results.
750
- *
751
- * @param messages Array of messages representing the conversation history
752
- * @param response The AI response to be evaluated
753
- * @returns Promise resolving to array of judge evaluation results
754
- */
755
- private _evaluateWithJudges;
732
+ interface LDAIGraphMetrics {
756
733
  /**
757
- * Get the underlying AI configuration used to initialize this TrackedChat.
734
+ * Whether the graph invocation succeeded.
758
735
  */
759
- getConfig(): LDAICompletionConfig;
736
+ success: boolean;
760
737
  /**
761
- * Get the underlying AI provider instance.
762
- * This provides direct access to the provider for advanced use cases.
738
+ * Execution path through the graph as an ordered array of config keys.
763
739
  */
764
- getProvider(): AIProvider;
740
+ path: string[];
765
741
  /**
766
- * Get the judges associated with this TrackedChat.
767
- * Returns a record of judge instances keyed by their configuration keys.
742
+ * Total graph execution duration in milliseconds, if tracked.
768
743
  */
769
- getJudges(): Record<string, Judge>;
744
+ durationMs?: number;
770
745
  /**
771
- * Append messages to the conversation history.
772
- * Adds messages to the conversation history without invoking the model,
773
- * which is useful for managing multi-turn conversations or injecting context.
774
- *
775
- * @param messages Array of messages to append to the conversation history
746
+ * Aggregate token usage across the entire graph invocation, if available.
776
747
  */
777
- appendMessages(messages: LDMessage[]): void;
748
+ tokens?: LDTokenUsage;
778
749
  /**
779
- * Get all messages in the conversation history.
780
- *
781
- * @param includeConfigMessages Whether to include the config messages from the AIConfig.
782
- * Defaults to false.
783
- * @returns Array of messages. When includeConfigMessages is true, returns both config
784
- * messages and conversation history with config messages prepended. When false,
785
- * returns only the conversation history messages.
750
+ * Per-node metrics keyed by agent config key.
786
751
  */
787
- getMessages(includeConfigMessages?: boolean): LDMessage[];
752
+ nodeMetrics: Record<string, LDAIMetrics>;
788
753
  }
789
-
790
754
  /**
791
- * Represents a directed edge in an agent graph, connecting a source node to a target node.
755
+ * The result returned by a graph runner invocation (provider-level).
756
+ * Does NOT include evaluations or handoffs.
792
757
  */
793
- interface LDGraphEdge {
758
+ interface AgentGraphRunnerResult {
794
759
  /**
795
- * The key of the target AIAgentConfig node.
760
+ * The text content of the graph's final response.
796
761
  */
797
- key: string;
798
- /**
799
- * Optional handoff options that customize how data flows between nodes.
800
- */
801
- handoff?: Record<string, unknown>;
802
- }
803
- /**
804
- * Raw flag value for an agent graph configuration as returned by LaunchDarkly.
805
- * This represents the data structure delivered by LaunchDarkly for graph configurations.
806
- */
807
- interface LDAgentGraphFlagValue {
808
- _ldMeta?: {
809
- variationKey?: string;
810
- version?: number;
811
- enabled?: boolean;
812
- };
762
+ content: string;
813
763
  /**
814
- * The key of the root AIAgentConfig in the graph.
764
+ * Graph-level metrics for this invocation.
815
765
  */
816
- root: string;
766
+ metrics: LDAIGraphMetrics;
817
767
  /**
818
- * Object mapping source agent config keys to arrays of target edges.
768
+ * The raw response object from the provider, if available.
819
769
  */
820
- edges?: Record<string, LDGraphEdge[]>;
770
+ raw?: unknown;
821
771
  }
822
772
  /**
823
- * Accumulated graph-level metrics collected by an LDGraphTracker.
773
+ * The result returned by a managed graph invocation (ManagedAgentGraph.run()).
824
774
  */
825
- interface LDGraphMetricSummary {
775
+ interface ManagedGraphResult {
826
776
  /**
827
- * Whether the graph invocation succeeded. Absent if not yet tracked.
777
+ * The text content of the graph's final response.
828
778
  */
829
- success?: boolean;
779
+ content: string;
830
780
  /**
831
- * Total graph execution duration in milliseconds. Absent if not yet tracked.
781
+ * Summarized metrics for this graph invocation.
832
782
  */
833
- durationMs?: number;
783
+ metrics: LDAIGraphMetricSummary;
834
784
  /**
835
- * Aggregate token usage across the entire graph invocation. Absent if not yet tracked.
785
+ * The raw response object from the provider, if available.
836
786
  */
837
- tokens?: LDTokenUsage;
787
+ raw?: unknown;
838
788
  /**
839
- * Execution path through the graph as an array of config keys. Absent if not yet tracked.
789
+ * Promise that resolves to the judge evaluation results.
790
+ * Awaiting this promise guarantees both evaluation and tracking are complete.
840
791
  */
841
- path?: string[];
792
+ evaluations: Promise<LDJudgeResult[]>;
842
793
  }
843
794
  /**
844
795
  * Tracking metadata returned by {@link LDGraphTracker.getTrackData}.
@@ -862,6 +813,104 @@ interface LDGraphTrackData {
862
813
  version: number;
863
814
  }
864
815
 
816
+ /**
817
+ * Runner protocol for AI model providers.
818
+ *
819
+ * A single Runner interface covers completion, agent, and judge use cases.
820
+ * For structured output (e.g., judge evaluation), pass an `outputType` schema
821
+ * and access the parsed result via `RunnerResult.parsed`.
822
+ */
823
+ interface Runner {
824
+ /**
825
+ * Invoke the model with the given input string.
826
+ *
827
+ * @param input The string input to the model.
828
+ * @param outputType Optional JSON schema for structured output. When provided,
829
+ * the model should return structured data accessible via `RunnerResult.parsed`.
830
+ * @returns Promise resolving to a RunnerResult.
831
+ */
832
+ run(input: string, outputType?: Record<string, unknown>): Promise<RunnerResult>;
833
+ }
834
+ /**
835
+ * Runner protocol for agent graph providers.
836
+ *
837
+ * Providers implementing AgentGraphRunner can execute an entire agent graph
838
+ * and return a structured AgentGraphRunnerResult.
839
+ */
840
+ interface AgentGraphRunner {
841
+ /**
842
+ * Execute the agent graph with the given input.
843
+ *
844
+ * @param input The user input to process through the graph.
845
+ * @returns Promise resolving to an AgentGraphRunnerResult.
846
+ */
847
+ run(input: string): Promise<AgentGraphRunnerResult>;
848
+ }
849
+
850
+ /**
851
+ * ManagedAgent provides agent invocation with automatic tracking and automatic
852
+ * judge evaluation.
853
+ *
854
+ * The class is stateless: each `run()` call sends the prompt directly to the
855
+ * underlying `Runner` and returns a `ManagedResult`. Conversation history,
856
+ * if any, must be managed by the caller (or by the Runner implementation).
857
+ *
858
+ * Obtain an instance via `LDAIClient.createAgent()`.
859
+ */
860
+ declare class ManagedAgent {
861
+ protected readonly aiAgentConfig: LDAIAgentConfig;
862
+ protected readonly runner: Runner;
863
+ private readonly _logger?;
864
+ constructor(aiAgentConfig: LDAIAgentConfig, runner: Runner, _logger?: LDLogger$1 | undefined);
865
+ /**
866
+ * Invoke the agent with a prompt string and return a ManagedResult.
867
+ *
868
+ * `run()` resolves before `ManagedResult.evaluations` resolves. Awaiting
869
+ * `evaluations` guarantees both judge evaluation and tracker.trackJudgeResult()
870
+ * are complete.
871
+ *
872
+ * @param prompt The user input to send to the agent.
873
+ * @returns Promise resolving to ManagedResult (before evaluations settle).
874
+ */
875
+ run(prompt: string): Promise<ManagedResult>;
876
+ /**
877
+ * Get the underlying AI agent configuration used to initialize this ManagedAgent.
878
+ */
879
+ getConfig(): LDAIAgentConfig;
880
+ }
881
+
882
+ /**
883
+ * ManagedModel provides chat-completion invocation with automatic tracking and
884
+ * automatic judge evaluation.
885
+ *
886
+ * The class is stateless: each `run()` call sends the prompt directly to the
887
+ * underlying `Runner` and returns a `ManagedResult`. Conversation history,
888
+ * if any, must be managed by the caller (or by the Runner implementation).
889
+ *
890
+ * Obtain an instance via `LDAIClient.createModel()`.
891
+ */
892
+ declare class ManagedModel {
893
+ protected readonly aiConfig: LDAICompletionConfig;
894
+ protected readonly runner: Runner;
895
+ private readonly _logger?;
896
+ constructor(aiConfig: LDAICompletionConfig, runner: Runner, _logger?: LDLogger$1 | undefined);
897
+ /**
898
+ * Invoke the model with a prompt string and return a ManagedResult.
899
+ *
900
+ * `run()` resolves before `ManagedResult.evaluations` resolves. Awaiting
901
+ * `evaluations` guarantees both judge evaluation and tracker.trackJudgeResult()
902
+ * are complete.
903
+ *
904
+ * @param prompt The user input to send to the model.
905
+ * @returns Promise resolving to ManagedResult (before evaluations settle).
906
+ */
907
+ run(prompt: string): Promise<ManagedResult>;
908
+ /**
909
+ * Get the underlying AI configuration used to initialize this ManagedModel.
910
+ */
911
+ getConfig(): LDAICompletionConfig;
912
+ }
913
+
865
914
  /**
866
915
  * Tracks graph-level and edge-level metrics for an agent graph invocation.
867
916
  *
@@ -886,11 +935,20 @@ interface LDGraphTracker {
886
935
  /**
887
936
  * Returns tracking metadata to be included in every LDClient.track call.
888
937
  */
889
- getTrackData(): LDGraphTrackData;
938
+ getTrackData(): {
939
+ runId: string;
940
+ graphKey: string;
941
+ variationKey?: string;
942
+ version: number;
943
+ };
890
944
  /**
891
- * Returns a snapshot of all graph-level metrics tracked so far.
945
+ * Returns a snapshot of all graph-level metrics tracked so far. Fields
946
+ * populate incrementally as `track*` methods are called, so the result is
947
+ * a `Partial<LDAIGraphMetricSummary>`. Once the graph invocation has
948
+ * completed via `ManagedAgentGraph.run()`, prefer `ManagedGraphResult.metrics`
949
+ * which is fully populated.
892
950
  */
893
- getSummary(): LDGraphMetricSummary;
951
+ getSummary(): Partial<LDAIGraphMetricSummary>;
894
952
  /**
895
953
  * A URL-safe Base64-encoded (RFC 4648, no padding) token encoding the tracker's
896
954
  * identity. Pass this token to {@link LDGraphTrackerImpl.fromResumptionToken} to
@@ -1103,6 +1161,187 @@ declare class AgentGraphDefinition {
1103
1161
  static collectAllKeys(graph: LDAgentGraphFlagValue): Set<string>;
1104
1162
  }
1105
1163
 
1164
+ /**
1165
+ * ManagedAgentGraph wraps an AgentGraphDefinition and provides a managed run()
1166
+ * method that returns ManagedGraphResult with async judge evaluations.
1167
+ *
1168
+ * The runner function is responsible for executing the graph and returning
1169
+ * an AgentGraphRunnerResult. ManagedAgentGraph builds the managed result from
1170
+ * the runner result, including LDAIGraphMetricSummary with the graphTracker's
1171
+ * resumptionToken.
1172
+ */
1173
+ declare class ManagedAgentGraph {
1174
+ private readonly _graphDefinition;
1175
+ private readonly _logger?;
1176
+ constructor(_graphDefinition: AgentGraphDefinition, _logger?: LDLogger$1 | undefined);
1177
+ /**
1178
+ * Runs the agent graph using the provided runner function and returns a ManagedGraphResult.
1179
+ *
1180
+ * The runner function receives the graph tracker and AgentGraphDefinition,
1181
+ * executes the graph, and returns an AgentGraphRunnerResult.
1182
+ *
1183
+ * run() returns before ManagedGraphResult.evaluations resolves.
1184
+ *
1185
+ * @param runner Async function that executes the graph and returns AgentGraphRunnerResult.
1186
+ * @returns ManagedGraphResult with LDAIGraphMetricSummary and evaluations promise.
1187
+ */
1188
+ run(runner: (graphDefinition: AgentGraphDefinition, graphTracker: LDGraphTracker) => Promise<AgentGraphRunnerResult>): Promise<ManagedGraphResult>;
1189
+ /**
1190
+ * Converts per-node LDAIMetrics from the runner into LDAIMetricSummary by
1191
+ * creating a per-node tracker, firing tracking events, and calling getSummary().
1192
+ */
1193
+ private _trackNodeMetrics;
1194
+ /**
1195
+ * Returns the underlying AgentGraphDefinition.
1196
+ */
1197
+ getGraphDefinition(): AgentGraphDefinition;
1198
+ }
1199
+
1200
+ /**
1201
+ * Chat response structure.
1202
+ */
1203
+ interface ChatResponse {
1204
+ /**
1205
+ * The response message from the AI.
1206
+ */
1207
+ message: LDMessage;
1208
+ /**
1209
+ * Metrics information including success status and token usage.
1210
+ */
1211
+ metrics: LDAIMetrics;
1212
+ /**
1213
+ * Promise that resolves to judge evaluation results.
1214
+ * Only present when judges are configured for evaluation.
1215
+ */
1216
+ evaluations?: Promise<LDJudgeResult[]>;
1217
+ }
1218
+
1219
+ /**
1220
+ * Judge implementation that handles evaluation functionality and conversation management.
1221
+ *
1222
+ * According to the AIEval spec, judges are AI Configs with mode: "judge" that evaluate
1223
+ * other AI Configs using structured output.
1224
+ */
1225
+ declare class Judge {
1226
+ private readonly _aiConfig;
1227
+ private readonly _runner;
1228
+ private readonly _sampleRate;
1229
+ private readonly _logger?;
1230
+ constructor(_aiConfig: LDAIJudgeConfig, _runner: Runner, _sampleRate?: number, logger?: LDLogger$1);
1231
+ /**
1232
+ * The default sampling rate baked in at construction. Used by `evaluate` /
1233
+ * `evaluateMessages` when no per-call rate is supplied.
1234
+ */
1235
+ get sampleRate(): number;
1236
+ /**
1237
+ * Gets the evaluation metric key, prioritizing evaluationMetricKey over evaluationMetricKeys.
1238
+ * Falls back to the first valid (non-empty, non-whitespace) value in evaluationMetricKeys if evaluationMetricKey is not provided.
1239
+ * Treats empty strings and whitespace-only strings as invalid.
1240
+ * @returns The evaluation metric key, or undefined if not available
1241
+ */
1242
+ private _getEvaluationMetricKey;
1243
+ /**
1244
+ * Evaluates an AI response using the judge's configuration.
1245
+ *
1246
+ * @param input The input prompt or question that was provided to the AI
1247
+ * @param output The AI-generated response to be evaluated
1248
+ * @param samplingRate Sampling rate (0-1) to determine if evaluation should be processed.
1249
+ * When omitted, the Judge's constructor-default rate is used. An explicit `0` overrides
1250
+ * the default — only `undefined` falls through.
1251
+ * @returns Promise that resolves to evaluation results
1252
+ */
1253
+ evaluate(input: string, output: string, samplingRate?: number): Promise<LDJudgeResult>;
1254
+ /**
1255
+ * Evaluates an AI response from chat messages and response.
1256
+ *
1257
+ * @param messages Array of messages representing the conversation history
1258
+ * @param response The AI response to be evaluated
1259
+ * @param samplingRatio Sampling ratio (0-1). When omitted, the Judge's
1260
+ * constructor-default rate is used.
1261
+ * @returns Promise that resolves to evaluation results
1262
+ */
1263
+ evaluateMessages(messages: LDMessage[], response: ChatResponse, samplingRatio?: number): Promise<LDJudgeResult>;
1264
+ /**
1265
+ * Returns the AI Config used by this judge.
1266
+ */
1267
+ getAIConfig(): LDAIJudgeConfig;
1268
+ /**
1269
+ * Returns the runner used by this judge.
1270
+ */
1271
+ getRunner(): Runner;
1272
+ /**
1273
+ * Builds the evaluation input string passed to the runner.
1274
+ *
1275
+ * Combines the original prompt and the response into a single, well-known
1276
+ * format the judge model is expected to evaluate.
1277
+ */
1278
+ private _buildEvaluationInput;
1279
+ /**
1280
+ * Parses the structured evaluation response. Expects top-level {score, reasoning}.
1281
+ * Returns score and reasoning, or undefined if parsing fails.
1282
+ */
1283
+ private _parseEvaluationResponse;
1284
+ }
1285
+
1286
+ /**
1287
+ * A registry of callable tools keyed by tool name.
1288
+ * Mirrors Python's `Dict[str, Callable]` — values are typically functions
1289
+ * that the provider invokes when the model requests a tool call.
1290
+ */
1291
+ type ToolRegistry = Record<string, (...args: any[]) => unknown>;
1292
+ /**
1293
+ * Abstract base class for AI providers.
1294
+ *
1295
+ * An `AIProvider` is a per-provider factory: it is instantiated once per
1296
+ * provider package and is responsible for constructing focused runtime
1297
+ * capability objects via {@link createModel}, {@link createAgent}, and
1298
+ * {@link createAgentGraph}.
1299
+ *
1300
+ * Provider packages subclass `AIProvider` and override the methods they
1301
+ * support. The default implementations return `undefined`, mirroring Python's
1302
+ * base-class behaviour, so providers only need to implement the modes they
1303
+ * actually support.
1304
+ */
1305
+ declare abstract class AIProvider {
1306
+ protected _logger?: LDLogger$1;
1307
+ constructor(logger?: LDLogger$1);
1308
+ /**
1309
+ * Create a Runner for a completion or judge AI Config.
1310
+ *
1311
+ * Override in provider subclasses to return a configured {@link Runner}.
1312
+ * Default implementation returns `undefined`.
1313
+ *
1314
+ * @param config The completion or judge AI configuration.
1315
+ * @returns Promise resolving to a {@link Runner}, or `undefined` if this
1316
+ * provider does not support model creation.
1317
+ */
1318
+ createModel(_config: LDAICompletionConfig | LDAIJudgeConfig): Promise<Runner | undefined>;
1319
+ /**
1320
+ * Create a Runner for an agent AI Config.
1321
+ *
1322
+ * Override in provider subclasses to return a configured {@link Runner}.
1323
+ * Default implementation returns `undefined`.
1324
+ *
1325
+ * @param config The agent AI configuration.
1326
+ * @param tools Optional registry of callable tools.
1327
+ * @returns Promise resolving to a {@link Runner}, or `undefined` if this
1328
+ * provider does not support agent creation.
1329
+ */
1330
+ createAgent(_config: LDAIAgentConfig, _tools?: ToolRegistry): Promise<Runner | undefined>;
1331
+ /**
1332
+ * Create an AgentGraphRunner for an agent graph definition.
1333
+ *
1334
+ * Override in provider subclasses to return a configured {@link AgentGraphRunner}.
1335
+ * Default implementation returns `undefined`.
1336
+ *
1337
+ * @param graphDef The agent graph definition.
1338
+ * @param tools Optional registry of callable tools.
1339
+ * @returns Promise resolving to an {@link AgentGraphRunner}, or `undefined` if
1340
+ * this provider does not support graph execution.
1341
+ */
1342
+ createAgentGraph(_graphDef: AgentGraphDefinition, _tools?: ToolRegistry): Promise<AgentGraphRunner | undefined>;
1343
+ }
1344
+
1106
1345
  /**
1107
1346
  * List of supported AI providers.
1108
1347
  */
@@ -1112,27 +1351,92 @@ declare const SUPPORTED_AI_PROVIDERS: readonly ["openai", "langchain", "vercel"]
1112
1351
  */
1113
1352
  type SupportedAIProvider = (typeof SUPPORTED_AI_PROVIDERS)[number];
1114
1353
  /**
1115
- * Factory for creating AIProvider instances based on the provider configuration.
1354
+ * Sole entry point for runner creation.
1355
+ *
1356
+ * RunnerFactory is the single factory for creating {@link Runner} and
1357
+ * {@link AgentGraphRunner} instances. It mirrors the Python RunnerFactory
1358
+ * pattern: it knows about supported provider packages, loads them dynamically
1359
+ * via {@link _getProviderFactory}, and delegates creation to the factory
1360
+ * instance methods on {@link AIProvider}.
1361
+ *
1362
+ * Provider packages subclass {@link AIProvider} and override its factory
1363
+ * methods (`createModel`, `createAgent`, `createAgentGraph`).
1116
1364
  */
1117
- declare class AIProviderFactory {
1365
+ declare class RunnerFactory {
1118
1366
  /**
1119
- * Create an AIProvider instance based on the AI configuration.
1120
- * This method attempts to load provider-specific implementations dynamically.
1121
- * Returns undefined if the provider is not supported.
1367
+ * Load and return the AIProvider factory for the given provider type.
1368
+ *
1369
+ * This is the single place in the codebase that knows provider package names.
1370
+ * Each supported provider package exports a `*RunnerFactory` class that
1371
+ * extends {@link AIProvider}; this method instantiates it directly.
1122
1372
  *
1123
- * @param aiConfig The AI configuration
1124
- * @param logger Optional logger for logging provider initialization
1125
- * @param defaultAiProvider Optional default AI provider to use
1373
+ * @param providerType One of the {@link SUPPORTED_AI_PROVIDERS} values.
1374
+ * @param logger Optional logger forwarded to the provider factory.
1375
+ * @returns A configured {@link AIProvider} instance, or `undefined` if the
1376
+ * package cannot be loaded.
1126
1377
  */
1127
- static create(aiConfig: LDAIConfigKind, logger?: LDLogger$1, defaultAiProvider?: SupportedAIProvider): Promise<AIProvider | undefined>;
1378
+ private static _getProviderFactory;
1128
1379
  /**
1129
1380
  * Determine which providers to try based on defaultAiProvider and providerName.
1381
+ *
1382
+ * Mirrors Python's `_get_providers_to_try` helper.
1130
1383
  */
1131
1384
  private static _getProvidersToTry;
1132
1385
  /**
1133
- * Try to create a provider of the specified type.
1386
+ * Try each provider in order and return the first non-undefined result.
1387
+ *
1388
+ * Mirrors Python's `_with_fallback` helper. Loads each provider factory via
1389
+ * {@link _getProviderFactory} and calls `fn` with it. Returns the first
1390
+ * truthy result, or `undefined` if no provider succeeds.
1391
+ *
1392
+ * @param providers Ordered list of provider types to try.
1393
+ * @param fn Callback that calls the appropriate factory method on the provider.
1394
+ * @param logger Optional logger forwarded to each provider factory.
1134
1395
  */
1135
- private static _tryCreateProvider;
1396
+ private static _withFallback;
1397
+ /**
1398
+ * Create a Runner for the given AI configuration.
1399
+ *
1400
+ * Suitable for completion, judge, and agent config modes. Dynamically
1401
+ * loads the matching provider package via {@link _getProviderFactory} and
1402
+ * delegates to its {@link AIProvider.createModel} method.
1403
+ *
1404
+ * @param config The AI configuration (completion, agent, or judge).
1405
+ * @param logger Optional logger forwarded to the underlying provider.
1406
+ * @param defaultAiProvider Optional provider override
1407
+ * ('openai', 'langchain', 'vercel', …). When set, only that provider is
1408
+ * tried. When omitted, providers are tried in priority order based on the
1409
+ * provider name in the config.
1410
+ * @returns A configured {@link Runner} ready to invoke the model, or
1411
+ * `undefined` if no suitable provider could be loaded.
1412
+ */
1413
+ static createModel(config: LDAICompletionConfig | LDAIJudgeConfig, logger?: LDLogger$1, defaultAiProvider?: SupportedAIProvider): Promise<Runner | undefined>;
1414
+ /**
1415
+ * Create a Runner for an agent AI Config.
1416
+ *
1417
+ * Delegates to the provider factory's {@link AIProvider.createAgent} method.
1418
+ *
1419
+ * @param config The agent AI configuration.
1420
+ * @param tools Optional registry of callable tools.
1421
+ * @param logger Optional logger forwarded to the underlying provider.
1422
+ * @param defaultAiProvider Optional provider override.
1423
+ * @returns A configured {@link Runner}, or `undefined` if no suitable
1424
+ * provider could be loaded.
1425
+ */
1426
+ static createAgent(config: LDAIAgentConfig, tools?: ToolRegistry, logger?: LDLogger$1, defaultAiProvider?: SupportedAIProvider): Promise<Runner | undefined>;
1427
+ /**
1428
+ * Create an AgentGraphRunner for the given agent graph definition.
1429
+ *
1430
+ * Delegates to the provider factory's {@link AIProvider.createAgentGraph} method.
1431
+ *
1432
+ * @param graphDef The agent graph definition.
1433
+ * @param tools Optional registry of callable tools.
1434
+ * @param logger Optional logger forwarded to the underlying provider.
1435
+ * @param defaultAiProvider Optional provider override.
1436
+ * @returns A configured {@link AgentGraphRunner}, or `undefined` if no
1437
+ * suitable provider could be loaded.
1438
+ */
1439
+ static createAgentGraph(graphDef: AgentGraphDefinition, tools?: ToolRegistry, logger?: LDLogger$1, defaultAiProvider?: SupportedAIProvider): Promise<AgentGraphRunner | undefined>;
1136
1440
  }
1137
1441
 
1138
1442
  /**
@@ -1192,7 +1496,7 @@ interface LDAIClient {
1192
1496
  * }
1193
1497
  * ```
1194
1498
  */
1195
- completionConfig(key: string, context: LDContext, defaultValue?: LDAICompletionConfigDefault, variables?: Record<string, unknown>): Promise<LDAICompletionConfig>;
1499
+ completionConfig(key: string, context: LDContext, defaultValue?: LDAICompletionConfigDefault, variables?: Record<string, unknown>, defaultAiProvider?: SupportedAIProvider): Promise<LDAICompletionConfig>;
1196
1500
  /**
1197
1501
  * @deprecated Use `completionConfig` instead. This method will be removed in a future version.
1198
1502
  */
@@ -1231,7 +1535,7 @@ interface LDAIClient {
1231
1535
  * agentConfig.tracker.trackSuccess();
1232
1536
  * ```
1233
1537
  */
1234
- agentConfig(key: string, context: LDContext, defaultValue?: LDAIAgentConfigDefault, variables?: Record<string, unknown>): Promise<LDAIAgentConfig>;
1538
+ agentConfig(key: string, context: LDContext, defaultValue?: LDAIAgentConfigDefault, variables?: Record<string, unknown>, defaultAiProvider?: SupportedAIProvider): Promise<LDAIAgentConfig>;
1235
1539
  /**
1236
1540
  * @deprecated Use `agentConfig` instead. This method will be removed in a future version.
1237
1541
  */
@@ -1316,10 +1620,9 @@ interface LDAIClient {
1316
1620
  */
1317
1621
  agents<const T extends readonly LDAIAgentRequestConfig[]>(agentConfigs: T, context: LDContext): Promise<Record<T[number]['key'], LDAIAgentConfig>>;
1318
1622
  /**
1319
- * Returns a TrackedChat instance for chat interactions.
1320
- * This method serves as the primary entry point for creating TrackedChat instances from configuration.
1623
+ * Creates and returns a new ManagedModel instance for LLM model interactions.
1321
1624
  *
1322
- * @param key The key identifying the AI chat configuration to use.
1625
+ * @param key The key identifying the AI completion configuration to use.
1323
1626
  * @param context The standard LDContext used when evaluating flags.
1324
1627
  * @param defaultValue Optional fallback when the configuration is not available from LaunchDarkly.
1325
1628
  * When omitted or null, a disabled default is used.
@@ -1327,7 +1630,7 @@ interface LDAIClient {
1327
1630
  * The variables will also be used for judge evaluation. For the judge only, the variables
1328
1631
  * `message_history` and `response_to_evaluate` are reserved and will be ignored.
1329
1632
  * @param defaultAiProvider Optional default AI provider to use.
1330
- * @returns A promise that resolves to the TrackedChat instance, or null if the configuration is disabled.
1633
+ * @returns A promise that resolves to the ManagedModel instance, or undefined if the configuration is disabled.
1331
1634
  *
1332
1635
  * @example
1333
1636
  * ```
@@ -1343,18 +1646,34 @@ interface LDAIClient {
1343
1646
  * };
1344
1647
  * const variables = { customerName: 'John' };
1345
1648
  *
1346
- * const chat = await client.createChat(key, context, defaultValue, variables);
1347
- * if (chat) {
1348
- * const response = await chat.invoke("I need help with my order");
1349
- * console.log(response.message.content);
1649
+ * const model = await client.createModel(key, context, defaultValue, variables);
1650
+ * if (model) {
1651
+ * const result = await model.run("I need help with my order");
1652
+ * console.log(result.content);
1350
1653
  * }
1351
1654
  * ```
1352
1655
  */
1353
- createChat(key: string, context: LDContext, defaultValue?: LDAICompletionConfigDefault, variables?: Record<string, unknown>, defaultAiProvider?: SupportedAIProvider): Promise<TrackedChat | undefined>;
1656
+ createModel(key: string, context: LDContext, defaultValue?: LDAICompletionConfigDefault, variables?: Record<string, unknown>, defaultAiProvider?: SupportedAIProvider): Promise<ManagedModel | undefined>;
1657
+ /**
1658
+ * Creates and returns a new ManagedAgent instance for agent interactions.
1659
+ * Evaluations are wired automatically and exposed on ManagedResult.evaluations.
1660
+ *
1661
+ * @param key The key identifying the agent AI config to use.
1662
+ * @param context The standard LDContext used when evaluating flags.
1663
+ * @param defaultValue Optional fallback when the configuration is not available from LaunchDarkly.
1664
+ * @param variables Dictionary of values for instruction interpolation.
1665
+ * @param defaultAiProvider Optional default AI provider to use.
1666
+ * @returns A promise that resolves to the ManagedAgent instance, or undefined if disabled.
1667
+ */
1668
+ createAgent(key: string, context: LDContext, defaultValue?: LDAIAgentConfigDefault, variables?: Record<string, unknown>, defaultAiProvider?: SupportedAIProvider): Promise<ManagedAgent | undefined>;
1354
1669
  /**
1355
- * @deprecated Use `createChat` instead. This method will be removed in a future version.
1670
+ * @deprecated Use `createModel` instead. This method will be removed in a future version.
1356
1671
  */
1357
- initChat(key: string, context: LDContext, defaultValue?: LDAICompletionConfigDefault, variables?: Record<string, unknown>, defaultAiProvider?: SupportedAIProvider): Promise<TrackedChat | undefined>;
1672
+ createChat(key: string, context: LDContext, defaultValue?: LDAICompletionConfigDefault, variables?: Record<string, unknown>, defaultAiProvider?: SupportedAIProvider): Promise<ManagedModel | undefined>;
1673
+ /**
1674
+ * @deprecated Use `createModel` instead. This method will be removed in a future version.
1675
+ */
1676
+ initChat(key: string, context: LDContext, defaultValue?: LDAICompletionConfigDefault, variables?: Record<string, unknown>, defaultAiProvider?: SupportedAIProvider): Promise<ManagedModel | undefined>;
1358
1677
  /**
1359
1678
  * Creates and returns a new Judge instance for AI evaluation.
1360
1679
  *
@@ -1365,6 +1684,8 @@ interface LDAIClient {
1365
1684
  * @param variables Dictionary of values for instruction interpolation.
1366
1685
  * The variables `message_history` and `response_to_evaluate` are reserved for the judge and will be ignored.
1367
1686
  * @param defaultAiProvider Optional default AI provider to use.
1687
+ * @param sampleRate Optional default sampling rate (0-1) baked into the Judge.
1688
+ * Used by `Judge.evaluate()` when no per-call rate is supplied. Defaults to 1.0.
1368
1689
  * @returns Promise that resolves to a Judge instance or undefined if disabled/unsupported
1369
1690
  *
1370
1691
  * @example
@@ -1388,7 +1709,7 @@ interface LDAIClient {
1388
1709
  * }
1389
1710
  * ```
1390
1711
  */
1391
- createJudge(key: string, context: LDContext, defaultValue?: LDAIJudgeConfigDefault, variables?: Record<string, unknown>, defaultAiProvider?: SupportedAIProvider): Promise<Judge | undefined>;
1712
+ createJudge(key: string, context: LDContext, defaultValue?: LDAIJudgeConfigDefault, variables?: Record<string, unknown>, defaultAiProvider?: SupportedAIProvider, sampleRate?: number): Promise<Judge | undefined>;
1392
1713
  /**
1393
1714
  * Reconstructs an AIConfigTracker from a resumption token string previously
1394
1715
  * obtained from a tracker's `resumptionToken` property. Use this to associate
@@ -1483,8 +1804,13 @@ declare class LDGraphTrackerImpl implements LDGraphTracker {
1483
1804
  * @param context LDContext for the new tracker.
1484
1805
  */
1485
1806
  static fromResumptionToken(token: string, ldClient: LDClientMin, context: LDContext): LDGraphTrackerImpl;
1486
- getTrackData(): LDGraphTrackData;
1487
- getSummary(): LDGraphMetricSummary;
1807
+ getTrackData(): {
1808
+ runId: string;
1809
+ graphKey: string;
1810
+ variationKey?: string;
1811
+ version: number;
1812
+ };
1813
+ getSummary(): Partial<LDAIGraphMetricSummary>;
1488
1814
  get resumptionToken(): string;
1489
1815
  trackInvocationSuccess(): void;
1490
1816
  trackInvocationFailure(): void;
@@ -1513,4 +1839,4 @@ declare class LDGraphTrackerImpl implements LDGraphTracker {
1513
1839
  declare function initAi(ldClient: LDClientMin): LDAIClient;
1514
1840
  type LDLogger = common.LDLogger;
1515
1841
 
1516
- export { AIProvider, AIProviderFactory, AgentGraphDefinition, AgentGraphNode, type ChatResponse, Judge, type LDAIAgentConfig, type LDAIAgentConfigDefault, type LDAIAgentRequestConfig, type LDAIClient, type LDAICompletionConfig, type LDAICompletionConfigDefault, type LDAIConfig, type LDAIConfigDefault, type LDAIConfigDefaultKind, type LDAIConfigKind, type LDAIConfigMode, type LDAIConfigTracker, type LDAIJudgeConfig, type LDAIJudgeConfigDefault, type LDAIMetrics, type LDAgentGraphFlagValue, LDFeedbackKind, type LDGraphEdge, type LDGraphMetricSummary, type LDGraphTrackData, type LDGraphTracker, LDGraphTrackerImpl, type LDJudge, type LDJudgeConfiguration, type LDJudgeResult, type LDLogger, type LDMessage, type LDModelConfig, type LDProviderConfig, type LDTokenUsage, type LDTool, SUPPORTED_AI_PROVIDERS, type StructuredResponse, type SupportedAIProvider, TrackedChat, type TraversalFn, createBedrockTokenUsage, createOpenAiUsage, createVercelAISDKTokenUsage, initAi };
1842
+ export { AIProvider, AgentGraphDefinition, AgentGraphNode, type AgentGraphRunner, type AgentGraphRunnerResult, type ChatResponse, Judge, type LDAIAgentConfig, type LDAIAgentConfigDefault, type LDAIAgentRequestConfig, type LDAIClient, type LDAICompletionConfig, type LDAICompletionConfigDefault, type LDAIConfig, type LDAIConfigDefault, type LDAIConfigDefaultKind, type LDAIConfigKind, type LDAIConfigMode, type LDAIConfigTracker, type LDAIGraphMetricSummary, type LDAIGraphMetrics, type LDAIJudgeConfig, type LDAIJudgeConfigDefault, type LDAIMetricSummary, type LDAIMetrics, type LDAgentGraphFlagValue, LDFeedbackKind, type LDGraphEdge, type LDGraphTrackData, type LDGraphTracker, LDGraphTrackerImpl, type LDJudge, type LDJudgeConfiguration, type LDJudgeResult, type LDLogger, type LDMessage, type LDModelConfig, type LDProviderConfig, type LDTokenUsage, type LDTool, ManagedAgent, ManagedAgentGraph, type ManagedGraphResult, ManagedModel, type ManagedResult, type Runner, RunnerFactory, type RunnerResult, SUPPORTED_AI_PROVIDERS, type SupportedAIProvider, type ToolRegistry, type TraversalFn, createBedrockTokenUsage, createOpenAiUsage, createVercelAISDKTokenUsage, initAi };