@evalgate/sdk 2.0.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.
Files changed (141) hide show
  1. package/CHANGELOG.md +638 -0
  2. package/README.md +398 -0
  3. package/dist/assertions.d.ts +189 -0
  4. package/dist/assertions.js +662 -0
  5. package/dist/batch.d.ts +68 -0
  6. package/dist/batch.js +179 -0
  7. package/dist/cache.d.ts +65 -0
  8. package/dist/cache.js +131 -0
  9. package/dist/cli/api.d.ts +108 -0
  10. package/dist/cli/api.js +132 -0
  11. package/dist/cli/baseline.d.ts +10 -0
  12. package/dist/cli/baseline.js +172 -0
  13. package/dist/cli/check.d.ts +73 -0
  14. package/dist/cli/check.js +355 -0
  15. package/dist/cli/ci-context.d.ts +6 -0
  16. package/dist/cli/ci-context.js +112 -0
  17. package/dist/cli/ci.d.ts +45 -0
  18. package/dist/cli/ci.js +192 -0
  19. package/dist/cli/config.d.ts +30 -0
  20. package/dist/cli/config.js +230 -0
  21. package/dist/cli/constants.d.ts +15 -0
  22. package/dist/cli/constants.js +18 -0
  23. package/dist/cli/diff.d.ts +173 -0
  24. package/dist/cli/diff.js +685 -0
  25. package/dist/cli/discover.d.ts +84 -0
  26. package/dist/cli/discover.js +419 -0
  27. package/dist/cli/doctor.d.ts +88 -0
  28. package/dist/cli/doctor.js +675 -0
  29. package/dist/cli/env.d.ts +21 -0
  30. package/dist/cli/env.js +42 -0
  31. package/dist/cli/explain.d.ts +58 -0
  32. package/dist/cli/explain.js +561 -0
  33. package/dist/cli/formatters/github.d.ts +8 -0
  34. package/dist/cli/formatters/github.js +135 -0
  35. package/dist/cli/formatters/human.d.ts +6 -0
  36. package/dist/cli/formatters/human.js +110 -0
  37. package/dist/cli/formatters/json.d.ts +6 -0
  38. package/dist/cli/formatters/json.js +10 -0
  39. package/dist/cli/formatters/pr-comment.d.ts +12 -0
  40. package/dist/cli/formatters/pr-comment.js +103 -0
  41. package/dist/cli/formatters/types.d.ts +103 -0
  42. package/dist/cli/formatters/types.js +8 -0
  43. package/dist/cli/gate.d.ts +21 -0
  44. package/dist/cli/gate.js +179 -0
  45. package/dist/cli/impact-analysis.d.ts +63 -0
  46. package/dist/cli/impact-analysis.js +252 -0
  47. package/dist/cli/index.d.ts +9 -0
  48. package/dist/cli/index.js +332 -0
  49. package/dist/cli/init.d.ts +16 -0
  50. package/dist/cli/init.js +292 -0
  51. package/dist/cli/manifest.d.ts +103 -0
  52. package/dist/cli/manifest.js +282 -0
  53. package/dist/cli/migrate.d.ts +41 -0
  54. package/dist/cli/migrate.js +349 -0
  55. package/dist/cli/policy-packs.d.ts +23 -0
  56. package/dist/cli/policy-packs.js +89 -0
  57. package/dist/cli/print-config.d.ts +29 -0
  58. package/dist/cli/print-config.js +270 -0
  59. package/dist/cli/profiles.d.ts +28 -0
  60. package/dist/cli/profiles.js +30 -0
  61. package/dist/cli/reason-codes.d.ts +17 -0
  62. package/dist/cli/reason-codes.js +19 -0
  63. package/dist/cli/regression-gate.d.ts +15 -0
  64. package/dist/cli/regression-gate.js +341 -0
  65. package/dist/cli/render/snippet.d.ts +5 -0
  66. package/dist/cli/render/snippet.js +15 -0
  67. package/dist/cli/render/sort.d.ts +10 -0
  68. package/dist/cli/render/sort.js +24 -0
  69. package/dist/cli/report/build-check-report.d.ts +19 -0
  70. package/dist/cli/report/build-check-report.js +132 -0
  71. package/dist/cli/run.d.ts +101 -0
  72. package/dist/cli/run.js +395 -0
  73. package/dist/cli/share.d.ts +17 -0
  74. package/dist/cli/share.js +91 -0
  75. package/dist/cli/upgrade.d.ts +15 -0
  76. package/dist/cli/upgrade.js +492 -0
  77. package/dist/cli/workspace.d.ts +31 -0
  78. package/dist/cli/workspace.js +68 -0
  79. package/dist/client.d.ts +368 -0
  80. package/dist/client.js +893 -0
  81. package/dist/client.request.test.d.ts +1 -0
  82. package/dist/client.request.test.js +232 -0
  83. package/dist/context.d.ts +134 -0
  84. package/dist/context.js +215 -0
  85. package/dist/errors.d.ts +82 -0
  86. package/dist/errors.js +298 -0
  87. package/dist/export.d.ts +195 -0
  88. package/dist/export.js +344 -0
  89. package/dist/index.d.ts +44 -0
  90. package/dist/index.js +153 -0
  91. package/dist/integrations/anthropic.d.ts +91 -0
  92. package/dist/integrations/anthropic.js +163 -0
  93. package/dist/integrations/openai-eval.d.ts +57 -0
  94. package/dist/integrations/openai-eval.js +232 -0
  95. package/dist/integrations/openai.d.ts +92 -0
  96. package/dist/integrations/openai.js +160 -0
  97. package/dist/local.d.ts +39 -0
  98. package/dist/local.js +148 -0
  99. package/dist/logger.d.ts +128 -0
  100. package/dist/logger.js +227 -0
  101. package/dist/matchers/index.d.ts +1 -0
  102. package/dist/matchers/index.js +6 -0
  103. package/dist/matchers/to-pass-gate.d.ts +29 -0
  104. package/dist/matchers/to-pass-gate.js +35 -0
  105. package/dist/pagination.d.ts +74 -0
  106. package/dist/pagination.js +139 -0
  107. package/dist/regression.d.ts +100 -0
  108. package/dist/regression.js +44 -0
  109. package/dist/runtime/adapters/config-to-dsl.d.ts +33 -0
  110. package/dist/runtime/adapters/config-to-dsl.js +400 -0
  111. package/dist/runtime/adapters/testsuite-to-dsl.d.ts +63 -0
  112. package/dist/runtime/adapters/testsuite-to-dsl.js +276 -0
  113. package/dist/runtime/context.d.ts +26 -0
  114. package/dist/runtime/context.js +74 -0
  115. package/dist/runtime/eval.d.ts +46 -0
  116. package/dist/runtime/eval.js +244 -0
  117. package/dist/runtime/execution-mode.d.ts +80 -0
  118. package/dist/runtime/execution-mode.js +357 -0
  119. package/dist/runtime/executor.d.ts +16 -0
  120. package/dist/runtime/executor.js +152 -0
  121. package/dist/runtime/registry.d.ts +78 -0
  122. package/dist/runtime/registry.js +403 -0
  123. package/dist/runtime/run-report.d.ts +200 -0
  124. package/dist/runtime/run-report.js +222 -0
  125. package/dist/runtime/types.d.ts +356 -0
  126. package/dist/runtime/types.js +76 -0
  127. package/dist/snapshot.d.ts +176 -0
  128. package/dist/snapshot.js +322 -0
  129. package/dist/streaming.d.ts +173 -0
  130. package/dist/streaming.js +268 -0
  131. package/dist/testing.d.ts +273 -0
  132. package/dist/testing.js +317 -0
  133. package/dist/types.d.ts +754 -0
  134. package/dist/types.js +54 -0
  135. package/dist/utils/input-hash.d.ts +8 -0
  136. package/dist/utils/input-hash.js +41 -0
  137. package/dist/version.d.ts +7 -0
  138. package/dist/version.js +10 -0
  139. package/dist/workflows.d.ts +389 -0
  140. package/dist/workflows.js +671 -0
  141. package/package.json +117 -0
