agentic-qe 2.2.0 → 2.2.2
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/.claude/agents/qe-security-scanner.md +26 -0
- package/.claude/skills/agentic-quality-engineering/SKILL.md +4 -4
- package/.claude/skills/cicd-pipeline-qe-orchestrator/README.md +14 -11
- package/.claude/skills/skills-manifest.json +2 -2
- package/CHANGELOG.md +75 -0
- package/README.md +92 -214
- package/dist/agents/BaseAgent.d.ts +5 -1
- package/dist/agents/BaseAgent.d.ts.map +1 -1
- package/dist/agents/BaseAgent.js +32 -17
- package/dist/agents/BaseAgent.js.map +1 -1
- package/dist/agents/index.js +3 -3
- package/dist/agents/index.js.map +1 -1
- package/dist/cli/commands/improve/index.d.ts +8 -1
- package/dist/cli/commands/improve/index.d.ts.map +1 -1
- package/dist/cli/commands/improve/index.js +18 -16
- package/dist/cli/commands/improve/index.js.map +1 -1
- package/dist/cli/commands/learn/index.d.ts +10 -2
- package/dist/cli/commands/learn/index.d.ts.map +1 -1
- package/dist/cli/commands/learn/index.js +99 -63
- package/dist/cli/commands/learn/index.js.map +1 -1
- package/dist/cli/commands/patterns/index.d.ts +8 -1
- package/dist/cli/commands/patterns/index.d.ts.map +1 -1
- package/dist/cli/commands/patterns/index.js +79 -45
- package/dist/cli/commands/patterns/index.js.map +1 -1
- package/dist/cli/commands/routing/index.d.ts +5 -0
- package/dist/cli/commands/routing/index.d.ts.map +1 -1
- package/dist/cli/commands/routing/index.js +11 -10
- package/dist/cli/commands/routing/index.js.map +1 -1
- package/dist/cli/init/agents.d.ts +1 -1
- package/dist/cli/init/agents.js +2 -2
- package/dist/cli/init/database-init.d.ts +7 -0
- package/dist/cli/init/database-init.d.ts.map +1 -1
- package/dist/cli/init/database-init.js +29 -48
- package/dist/cli/init/database-init.js.map +1 -1
- package/dist/core/memory/HNSWVectorMemory.d.ts +261 -0
- package/dist/core/memory/HNSWVectorMemory.d.ts.map +1 -0
- package/dist/core/memory/HNSWVectorMemory.js +647 -0
- package/dist/core/memory/HNSWVectorMemory.js.map +1 -0
- package/dist/core/memory/SwarmMemoryManager.d.ts +7 -0
- package/dist/core/memory/SwarmMemoryManager.d.ts.map +1 -1
- package/dist/core/memory/SwarmMemoryManager.js +9 -0
- package/dist/core/memory/SwarmMemoryManager.js.map +1 -1
- package/dist/core/memory/index.d.ts +2 -0
- package/dist/core/memory/index.d.ts.map +1 -1
- package/dist/core/memory/index.js +11 -1
- package/dist/core/memory/index.js.map +1 -1
- package/dist/learning/ExplainableLearning.d.ts +191 -0
- package/dist/learning/ExplainableLearning.d.ts.map +1 -0
- package/dist/learning/ExplainableLearning.js +441 -0
- package/dist/learning/ExplainableLearning.js.map +1 -0
- package/dist/learning/GossipPatternSharingProtocol.d.ts +228 -0
- package/dist/learning/GossipPatternSharingProtocol.d.ts.map +1 -0
- package/dist/learning/GossipPatternSharingProtocol.js +590 -0
- package/dist/learning/GossipPatternSharingProtocol.js.map +1 -0
- package/dist/learning/LearningEngine.d.ts +4 -4
- package/dist/learning/LearningEngine.d.ts.map +1 -1
- package/dist/learning/LearningEngine.js +20 -13
- package/dist/learning/LearningEngine.js.map +1 -1
- package/dist/learning/PerformanceOptimizer.d.ts +268 -0
- package/dist/learning/PerformanceOptimizer.d.ts.map +1 -0
- package/dist/learning/PerformanceOptimizer.js +552 -0
- package/dist/learning/PerformanceOptimizer.js.map +1 -0
- package/dist/learning/PrivacyManager.d.ts +197 -0
- package/dist/learning/PrivacyManager.d.ts.map +1 -0
- package/dist/learning/PrivacyManager.js +551 -0
- package/dist/learning/PrivacyManager.js.map +1 -0
- package/dist/learning/TransferLearningManager.d.ts +212 -0
- package/dist/learning/TransferLearningManager.d.ts.map +1 -0
- package/dist/learning/TransferLearningManager.js +497 -0
- package/dist/learning/TransferLearningManager.js.map +1 -0
- package/dist/learning/algorithms/MAMLMetaLearner.d.ts +218 -0
- package/dist/learning/algorithms/MAMLMetaLearner.d.ts.map +1 -0
- package/dist/learning/algorithms/MAMLMetaLearner.js +532 -0
- package/dist/learning/algorithms/MAMLMetaLearner.js.map +1 -0
- package/dist/learning/algorithms/index.d.ts +4 -1
- package/dist/learning/algorithms/index.d.ts.map +1 -1
- package/dist/learning/algorithms/index.js +7 -1
- package/dist/learning/algorithms/index.js.map +1 -1
- package/dist/learning/index.d.ts +8 -0
- package/dist/learning/index.d.ts.map +1 -1
- package/dist/learning/index.js +17 -1
- package/dist/learning/index.js.map +1 -1
- package/dist/mcp/server-instructions.d.ts +1 -1
- package/dist/mcp/server-instructions.js +1 -1
- package/dist/providers/HybridRouter.d.ts +217 -0
- package/dist/providers/HybridRouter.d.ts.map +1 -0
- package/dist/providers/HybridRouter.js +679 -0
- package/dist/providers/HybridRouter.js.map +1 -0
- package/dist/providers/index.d.ts +1 -0
- package/dist/providers/index.d.ts.map +1 -1
- package/dist/providers/index.js +7 -1
- package/dist/providers/index.js.map +1 -1
- package/dist/telemetry/LearningTelemetry.d.ts +190 -0
- package/dist/telemetry/LearningTelemetry.d.ts.map +1 -0
- package/dist/telemetry/LearningTelemetry.js +403 -0
- package/dist/telemetry/LearningTelemetry.js.map +1 -0
- package/dist/telemetry/index.d.ts +1 -0
- package/dist/telemetry/index.d.ts.map +1 -1
- package/dist/telemetry/index.js +20 -2
- package/dist/telemetry/index.js.map +1 -1
- package/dist/telemetry/instrumentation/agent.d.ts +1 -1
- package/dist/telemetry/instrumentation/agent.js +1 -1
- package/dist/telemetry/instrumentation/index.d.ts +1 -1
- package/dist/telemetry/instrumentation/index.js +1 -1
- package/dist/utils/math.d.ts +11 -0
- package/dist/utils/math.d.ts.map +1 -0
- package/dist/utils/math.js +16 -0
- package/dist/utils/math.js.map +1 -0
- package/docs/reference/agents.md +1 -1
- package/docs/reference/skills.md +3 -3
- package/docs/reference/usage.md +4 -4
- package/package.json +14 -1
|
@@ -0,0 +1,403 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Learning Telemetry for Agentic QE Fleet
|
|
4
|
+
*
|
|
5
|
+
* OpenTelemetry integration for tracking learning metrics, algorithm performance,
|
|
6
|
+
* and agent improvement over time using reinforcement learning.
|
|
7
|
+
*
|
|
8
|
+
* Tracks:
|
|
9
|
+
* - Learning episodes and Q-value updates
|
|
10
|
+
* - Reward distribution and convergence
|
|
11
|
+
* - Pattern discovery and matching
|
|
12
|
+
* - Algorithm performance and switches
|
|
13
|
+
* - Experience sharing metrics
|
|
14
|
+
*/
|
|
15
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
16
|
+
exports.createLearningMetrics = createLearningMetrics;
|
|
17
|
+
exports.getLearningMetrics = getLearningMetrics;
|
|
18
|
+
exports.recordLearningEpisode = recordLearningEpisode;
|
|
19
|
+
exports.recordQValueUpdate = recordQValueUpdate;
|
|
20
|
+
exports.recordPatternMatch = recordPatternMatch;
|
|
21
|
+
exports.recordAlgorithmSwitch = recordAlgorithmSwitch;
|
|
22
|
+
exports.recordExperienceSharing = recordExperienceSharing;
|
|
23
|
+
exports.updateSharingConnections = updateSharingConnections;
|
|
24
|
+
exports.updateGaugeValue = updateGaugeValue;
|
|
25
|
+
exports.updateGaugeValues = updateGaugeValues;
|
|
26
|
+
exports.withLearningSpan = withLearningSpan;
|
|
27
|
+
exports.recordLearningSession = recordLearningSession;
|
|
28
|
+
exports.getPatternHitRate = getPatternHitRate;
|
|
29
|
+
exports.resetPatternHitTracking = resetPatternHitTracking;
|
|
30
|
+
const bootstrap_1 = require("./bootstrap");
|
|
31
|
+
// Singleton metrics instance
|
|
32
|
+
let learningMetrics = null;
|
|
33
|
+
// Storage for observable gauge values
|
|
34
|
+
const gaugeValues = {
|
|
35
|
+
learningRate: 0,
|
|
36
|
+
explorationRate: 0,
|
|
37
|
+
convergenceRate: 0,
|
|
38
|
+
qTableSize: 0,
|
|
39
|
+
experienceBufferSize: 0,
|
|
40
|
+
patternHitRate: 0,
|
|
41
|
+
};
|
|
42
|
+
// Pattern hit tracking
|
|
43
|
+
let totalPatternRequests = 0;
|
|
44
|
+
let totalPatternHits = 0;
|
|
45
|
+
/**
|
|
46
|
+
* Initialize learning metrics
|
|
47
|
+
*
|
|
48
|
+
* @param meter - OpenTelemetry Meter instance
|
|
49
|
+
* @returns Learning metrics registry
|
|
50
|
+
*/
|
|
51
|
+
function createLearningMetrics(meter) {
|
|
52
|
+
if (learningMetrics) {
|
|
53
|
+
return learningMetrics;
|
|
54
|
+
}
|
|
55
|
+
const m = meter || (0, bootstrap_1.getMeter)();
|
|
56
|
+
learningMetrics = {
|
|
57
|
+
// Counters
|
|
58
|
+
episodesTotal: m.createCounter('aqe.learning.episodes_total', {
|
|
59
|
+
description: 'Total number of learning episodes recorded',
|
|
60
|
+
unit: 'episodes',
|
|
61
|
+
}),
|
|
62
|
+
qValueUpdates: m.createCounter('aqe.learning.qvalue_updates', {
|
|
63
|
+
description: 'Total number of Q-value updates performed',
|
|
64
|
+
unit: 'updates',
|
|
65
|
+
}),
|
|
66
|
+
rewardSum: m.createCounter('aqe.learning.reward_sum', {
|
|
67
|
+
description: 'Cumulative sum of rewards received across all episodes',
|
|
68
|
+
unit: 'reward',
|
|
69
|
+
}),
|
|
70
|
+
algorithmSwitches: m.createCounter('aqe.learning.algorithm_switches', {
|
|
71
|
+
description: 'Number of RL algorithm switches performed',
|
|
72
|
+
unit: 'switches',
|
|
73
|
+
}),
|
|
74
|
+
patternHits: m.createCounter('aqe.learning.pattern_hits', {
|
|
75
|
+
description: 'Number of successful pattern cache hits',
|
|
76
|
+
unit: 'hits',
|
|
77
|
+
}),
|
|
78
|
+
patternMisses: m.createCounter('aqe.learning.pattern_misses', {
|
|
79
|
+
description: 'Number of pattern cache misses',
|
|
80
|
+
unit: 'misses',
|
|
81
|
+
}),
|
|
82
|
+
experiencesShared: m.createCounter('aqe.learning.experiences_shared', {
|
|
83
|
+
description: 'Number of experiences shared with peer agents',
|
|
84
|
+
unit: 'experiences',
|
|
85
|
+
}),
|
|
86
|
+
experiencesReceived: m.createCounter('aqe.learning.experiences_received', {
|
|
87
|
+
description: 'Number of experiences received from peer agents',
|
|
88
|
+
unit: 'experiences',
|
|
89
|
+
}),
|
|
90
|
+
// Histograms
|
|
91
|
+
episodeDuration: m.createHistogram('aqe.learning.episode_duration', {
|
|
92
|
+
description: 'Distribution of learning episode durations',
|
|
93
|
+
unit: 'ms',
|
|
94
|
+
advice: {
|
|
95
|
+
explicitBucketBoundaries: [10, 50, 100, 250, 500, 1000, 2500, 5000, 10000],
|
|
96
|
+
},
|
|
97
|
+
}),
|
|
98
|
+
rewardDistribution: m.createHistogram('aqe.learning.reward_distribution', {
|
|
99
|
+
description: 'Distribution of reward values across episodes',
|
|
100
|
+
unit: 'reward',
|
|
101
|
+
advice: {
|
|
102
|
+
explicitBucketBoundaries: [-2, -1.5, -1, -0.5, 0, 0.5, 1, 1.5, 2],
|
|
103
|
+
},
|
|
104
|
+
}),
|
|
105
|
+
qValueDistribution: m.createHistogram('aqe.learning.qvalue_distribution', {
|
|
106
|
+
description: 'Distribution of Q-values in the Q-table',
|
|
107
|
+
unit: 'qvalue',
|
|
108
|
+
advice: {
|
|
109
|
+
explicitBucketBoundaries: [-5, -2, -1, 0, 1, 2, 5, 10, 20, 50],
|
|
110
|
+
},
|
|
111
|
+
}),
|
|
112
|
+
patternConfidence: m.createHistogram('aqe.learning.pattern_confidence', {
|
|
113
|
+
description: 'Distribution of pattern confidence scores',
|
|
114
|
+
unit: 'confidence',
|
|
115
|
+
advice: {
|
|
116
|
+
explicitBucketBoundaries: [0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 0.95, 1.0],
|
|
117
|
+
},
|
|
118
|
+
}),
|
|
119
|
+
// Observable Gauges
|
|
120
|
+
learningRate: m.createObservableGauge('aqe.learning.learning_rate', {
|
|
121
|
+
description: 'Current learning rate (alpha)',
|
|
122
|
+
unit: 'rate',
|
|
123
|
+
}),
|
|
124
|
+
explorationRate: m.createObservableGauge('aqe.learning.exploration_rate', {
|
|
125
|
+
description: 'Current exploration rate (epsilon)',
|
|
126
|
+
unit: 'rate',
|
|
127
|
+
}),
|
|
128
|
+
convergenceRate: m.createObservableGauge('aqe.learning.convergence_rate', {
|
|
129
|
+
description: 'Learning convergence rate (improvement over time)',
|
|
130
|
+
unit: 'rate',
|
|
131
|
+
}),
|
|
132
|
+
qTableSize: m.createObservableGauge('aqe.learning.qtable_size', {
|
|
133
|
+
description: 'Number of state-action pairs in Q-table',
|
|
134
|
+
unit: 'pairs',
|
|
135
|
+
}),
|
|
136
|
+
experienceBufferSize: m.createObservableGauge('aqe.learning.experience_buffer_size', {
|
|
137
|
+
description: 'Number of experiences in replay buffer',
|
|
138
|
+
unit: 'experiences',
|
|
139
|
+
}),
|
|
140
|
+
patternHitRate: m.createObservableGauge('aqe.learning.pattern_hit_rate', {
|
|
141
|
+
description: 'Pattern cache hit rate (efficiency)',
|
|
142
|
+
unit: 'rate',
|
|
143
|
+
}),
|
|
144
|
+
activeSharingConnections: m.createUpDownCounter('aqe.learning.active_sharing_connections', {
|
|
145
|
+
description: 'Number of active experience sharing connections',
|
|
146
|
+
unit: 'connections',
|
|
147
|
+
}),
|
|
148
|
+
};
|
|
149
|
+
// Register observable callbacks
|
|
150
|
+
learningMetrics.learningRate.addCallback((observableResult) => {
|
|
151
|
+
observableResult.observe(gaugeValues.learningRate);
|
|
152
|
+
});
|
|
153
|
+
learningMetrics.explorationRate.addCallback((observableResult) => {
|
|
154
|
+
observableResult.observe(gaugeValues.explorationRate);
|
|
155
|
+
});
|
|
156
|
+
learningMetrics.convergenceRate.addCallback((observableResult) => {
|
|
157
|
+
observableResult.observe(gaugeValues.convergenceRate);
|
|
158
|
+
});
|
|
159
|
+
learningMetrics.qTableSize.addCallback((observableResult) => {
|
|
160
|
+
observableResult.observe(gaugeValues.qTableSize);
|
|
161
|
+
});
|
|
162
|
+
learningMetrics.experienceBufferSize.addCallback((observableResult) => {
|
|
163
|
+
observableResult.observe(gaugeValues.experienceBufferSize);
|
|
164
|
+
});
|
|
165
|
+
learningMetrics.patternHitRate.addCallback((observableResult) => {
|
|
166
|
+
observableResult.observe(gaugeValues.patternHitRate);
|
|
167
|
+
});
|
|
168
|
+
return learningMetrics;
|
|
169
|
+
}
|
|
170
|
+
/**
|
|
171
|
+
* Get initialized learning metrics
|
|
172
|
+
*
|
|
173
|
+
* @returns Learning metrics registry
|
|
174
|
+
*/
|
|
175
|
+
function getLearningMetrics() {
|
|
176
|
+
if (!learningMetrics) {
|
|
177
|
+
return createLearningMetrics();
|
|
178
|
+
}
|
|
179
|
+
return learningMetrics;
|
|
180
|
+
}
|
|
181
|
+
/**
|
|
182
|
+
* Record a learning episode
|
|
183
|
+
*
|
|
184
|
+
* @param agentId - Agent identifier
|
|
185
|
+
* @param taskType - Type of task being learned
|
|
186
|
+
* @param reward - Reward received for this episode
|
|
187
|
+
* @param durationMs - Episode duration in milliseconds
|
|
188
|
+
* @param algorithm - RL algorithm used
|
|
189
|
+
* @param options - Additional recording options
|
|
190
|
+
*/
|
|
191
|
+
function recordLearningEpisode(agentId, taskType, reward, durationMs, algorithm = 'q-learning', options) {
|
|
192
|
+
const metrics = getLearningMetrics();
|
|
193
|
+
const attributes = {
|
|
194
|
+
'agent.id': agentId,
|
|
195
|
+
'task.type': taskType,
|
|
196
|
+
'learning.algorithm': algorithm,
|
|
197
|
+
};
|
|
198
|
+
// Record episode
|
|
199
|
+
metrics.episodesTotal.add(1, attributes);
|
|
200
|
+
// Record episode duration
|
|
201
|
+
metrics.episodeDuration.record(durationMs, attributes);
|
|
202
|
+
// Record reward
|
|
203
|
+
metrics.rewardSum.add(reward, attributes);
|
|
204
|
+
metrics.rewardDistribution.record(reward, attributes);
|
|
205
|
+
// Record Q-value update if occurred
|
|
206
|
+
if (options?.qValueUpdate) {
|
|
207
|
+
metrics.qValueUpdates.add(1, attributes);
|
|
208
|
+
}
|
|
209
|
+
// Update gauge values if provided
|
|
210
|
+
if (options?.explorationRate !== undefined) {
|
|
211
|
+
updateGaugeValue('explorationRate', options.explorationRate);
|
|
212
|
+
}
|
|
213
|
+
if (options?.learningRate !== undefined) {
|
|
214
|
+
updateGaugeValue('learningRate', options.learningRate);
|
|
215
|
+
}
|
|
216
|
+
}
|
|
217
|
+
/**
|
|
218
|
+
* Record Q-value updates
|
|
219
|
+
*
|
|
220
|
+
* @param agentId - Agent identifier
|
|
221
|
+
* @param count - Number of Q-value updates
|
|
222
|
+
* @param qValue - The Q-value (optional, for distribution tracking)
|
|
223
|
+
* @param algorithm - RL algorithm used
|
|
224
|
+
*/
|
|
225
|
+
function recordQValueUpdate(agentId, count = 1, qValue, algorithm = 'q-learning') {
|
|
226
|
+
const metrics = getLearningMetrics();
|
|
227
|
+
const attributes = {
|
|
228
|
+
'agent.id': agentId,
|
|
229
|
+
'learning.algorithm': algorithm,
|
|
230
|
+
};
|
|
231
|
+
metrics.qValueUpdates.add(count, attributes);
|
|
232
|
+
// Record Q-value distribution if provided
|
|
233
|
+
if (qValue !== undefined) {
|
|
234
|
+
metrics.qValueDistribution.record(qValue, attributes);
|
|
235
|
+
}
|
|
236
|
+
}
|
|
237
|
+
/**
|
|
238
|
+
* Record pattern matching activity
|
|
239
|
+
*
|
|
240
|
+
* @param agentId - Agent identifier
|
|
241
|
+
* @param hit - Whether the pattern was found in cache
|
|
242
|
+
* @param confidence - Pattern confidence score (if hit)
|
|
243
|
+
* @param patternType - Type of pattern
|
|
244
|
+
*/
|
|
245
|
+
function recordPatternMatch(agentId, hit, confidence, patternType) {
|
|
246
|
+
const metrics = getLearningMetrics();
|
|
247
|
+
const attributes = {
|
|
248
|
+
'agent.id': agentId,
|
|
249
|
+
};
|
|
250
|
+
if (patternType) {
|
|
251
|
+
attributes['pattern.type'] = patternType;
|
|
252
|
+
}
|
|
253
|
+
// Track hit/miss
|
|
254
|
+
totalPatternRequests++;
|
|
255
|
+
if (hit) {
|
|
256
|
+
totalPatternHits++;
|
|
257
|
+
metrics.patternHits.add(1, attributes);
|
|
258
|
+
// Record confidence if provided
|
|
259
|
+
if (confidence !== undefined) {
|
|
260
|
+
metrics.patternConfidence.record(confidence, attributes);
|
|
261
|
+
}
|
|
262
|
+
}
|
|
263
|
+
else {
|
|
264
|
+
metrics.patternMisses.add(1, attributes);
|
|
265
|
+
}
|
|
266
|
+
// Update hit rate
|
|
267
|
+
updateGaugeValue('patternHitRate', totalPatternRequests > 0 ? totalPatternHits / totalPatternRequests : 0);
|
|
268
|
+
}
|
|
269
|
+
/**
|
|
270
|
+
* Record algorithm switch
|
|
271
|
+
*
|
|
272
|
+
* @param agentId - Agent identifier
|
|
273
|
+
* @param fromAlgorithm - Previous algorithm
|
|
274
|
+
* @param toAlgorithm - New algorithm
|
|
275
|
+
*/
|
|
276
|
+
function recordAlgorithmSwitch(agentId, fromAlgorithm, toAlgorithm) {
|
|
277
|
+
const metrics = getLearningMetrics();
|
|
278
|
+
metrics.algorithmSwitches.add(1, {
|
|
279
|
+
'agent.id': agentId,
|
|
280
|
+
'learning.algorithm.from': fromAlgorithm,
|
|
281
|
+
'learning.algorithm.to': toAlgorithm,
|
|
282
|
+
});
|
|
283
|
+
}
|
|
284
|
+
/**
|
|
285
|
+
* Record experience sharing activity
|
|
286
|
+
*
|
|
287
|
+
* @param agentId - Agent identifier
|
|
288
|
+
* @param direction - 'shared' or 'received'
|
|
289
|
+
* @param count - Number of experiences
|
|
290
|
+
* @param priority - Experience priority (0-1)
|
|
291
|
+
*/
|
|
292
|
+
function recordExperienceSharing(agentId, direction, count = 1, priority) {
|
|
293
|
+
const metrics = getLearningMetrics();
|
|
294
|
+
const attributes = {
|
|
295
|
+
'agent.id': agentId,
|
|
296
|
+
};
|
|
297
|
+
if (priority !== undefined) {
|
|
298
|
+
attributes['experience.priority'] = priority;
|
|
299
|
+
}
|
|
300
|
+
if (direction === 'shared') {
|
|
301
|
+
metrics.experiencesShared.add(count, attributes);
|
|
302
|
+
}
|
|
303
|
+
else {
|
|
304
|
+
metrics.experiencesReceived.add(count, attributes);
|
|
305
|
+
}
|
|
306
|
+
}
|
|
307
|
+
/**
|
|
308
|
+
* Update sharing connection count
|
|
309
|
+
*
|
|
310
|
+
* @param agentId - Agent identifier
|
|
311
|
+
* @param delta - Change in connection count (+1 for connect, -1 for disconnect)
|
|
312
|
+
*/
|
|
313
|
+
function updateSharingConnections(agentId, delta) {
|
|
314
|
+
const metrics = getLearningMetrics();
|
|
315
|
+
metrics.activeSharingConnections.add(delta, {
|
|
316
|
+
'agent.id': agentId,
|
|
317
|
+
});
|
|
318
|
+
}
|
|
319
|
+
/**
|
|
320
|
+
* Update gauge values (for observable metrics)
|
|
321
|
+
*
|
|
322
|
+
* @param gauge - Gauge name
|
|
323
|
+
* @param value - New value
|
|
324
|
+
*/
|
|
325
|
+
function updateGaugeValue(gauge, value) {
|
|
326
|
+
gaugeValues[gauge] = value;
|
|
327
|
+
}
|
|
328
|
+
/**
|
|
329
|
+
* Update multiple gauge values at once
|
|
330
|
+
*
|
|
331
|
+
* @param values - Object with gauge values to update
|
|
332
|
+
*/
|
|
333
|
+
function updateGaugeValues(values) {
|
|
334
|
+
Object.assign(gaugeValues, values);
|
|
335
|
+
}
|
|
336
|
+
/**
|
|
337
|
+
* Create a traced learning operation span
|
|
338
|
+
*
|
|
339
|
+
* @param operationName - Name of the learning operation
|
|
340
|
+
* @param agentId - Agent identifier
|
|
341
|
+
* @param fn - Function to execute within the span
|
|
342
|
+
* @returns Result of the function
|
|
343
|
+
*/
|
|
344
|
+
async function withLearningSpan(operationName, agentId, fn) {
|
|
345
|
+
return (0, bootstrap_1.withSpan)(`aqe.learning.${operationName}`, async () => {
|
|
346
|
+
const tracer = (0, bootstrap_1.getTracer)();
|
|
347
|
+
const currentSpan = tracer.startActiveSpan(operationName, (span) => {
|
|
348
|
+
span.setAttribute('agent.id', agentId);
|
|
349
|
+
span.setAttribute('operation.type', 'learning');
|
|
350
|
+
return span;
|
|
351
|
+
});
|
|
352
|
+
try {
|
|
353
|
+
const result = await fn();
|
|
354
|
+
return result;
|
|
355
|
+
}
|
|
356
|
+
finally {
|
|
357
|
+
currentSpan?.end();
|
|
358
|
+
}
|
|
359
|
+
});
|
|
360
|
+
}
|
|
361
|
+
/**
|
|
362
|
+
* Record learning session summary
|
|
363
|
+
* Call this periodically or at session end to capture overall metrics
|
|
364
|
+
*
|
|
365
|
+
* @param agentId - Agent identifier
|
|
366
|
+
* @param stats - Learning statistics
|
|
367
|
+
*/
|
|
368
|
+
function recordLearningSession(agentId, stats) {
|
|
369
|
+
// Update all gauge values
|
|
370
|
+
updateGaugeValues({
|
|
371
|
+
learningRate: stats.learningRate,
|
|
372
|
+
explorationRate: stats.explorationRate,
|
|
373
|
+
convergenceRate: stats.convergenceRate || 0,
|
|
374
|
+
qTableSize: stats.qTableSize,
|
|
375
|
+
experienceBufferSize: stats.totalExperiences,
|
|
376
|
+
});
|
|
377
|
+
// Record average reward if provided
|
|
378
|
+
if (stats.avgReward !== undefined) {
|
|
379
|
+
const metrics = getLearningMetrics();
|
|
380
|
+
metrics.rewardDistribution.record(stats.avgReward, {
|
|
381
|
+
'agent.id': agentId,
|
|
382
|
+
'learning.algorithm': stats.algorithm,
|
|
383
|
+
'session.type': 'summary',
|
|
384
|
+
});
|
|
385
|
+
}
|
|
386
|
+
}
|
|
387
|
+
/**
|
|
388
|
+
* Get current pattern hit rate
|
|
389
|
+
*
|
|
390
|
+
* @returns Pattern hit rate (0-1)
|
|
391
|
+
*/
|
|
392
|
+
function getPatternHitRate() {
|
|
393
|
+
return totalPatternRequests > 0 ? totalPatternHits / totalPatternRequests : 0;
|
|
394
|
+
}
|
|
395
|
+
/**
|
|
396
|
+
* Reset pattern hit tracking (useful for testing or per-session metrics)
|
|
397
|
+
*/
|
|
398
|
+
function resetPatternHitTracking() {
|
|
399
|
+
totalPatternRequests = 0;
|
|
400
|
+
totalPatternHits = 0;
|
|
401
|
+
updateGaugeValue('patternHitRate', 0);
|
|
402
|
+
}
|
|
403
|
+
//# sourceMappingURL=LearningTelemetry.js.map
|
|
@@ -0,0 +1 @@
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B,CAAC,MAAM,CAAC,KAAK,CAAC,SAAS,EAAE;YACjD,UAAU,EAAE,OAAO;YACnB,oBAAoB,EAAE,KAAK,CAAC,SAAS;YACrC,cAAc,EAAE,SAAS;SAC1B,CAAC,CAAC;IACL,CAAC;AACH,CAAC;AAED;;;;GAIG;AACH,SAAgB,iBAAiB;IAC/B,OAAO,oBAAoB,GAAG,CAAC,CAAC,CAAC,CAAC,gBAAgB,GAAG,oBAAoB,CAAC,CAAC,CAAC,CAAC,CAAC;AAChF,CAAC;AAED;;GAEG;AACH,SAAgB,uBAAuB;IACrC,oBAAoB,GAAG,CAAC,CAAC;IACzB,gBAAgB,GAAG,CAAC,CAAC;IACrB,gBAAgB,CAAC,gBAAgB,EAAE,CAAC,CAAC,CAAC;AACxC,CAAC"}
|
|
@@ -6,6 +6,7 @@
|
|
|
6
6
|
export { initTelemetry, shutdownTelemetry, getTracer, getMeter, isTelemetryInitialized, withSpan, recordSpanEvent, setSpanAttributes, defaultTelemetryConfig, } from './bootstrap';
|
|
7
7
|
export { TelemetryConfig, TelemetryInitResult, TelemetryShutdownResult, AgentAttributes, TaskAttributes, QEAttributes, ModelAttributes, MetricRecordOptions, METRIC_NAMES, HISTOGRAM_BOUNDARIES, SPAN_NAMES, } from './types';
|
|
8
8
|
export * from './metrics';
|
|
9
|
+
export { LearningMetrics, createLearningMetrics, getLearningMetrics, recordLearningEpisode, recordQValueUpdate, recordPatternMatch, recordAlgorithmSwitch, recordExperienceSharing, updateSharingConnections, updateGaugeValue, updateGaugeValues, withLearningSpan, recordLearningSession, getPatternHitRate, resetPatternHitTracking, } from './LearningTelemetry';
|
|
9
10
|
/**
|
|
10
11
|
* Quick start function for initializing telemetry with defaults
|
|
11
12
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/telemetry/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAGH,OAAO,EACL,aAAa,EACb,iBAAiB,EACjB,SAAS,EACT,QAAQ,EACR,sBAAsB,EACtB,QAAQ,EACR,eAAe,EACf,iBAAiB,EACjB,sBAAsB,GACvB,MAAM,aAAa,CAAC;AAGrB,OAAO,EACL,eAAe,EACf,mBAAmB,EACnB,uBAAuB,EACvB,eAAe,EACf,cAAc,EACd,YAAY,EACZ,eAAe,EACf,mBAAmB,EACnB,YAAY,EACZ,oBAAoB,EACpB,UAAU,GACX,MAAM,SAAS,CAAC;AAGjB,cAAc,WAAW,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/telemetry/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAGH,OAAO,EACL,aAAa,EACb,iBAAiB,EACjB,SAAS,EACT,QAAQ,EACR,sBAAsB,EACtB,QAAQ,EACR,eAAe,EACf,iBAAiB,EACjB,sBAAsB,GACvB,MAAM,aAAa,CAAC;AAGrB,OAAO,EACL,eAAe,EACf,mBAAmB,EACnB,uBAAuB,EACvB,eAAe,EACf,cAAc,EACd,YAAY,EACZ,eAAe,EACf,mBAAmB,EACnB,YAAY,EACZ,oBAAoB,EACpB,UAAU,GACX,MAAM,SAAS,CAAC;AAGjB,cAAc,WAAW,CAAC;AAG1B,OAAO,EACL,eAAe,EACf,qBAAqB,EACrB,kBAAkB,EAClB,qBAAqB,EACrB,kBAAkB,EAClB,kBAAkB,EAClB,qBAAqB,EACrB,uBAAuB,EACvB,wBAAwB,EACxB,gBAAgB,EAChB,iBAAiB,EACjB,gBAAgB,EAChB,qBAAqB,EACrB,iBAAiB,EACjB,uBAAuB,GACxB,MAAM,qBAAqB,CAAC;AAE7B;;;;;GAKG;AACH,wBAAsB,mBAAmB,CAAC,WAAW,CAAC,EAAE,MAAM,kDAkB7D"}
|
package/dist/telemetry/index.js
CHANGED
|
@@ -41,7 +41,7 @@ var __importStar = (this && this.__importStar) || (function () {
|
|
|
41
41
|
};
|
|
42
42
|
})();
|
|
43
43
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
44
|
-
exports.SPAN_NAMES = exports.HISTOGRAM_BOUNDARIES = exports.METRIC_NAMES = exports.defaultTelemetryConfig = exports.setSpanAttributes = exports.recordSpanEvent = exports.withSpan = exports.isTelemetryInitialized = exports.getMeter = exports.getTracer = exports.shutdownTelemetry = exports.initTelemetry = void 0;
|
|
44
|
+
exports.resetPatternHitTracking = exports.getPatternHitRate = exports.recordLearningSession = exports.withLearningSpan = exports.updateGaugeValues = exports.updateGaugeValue = exports.updateSharingConnections = exports.recordExperienceSharing = exports.recordAlgorithmSwitch = exports.recordPatternMatch = exports.recordQValueUpdate = exports.recordLearningEpisode = exports.getLearningMetrics = exports.createLearningMetrics = exports.SPAN_NAMES = exports.HISTOGRAM_BOUNDARIES = exports.METRIC_NAMES = exports.defaultTelemetryConfig = exports.setSpanAttributes = exports.recordSpanEvent = exports.withSpan = exports.isTelemetryInitialized = exports.getMeter = exports.getTracer = exports.shutdownTelemetry = exports.initTelemetry = void 0;
|
|
45
45
|
exports.quickStartTelemetry = quickStartTelemetry;
|
|
46
46
|
// Bootstrap exports
|
|
47
47
|
var bootstrap_1 = require("./bootstrap");
|
|
@@ -61,6 +61,22 @@ Object.defineProperty(exports, "HISTOGRAM_BOUNDARIES", { enumerable: true, get:
|
|
|
61
61
|
Object.defineProperty(exports, "SPAN_NAMES", { enumerable: true, get: function () { return types_1.SPAN_NAMES; } });
|
|
62
62
|
// Metrics exports
|
|
63
63
|
__exportStar(require("./metrics"), exports);
|
|
64
|
+
// Learning telemetry exports
|
|
65
|
+
var LearningTelemetry_1 = require("./LearningTelemetry");
|
|
66
|
+
Object.defineProperty(exports, "createLearningMetrics", { enumerable: true, get: function () { return LearningTelemetry_1.createLearningMetrics; } });
|
|
67
|
+
Object.defineProperty(exports, "getLearningMetrics", { enumerable: true, get: function () { return LearningTelemetry_1.getLearningMetrics; } });
|
|
68
|
+
Object.defineProperty(exports, "recordLearningEpisode", { enumerable: true, get: function () { return LearningTelemetry_1.recordLearningEpisode; } });
|
|
69
|
+
Object.defineProperty(exports, "recordQValueUpdate", { enumerable: true, get: function () { return LearningTelemetry_1.recordQValueUpdate; } });
|
|
70
|
+
Object.defineProperty(exports, "recordPatternMatch", { enumerable: true, get: function () { return LearningTelemetry_1.recordPatternMatch; } });
|
|
71
|
+
Object.defineProperty(exports, "recordAlgorithmSwitch", { enumerable: true, get: function () { return LearningTelemetry_1.recordAlgorithmSwitch; } });
|
|
72
|
+
Object.defineProperty(exports, "recordExperienceSharing", { enumerable: true, get: function () { return LearningTelemetry_1.recordExperienceSharing; } });
|
|
73
|
+
Object.defineProperty(exports, "updateSharingConnections", { enumerable: true, get: function () { return LearningTelemetry_1.updateSharingConnections; } });
|
|
74
|
+
Object.defineProperty(exports, "updateGaugeValue", { enumerable: true, get: function () { return LearningTelemetry_1.updateGaugeValue; } });
|
|
75
|
+
Object.defineProperty(exports, "updateGaugeValues", { enumerable: true, get: function () { return LearningTelemetry_1.updateGaugeValues; } });
|
|
76
|
+
Object.defineProperty(exports, "withLearningSpan", { enumerable: true, get: function () { return LearningTelemetry_1.withLearningSpan; } });
|
|
77
|
+
Object.defineProperty(exports, "recordLearningSession", { enumerable: true, get: function () { return LearningTelemetry_1.recordLearningSession; } });
|
|
78
|
+
Object.defineProperty(exports, "getPatternHitRate", { enumerable: true, get: function () { return LearningTelemetry_1.getPatternHitRate; } });
|
|
79
|
+
Object.defineProperty(exports, "resetPatternHitTracking", { enumerable: true, get: function () { return LearningTelemetry_1.resetPatternHitTracking; } });
|
|
64
80
|
/**
|
|
65
81
|
* Quick start function for initializing telemetry with defaults
|
|
66
82
|
*
|
|
@@ -70,14 +86,16 @@ __exportStar(require("./metrics"), exports);
|
|
|
70
86
|
async function quickStartTelemetry(serviceName) {
|
|
71
87
|
const { initTelemetry } = await Promise.resolve().then(() => __importStar(require('./bootstrap')));
|
|
72
88
|
const { initializeAllMetrics } = await Promise.resolve().then(() => __importStar(require('./metrics')));
|
|
89
|
+
const { createLearningMetrics } = await Promise.resolve().then(() => __importStar(require('./LearningTelemetry')));
|
|
73
90
|
const result = await initTelemetry({
|
|
74
91
|
serviceName: serviceName || 'agentic-qe-fleet',
|
|
75
92
|
enableConsoleExport: process.env.NODE_ENV === 'development',
|
|
76
93
|
enableAutoInstrumentation: true,
|
|
77
94
|
});
|
|
78
95
|
if (result.success) {
|
|
79
|
-
// Initialize all metrics
|
|
96
|
+
// Initialize all metrics including learning metrics
|
|
80
97
|
initializeAllMetrics();
|
|
98
|
+
createLearningMetrics();
|
|
81
99
|
}
|
|
82
100
|
return result;
|
|
83
101
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/telemetry/index.ts"],"names":[],"mappings":";AAAA;;;;GAIG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/telemetry/index.ts"],"names":[],"mappings":";AAAA;;;;GAIG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA0DH,kDAkBC;AA1ED,oBAAoB;AACpB,yCAUqB;AATnB,0GAAA,aAAa,OAAA;AACb,8GAAA,iBAAiB,OAAA;AACjB,sGAAA,SAAS,OAAA;AACT,qGAAA,QAAQ,OAAA;AACR,mHAAA,sBAAsB,OAAA;AACtB,qGAAA,QAAQ,OAAA;AACR,4GAAA,eAAe,OAAA;AACf,8GAAA,iBAAiB,OAAA;AACjB,mHAAA,sBAAsB,OAAA;AAGxB,eAAe;AACf,iCAYiB;AAHf,qGAAA,YAAY,OAAA;AACZ,6GAAA,oBAAoB,OAAA;AACpB,mGAAA,UAAU,OAAA;AAGZ,kBAAkB;AAClB,4CAA0B;AAE1B,6BAA6B;AAC7B,yDAgB6B;AAd3B,0HAAA,qBAAqB,OAAA;AACrB,uHAAA,kBAAkB,OAAA;AAClB,0HAAA,qBAAqB,OAAA;AACrB,uHAAA,kBAAkB,OAAA;AAClB,uHAAA,kBAAkB,OAAA;AAClB,0HAAA,qBAAqB,OAAA;AACrB,4HAAA,uBAAuB,OAAA;AACvB,6HAAA,wBAAwB,OAAA;AACxB,qHAAA,gBAAgB,OAAA;AAChB,sHAAA,iBAAiB,OAAA;AACjB,qHAAA,gBAAgB,OAAA;AAChB,0HAAA,qBAAqB,OAAA;AACrB,sHAAA,iBAAiB,OAAA;AACjB,4HAAA,uBAAuB,OAAA;AAGzB;;;;;GAKG;AACI,KAAK,UAAU,mBAAmB,CAAC,WAAoB;IAC5D,MAAM,EAAE,aAAa,EAAE,GAAG,wDAAa,aAAa,GAAC,CAAC;IACtD,MAAM,EAAE,oBAAoB,EAAE,GAAG,wDAAa,WAAW,GAAC,CAAC;IAC3D,MAAM,EAAE,qBAAqB,EAAE,GAAG,wDAAa,qBAAqB,GAAC,CAAC;IAEtE,MAAM,MAAM,GAAG,MAAM,aAAa,CAAC;QACjC,WAAW,EAAE,WAAW,IAAI,kBAAkB;QAC9C,mBAAmB,EAAE,OAAO,CAAC,GAAG,CAAC,QAAQ,KAAK,aAAa;QAC3D,yBAAyB,EAAE,IAAI;KAChC,CAAC,CAAC;IAEH,IAAI,MAAM,CAAC,OAAO,EAAE,CAAC;QACnB,oDAAoD;QACpD,oBAAoB,EAAE,CAAC;QACvB,qBAAqB,EAAE,CAAC;IAC1B,CAAC;IAED,OAAO,MAAM,CAAC;AAChB,CAAC"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Agent Instrumentation - OpenTelemetry spans for agent lifecycle
|
|
3
3
|
*
|
|
4
|
-
* Provides comprehensive tracing for all
|
|
4
|
+
* Provides comprehensive tracing for all 19 QE agents with semantic attributes
|
|
5
5
|
* following OpenTelemetry conventions. Automatically instruments agent lifecycle
|
|
6
6
|
* events: spawn, execute, complete, error.
|
|
7
7
|
*
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
/**
|
|
3
3
|
* Agent Instrumentation - OpenTelemetry spans for agent lifecycle
|
|
4
4
|
*
|
|
5
|
-
* Provides comprehensive tracing for all
|
|
5
|
+
* Provides comprehensive tracing for all 19 QE agents with semantic attributes
|
|
6
6
|
* following OpenTelemetry conventions. Automatically instruments agent lifecycle
|
|
7
7
|
* events: spawn, execute, complete, error.
|
|
8
8
|
*
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Telemetry Instrumentation - Agent and Task Tracing
|
|
3
3
|
*
|
|
4
|
-
* Comprehensive OpenTelemetry instrumentation for all
|
|
4
|
+
* Comprehensive OpenTelemetry instrumentation for all 19 QE agents
|
|
5
5
|
* with automatic span management, context propagation, and semantic attributes.
|
|
6
6
|
*
|
|
7
7
|
* @module telemetry/instrumentation
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
/**
|
|
3
3
|
* Telemetry Instrumentation - Agent and Task Tracing
|
|
4
4
|
*
|
|
5
|
-
* Comprehensive OpenTelemetry instrumentation for all
|
|
5
|
+
* Comprehensive OpenTelemetry instrumentation for all 19 QE agents
|
|
6
6
|
* with automatic span management, context propagation, and semantic attributes.
|
|
7
7
|
*
|
|
8
8
|
* @module telemetry/instrumentation
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Math utility functions
|
|
3
|
+
*/
|
|
4
|
+
/**
|
|
5
|
+
* Adds two numbers together
|
|
6
|
+
* @param a - First number
|
|
7
|
+
* @param b - Second number
|
|
8
|
+
* @returns Sum of a and b
|
|
9
|
+
*/
|
|
10
|
+
export declare function add(a: number, b: number): number;
|
|
11
|
+
//# sourceMappingURL=math.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"math.d.ts","sourceRoot":"","sources":["../../src/utils/math.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH;;;;;GAKG;AACH,wBAAgB,GAAG,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,GAAG,MAAM,CAEhD"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Math utility functions
|
|
4
|
+
*/
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.add = add;
|
|
7
|
+
/**
|
|
8
|
+
* Adds two numbers together
|
|
9
|
+
* @param a - First number
|
|
10
|
+
* @param b - Second number
|
|
11
|
+
* @returns Sum of a and b
|
|
12
|
+
*/
|
|
13
|
+
function add(a, b) {
|
|
14
|
+
return a + b;
|
|
15
|
+
}
|
|
16
|
+
//# sourceMappingURL=math.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"math.js","sourceRoot":"","sources":["../../src/utils/math.ts"],"names":[],"mappings":";AAAA;;GAEG;;AAQH,kBAEC;AARD;;;;;GAKG;AACH,SAAgB,GAAG,CAAC,CAAS,EAAE,CAAS;IACtC,OAAO,CAAC,GAAG,CAAC,CAAC;AACf,CAAC"}
|
package/docs/reference/agents.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# Agentic QE Fleet - Agent Reference
|
|
2
2
|
|
|
3
|
-
This document provides comprehensive reference for all
|
|
3
|
+
This document provides comprehensive reference for all 19 QE agents in the Agentic Quality Engineering Fleet.
|
|
4
4
|
|
|
5
5
|
## Overview
|
|
6
6
|
|
package/docs/reference/skills.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# Agentic QE Fleet - Skills Reference
|
|
2
2
|
|
|
3
|
-
This document provides comprehensive reference for all
|
|
3
|
+
This document provides comprehensive reference for all 41 specialized QE skills available to agents.
|
|
4
4
|
|
|
5
5
|
## Overview
|
|
6
6
|
|
|
@@ -723,7 +723,7 @@ Skill("sherlock-review")
|
|
|
723
723
|
#### cicd-pipeline-qe-orchestrator
|
|
724
724
|
**Comprehensive quality orchestration across CI/CD pipeline phases**
|
|
725
725
|
|
|
726
|
-
Intelligently select QE skills and coordinate specialized agents for holistic quality coverage throughout the software delivery lifecycle. Integrates all
|
|
726
|
+
Intelligently select QE skills and coordinate specialized agents for holistic quality coverage throughout the software delivery lifecycle. Integrates all 41 AQE skills and 19 agents.
|
|
727
727
|
|
|
728
728
|
**Key Topics:**
|
|
729
729
|
- Pipeline phase analysis
|
|
@@ -851,7 +851,7 @@ All QE agents automatically have access to relevant skills based on their specia
|
|
|
851
851
|
---
|
|
852
852
|
|
|
853
853
|
**Related Documentation:**
|
|
854
|
-
- [Agent Reference](agents.md) - All
|
|
854
|
+
- [Agent Reference](agents.md) - All 19 QE agents
|
|
855
855
|
- [Usage Guide](usage.md) - Complete usage examples
|
|
856
856
|
|
|
857
857
|
**Related Policies:**
|
package/docs/reference/usage.md
CHANGED
|
@@ -17,8 +17,8 @@ npm install agentic-qe-cf --save-dev
|
|
|
17
17
|
npx aqe init
|
|
18
18
|
|
|
19
19
|
# This creates:
|
|
20
|
-
# - .claude/agents/ (
|
|
21
|
-
# - .claude/skills/ (
|
|
20
|
+
# - .claude/agents/ (19 QE agents)
|
|
21
|
+
# - .claude/skills/ (41 QE skills)
|
|
22
22
|
# - .claude/commands/ (8 slash commands)
|
|
23
23
|
# - .agentic-qe/config/ (fleet configuration)
|
|
24
24
|
# - .agentic-qe/db/ (learning databases)
|
|
@@ -563,8 +563,8 @@ Task("Hunt flaky tests", "Detect and stabilize flaky tests with ML", "qe-flaky-t
|
|
|
563
563
|
---
|
|
564
564
|
|
|
565
565
|
**Related Documentation:**
|
|
566
|
-
- [Agent Reference](agents.md) - All
|
|
567
|
-
- [Skills Reference](skills.md) - All
|
|
566
|
+
- [Agent Reference](agents.md) - All 19 QE agents
|
|
567
|
+
- [Skills Reference](skills.md) - All 41 QE skills
|
|
568
568
|
|
|
569
569
|
**Related Policies:**
|
|
570
570
|
- [Release Verification Policy](../policies/release-verification.md)
|