AIDK API Reference / aidk-kernel / ContextMetrics
Interface: ContextMetrics ​
Defined in: packages/kernel/src/context.ts:129
Metrics accumulated during procedure execution.
Metrics are automatically propagated from child procedures to parents when execution completes.
Example ​
typescript
// In a procedure
addMetric(ctx, 'tokens.input', 100);
addMetric(ctx, 'api_calls', 1);
// After execution, parent has accumulated metrics
const totalTokens = ctx.metrics['tokens.input'];See ​
- addMetric - Accumulate a metric value
- getUsageMetrics - Get token usage metrics
Extends ​
Record<string,any>
Extended by ​
Indexable ​
ts
[key: string]: any