package/dist/types.js ADDED
@@ -0,0 +1,54 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.SDKError = exports.EvaluationTemplates = void 0;
4
+ /**
5
+ * Evaluation template categories
6
+ * Updated with new template types for comprehensive LLM testing
7
+ */
8
+ exports.EvaluationTemplates = {
9
+ // Core Testing
10
+ UNIT_TESTING: "unit-testing",
11
+ OUTPUT_QUALITY: "output-quality",
12
+ // Advanced Evaluation
13
+ PROMPT_OPTIMIZATION: "prompt-optimization",
14
+ CHAIN_OF_THOUGHT: "chain-of-thought",
15
+ LONG_CONTEXT_TESTING: "long-context-testing",
16
+ MODEL_STEERING: "model-steering",
17
+ REGRESSION_TESTING: "regression-testing",
18
+ CONFIDENCE_CALIBRATION: "confidence-calibration",
19
+ // Safety & Compliance
20
+ SAFETY_COMPLIANCE: "safety-compliance",
21
+ // Domain-Specific
22
+ RAG_EVALUATION: "rag-evaluation",
23
+ CODE_GENERATION: "code-generation",
24
+ SUMMARIZATION: "summarization",
25
+ };
26
+ /**
27
+ * SDK Error class with additional error details
28
+ *
29
+ * Common error codes:
30
+ * - MISSING_API_KEY: API key not provided
31
+ * - MISSING_ORGANIZATION_ID: Organization ID not provided
32
+ * - MISSING_REQUIRED_FIELDS: Required parameters missing
33
+ * - INVALID_ID: Invalid ID format
34
+ * - NOT_FOUND: Resource not found
35
+ * - UNAUTHORIZED: Authentication required
36
+ * - FORBIDDEN: Access forbidden
37
+ * - RATE_LIMIT_EXCEEDED: Rate limit exceeded
38
+ * - TIMEOUT: Request timed out
39
+ * - NETWORK_ERROR: Network connectivity issue
40
+ * - VALIDATION_ERROR: Request validation failed
41
+ * - INTERNAL_SERVER_ERROR: Server error
42
+ * - FEATURE_LIMIT_REACHED: Feature usage limit reached
43
+ * - UNKNOWN_ERROR: Unknown error occurred
44
+ */
45
+ class SDKError extends Error {
46
+ constructor(message, code, statusCode, details) {
47
+ super(message);
48
+ this.name = "SDKError";
49
+ this.code = code;
50
+ this.statusCode = statusCode;
51
+ this.details = details;
52
+ }
53
+ }
54
+ exports.SDKError = SDKError;
@@ -0,0 +1,8 @@
1
+ /**
2
+ * Input normalization and hashing for deterministic matching.
3
+ * Must match platform's @/lib/utils/input-hash.ts for reportToEvalGate.
4
+ */
5
+ /** Normalize input for stable matching (whitespace, JSON key order). */
6
+ export declare function normalizeInput(input: string): string;
7
+ /** SHA-256 hash of normalized input. */
8
+ export declare function sha256Input(s: string): string;
@@ -0,0 +1,41 @@
1
+ "use strict";
2
+ /**
3
+ * Input normalization and hashing for deterministic matching.
4
+ * Must match platform's @/lib/utils/input-hash.ts for reportToEvalGate.
5
+ */
6
+ var __importDefault = (this && this.__importDefault) || function (mod) {
7
+ return (mod && mod.__esModule) ? mod : { "default": mod };
8
+ };
9
+ Object.defineProperty(exports, "__esModule", { value: true });
10
+ exports.normalizeInput = normalizeInput;
11
+ exports.sha256Input = sha256Input;
12
+ const node_crypto_1 = __importDefault(require("node:crypto"));
13
+ function sortKeys(obj) {
14
+ const sorted = {};
15
+ for (const k of Object.keys(obj).sort()) {
16
+ const v = obj[k];
17
+ sorted[k] =
18
+ v != null && typeof v === "object" && !Array.isArray(v)
19
+ ? sortKeys(v)
20
+ : v;
21
+ }
22
+ return sorted;
23
+ }
24
+ /** Normalize input for stable matching (whitespace, JSON key order). */
25
+ function normalizeInput(input) {
26
+ const s = input.trim();
27
+ try {
28
+ const obj = JSON.parse(s);
29
+ return JSON.stringify(sortKeys(obj));
30
+ }
31
+ catch {
32
+ return s.replace(/\s+/g, " ");
33
+ }
34
+ }
35
+ /** SHA-256 hash of normalized input. */
36
+ function sha256Input(s) {
37
+ return node_crypto_1.default
38
+ .createHash("sha256")
39
+ .update(normalizeInput(s), "utf8")
40
+ .digest("hex");
41
+ }
@@ -0,0 +1,7 @@
1
+ /**
2
+ * SDK and API spec versions for request headers.
3
+ * X-EvalGate-SDK-Version: SDK package version
4
+ * X-EvalGate-Spec-Version: OpenAPI spec version (docs/openapi.json info.version)
5
+ */
6
+ export declare const SDK_VERSION = "2.0.0";
7
+ export declare const SPEC_VERSION = "2.0.0";
@@ -0,0 +1,10 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.SPEC_VERSION = exports.SDK_VERSION = void 0;
4
+ /**
5
+ * SDK and API spec versions for request headers.
6
+ * X-EvalGate-SDK-Version: SDK package version
7
+ * X-EvalGate-Spec-Version: OpenAPI spec version (docs/openapi.json info.version)
8
+ */
9
+ exports.SDK_VERSION = "2.0.0";
10
+ exports.SPEC_VERSION = "2.0.0";
@@ -0,0 +1,389 @@
1
+ /**
2
+ * Workflow Tracer SDK
3
+ * Multi-agent workflow instrumentation, decision tracking, and cost capture
4
+ *
5
+ * @example
6
+ * ```typescript
7
+ * import { WorkflowTracer } from '@evalgate/sdk';
8
+ *
9
+ * const tracer = new WorkflowTracer(client, { organizationId: 123 });
10
+ *
11
+ * // Start a workflow
12
+ * const workflow = await tracer.startWorkflow('Customer Support Pipeline');
13
+ *
14
+ * // Record agent spans and handoffs
15
+ * const span1 = await tracer.startAgentSpan('RouterAgent', { input: query });
16
+ * await tracer.recordDecision({
17
+ * agent: 'RouterAgent',
18
+ * chosen: 'delegate_to_technical',
19
+ * alternatives: [{ action: 'delegate_to_billing', confidence: 0.3 }],
20
+ * reasoning: 'Query contains technical keywords'
21
+ * });
22
+ * await tracer.recordHandoff('RouterAgent', 'TechnicalAgent', { issue: 'API error' });
23
+ * await tracer.endAgentSpan(span1, { result: 'delegated' });
24
+ *
25
+ * // End workflow with final output
26
+ * await tracer.endWorkflow({ resolution: 'Issue resolved' });
27
+ * ```
28
+ */
29
+ import type { AIEvalClient } from "./client";
30
+ /**
31
+ * Node in a workflow DAG
32
+ */
33
+ export interface WorkflowNode {
34
+ id: string;
35
+ type: "agent" | "tool" | "decision" | "parallel" | "human" | "llm";
36
+ name: string;
37
+ config?: Record<string, unknown>;
38
+ }
39
+ /**
40
+ * Edge connecting nodes in a workflow DAG
41
+ */
42
+ export interface WorkflowEdge {
43
+ from: string;
44
+ to: string;
45
+ condition?: string;
46
+ label?: string;
47
+ }
48
+ /**
49
+ * Complete workflow definition (DAG structure)
50
+ */
51
+ export interface WorkflowDefinition {
52
+ nodes: WorkflowNode[];
53
+ edges: WorkflowEdge[];
54
+ entrypoint: string;
55
+ metadata?: Record<string, unknown>;
56
+ }
57
+ interface LangChainExecutor {
58
+ invoke?: (input: unknown, config?: unknown) => Promise<unknown>;
59
+ call?: (input: unknown, config?: unknown) => Promise<unknown>;
60
+ }
61
+ interface CrewAI {
62
+ kickoff?: (input?: unknown) => Promise<unknown>;
63
+ }
64
+ interface LangChainConversation {
65
+ initiate_chat?: (...args: unknown[]) => Promise<unknown>;
66
+ }
67
+ /**
68
+ * Active workflow context
69
+ */
70
+ export interface WorkflowContext {
71
+ id: number;
72
+ traceId: number;
73
+ name: string;
74
+ startedAt: string;
75
+ definition?: WorkflowDefinition;
76
+ metadata?: Record<string, unknown>;
77
+ }
78
+ /**
79
+ * Workflow run status
80
+ */
81
+ export type WorkflowStatus = "running" | "completed" | "failed" | "cancelled";
82
+ /**
83
+ * Handoff types between agents
84
+ */
85
+ export type HandoffType = "delegation" | "escalation" | "parallel" | "fallback";
86
+ /**
87
+ * Agent handoff record
88
+ */
89
+ export interface AgentHandoff {
90
+ fromAgent?: string;
91
+ toAgent: string;
92
+ handoffType: HandoffType;
93
+ context?: Record<string, unknown>;
94
+ timestamp: string;
95
+ }
96
+ /**
97
+ * Alternative action that was considered but not chosen
98
+ */
99
+ export interface DecisionAlternative {
100
+ action: string;
101
+ confidence: number;
102
+ reasoning?: string;
103
+ rejectedReason?: string;
104
+ }
105
+ /**
106
+ * Decision types made by agents
107
+ */
108
+ export type DecisionType = "action" | "tool" | "delegate" | "respond" | "route";
109
+ /**
110
+ * Parameters for recording a decision
111
+ */
112
+ export interface RecordDecisionParams {
113
+ /** Name of the agent making the decision */
114
+ agent: string;
115
+ /** Type of decision */
116
+ type: DecisionType;
117
+ /** The action/tool/response that was chosen */
118
+ chosen: string;
119
+ /** Alternative options that were considered */
120
+ alternatives: DecisionAlternative[];
121
+ /** Reasoning for the choice */
122
+ reasoning?: string;
123
+ /** Confidence score 0-100 */
124
+ confidence?: number;
125
+ /** Factors that influenced the decision */
126
+ contextFactors?: string[];
127
+ /** Input context at decision time */
128
+ inputContext?: Record<string, unknown>;
129
+ }
130
+ /**
131
+ * LLM provider names
132
+ */
133
+ export type LLMProvider = "openai" | "anthropic" | "google" | "cohere" | "mistral" | "custom";
134
+ /**
135
+ * Cost categories for tracking
136
+ */
137
+ export type CostCategory = "llm" | "tool" | "embedding" | "other";
138
+ /**
139
+ * Parameters for recording cost
140
+ */
141
+ export interface RecordCostParams {
142
+ provider: LLMProvider | string;
143
+ model: string;
144
+ inputTokens: number;
145
+ outputTokens: number;
146
+ category?: CostCategory;
147
+ isRetry?: boolean;
148
+ retryNumber?: number;
149
+ }
150
+ /**
151
+ * Cost record with calculated values
152
+ */
153
+ export interface CostRecord extends RecordCostParams {
154
+ totalTokens: number;
155
+ inputCost: string;
156
+ outputCost: string;
157
+ totalCost: string;
158
+ }
159
+ /**
160
+ * Options for WorkflowTracer
161
+ */
162
+ export interface WorkflowTracerOptions {
163
+ /** Organization ID for traces */
164
+ organizationId?: number;
165
+ /** Whether to auto-calculate costs (requires provider pricing) */
166
+ autoCalculateCost?: boolean;
167
+ /** Custom trace name prefix */
168
+ tracePrefix?: string;
169
+ /** Whether to capture full input/output (may be large) */
170
+ captureFullPayloads?: boolean;
171
+ /** Debug mode */
172
+ debug?: boolean;
173
+ }
174
+ /**
175
+ * Agent span context
176
+ */
177
+ export interface AgentSpanContext {
178
+ spanId: string;
179
+ agentName: string;
180
+ startTime: string;
181
+ parentSpanId?: string;
182
+ metadata?: Record<string, unknown>;
183
+ }
184
+ /**
185
+ * WorkflowTracer - Instrument multi-agent workflows with tracing, decision auditing, and cost tracking
186
+ *
187
+ * @example
188
+ * ```typescript
189
+ * const tracer = new WorkflowTracer(client, { organizationId: 123 });
190
+ *
191
+ * // Simple workflow
192
+ * await tracer.startWorkflow('Data Processing Pipeline');
193
+ *
194
+ * const agentSpan = await tracer.startAgentSpan('DataAgent', { source: 'api' });
195
+ * // ... agent work ...
196
+ * await tracer.endAgentSpan(agentSpan, { processed: 100 });
197
+ *
198
+ * await tracer.endWorkflow({ status: 'success' });
199
+ * ```
200
+ */
201
+ export declare class WorkflowTracer {
202
+ private client;
203
+ private options;
204
+ private currentWorkflow;
205
+ private activeSpans;
206
+ private handoffs;
207
+ private decisions;
208
+ private costs;
209
+ private spanCounter;
210
+ constructor(client: AIEvalClient, options?: WorkflowTracerOptions);
211
+ /**
212
+ * Start a new workflow
213
+ *
214
+ * @example
215
+ * ```typescript
216
+ * const workflow = await tracer.startWorkflow('Customer Support Flow', {
217
+ * nodes: [
218
+ * { id: 'router', type: 'agent', name: 'RouterAgent' },
219
+ * { id: 'technical', type: 'agent', name: 'TechnicalAgent' },
220
+ * ],
221
+ * edges: [{ from: 'router', to: 'technical', condition: 'is_technical' }],
222
+ * entrypoint: 'router'
223
+ * });
224
+ * ```
225
+ */
226
+ startWorkflow(name: string, definition?: WorkflowDefinition, metadata?: Record<string, unknown>): Promise<WorkflowContext>;
227
+ /**
228
+ * End the current workflow
229
+ */
230
+ endWorkflow(output?: Record<string, unknown>, status?: WorkflowStatus): Promise<void>;
231
+ /**
232
+ * Start an agent span within the workflow
233
+ *
234
+ * @example
235
+ * ```typescript
236
+ * const span = await tracer.startAgentSpan('RouterAgent', {
237
+ * input: userQuery
238
+ * });
239
+ * ```
240
+ */
241
+ startAgentSpan(agentName: string, input?: Record<string, unknown>, parentSpanId?: string): Promise<AgentSpanContext>;
242
+ /**
243
+ * End an agent span
244
+ */
245
+ endAgentSpan(span: AgentSpanContext, output?: Record<string, unknown>, error?: string): Promise<void>;
246
+ /**
247
+ * Record a handoff between agents
248
+ *
249
+ * @example
250
+ * ```typescript
251
+ * await tracer.recordHandoff(
252
+ * 'RouterAgent',
253
+ * 'TechnicalAgent',
254
+ * { issueType: 'api_error', priority: 'high' },
255
+ * 'delegation'
256
+ * );
257
+ * ```
258
+ */
259
+ recordHandoff(fromAgent: string | undefined, toAgent: string, context?: Record<string, unknown>, handoffType?: HandoffType): Promise<void>;
260
+ /**
261
+ * Record a decision made by an agent
262
+ *
263
+ * @example
264
+ * ```typescript
265
+ * await tracer.recordDecision({
266
+ * agent: 'RouterAgent',
267
+ * type: 'route',
268
+ * chosen: 'technical_support',
269
+ * alternatives: [
270
+ * { action: 'billing_support', confidence: 0.3, reasoning: 'No billing keywords' },
271
+ * { action: 'general_support', confidence: 0.1, reasoning: 'Fallback option' }
272
+ * ],
273
+ * reasoning: 'Query contains technical terms like "API", "error", "endpoint"',
274
+ * confidence: 85,
275
+ * contextFactors: ['keyword_match', 'user_history']
276
+ * });
277
+ * ```
278
+ */
279
+ recordDecision(params: RecordDecisionParams): Promise<void>;
280
+ /**
281
+ * Record cost for an LLM call or operation
282
+ *
283
+ * @example
284
+ * ```typescript
285
+ * await tracer.recordCost({
286
+ * provider: 'openai',
287
+ * model: 'gpt-4',
288
+ * inputTokens: 500,
289
+ * outputTokens: 200,
290
+ * category: 'llm',
291
+ * isRetry: false
292
+ * });
293
+ * ```
294
+ */
295
+ recordCost(params: RecordCostParams): Promise<CostRecord>;
296
+ /**
297
+ * Get total cost for the current workflow
298
+ */
299
+ getTotalCost(): number;
300
+ /**
301
+ * Get cost breakdown by category
302
+ */
303
+ getCostBreakdown(): Record<CostCategory, number>;
304
+ /**
305
+ * Get known pricing for a model (can be extended or fetched from API)
306
+ */
307
+ private getModelPricing;
308
+ /**
309
+ * Generate a unique ID
310
+ */
311
+ private generateId;
312
+ /**
313
+ * Log if debug mode is enabled
314
+ */
315
+ private log;
316
+ /**
317
+ * Get current workflow context
318
+ */
319
+ getCurrentWorkflow(): WorkflowContext | null;
320
+ /**
321
+ * Check if a workflow is active
322
+ */
323
+ isWorkflowActive(): boolean;
324
+ /**
325
+ * Get all recorded handoffs
326
+ */
327
+ getHandoffs(): AgentHandoff[];
328
+ /**
329
+ * Get all recorded decisions
330
+ */
331
+ getDecisions(): RecordDecisionParams[];
332
+ /**
333
+ * Get all recorded costs
334
+ */
335
+ getCosts(): CostRecord[];
336
+ }
337
+ /**
338
+ * Wrap a LangChain agent for automatic workflow tracing
339
+ *
340
+ * @example
341
+ * ```typescript
342
+ * import { AgentExecutor } from 'langchain/agents';
343
+ *
344
+ * const executor = new AgentExecutor({ ... });
345
+ * const tracedExecutor = traceLangChainAgent(executor, tracer);
346
+ *
347
+ * const result = await tracedExecutor.invoke({ input: 'Hello' });
348
+ * ```
349
+ */
350
+ export declare function traceLangChainAgent(executor: LangChainExecutor, tracer: WorkflowTracer, options?: {
351
+ agentName?: string;
352
+ }): LangChainExecutor;
353
+ /**
354
+ * Create a traced wrapper for CrewAI crews
355
+ *
356
+ * @example
357
+ * ```typescript
358
+ * const tracedCrew = traceCrewAI(crew, tracer, {
359
+ * crewName: 'ResearchCrew'
360
+ * });
361
+ *
362
+ * const result = await tracedCrew.kickoff({ topic: 'AI Safety' });
363
+ * ```
364
+ */
365
+ export declare function traceCrewAI(crew: CrewAI, tracer: WorkflowTracer, options?: {
366
+ crewName?: string;
367
+ }): CrewAI;
368
+ /**
369
+ * Create a traced wrapper for AutoGen conversations
370
+ *
371
+ * @example
372
+ * ```typescript
373
+ * const tracedConversation = traceAutoGen(conversation, tracer, {
374
+ * conversationName: 'CodeReview'
375
+ * });
376
+ * ```
377
+ */
378
+ export declare function traceAutoGen(conversation: LangChainConversation, tracer: WorkflowTracer, options?: {
379
+ conversationName?: string;
380
+ }): LangChainConversation;
381
+ /**
382
+ * Create a workflow tracer from an existing client
383
+ */
384
+ export declare function createWorkflowTracer(client: AIEvalClient, options?: WorkflowTracerOptions): WorkflowTracer;
385
+ /**
386
+ * Helper to trace an async function as a workflow step
387
+ */
388
+ export declare function traceWorkflowStep<T>(tracer: WorkflowTracer, agentName: string, fn: () => Promise<T>, input?: Record<string, unknown>): Promise<T>;
389
+ export {};