Intelligence · class
LatencyEstimator
A p90 that revises as it measures, and says so before it knows.
Explained in Agents and behaviour.
class LatencyEstimatorimport { LatencyEstimator } from '@driftengine/ai';In depth
The continuation watermark issues the next request when the current intent's remaining extent falls to this number. Measuring it rather than configuring it is what removes the tuning constant that would be wrong on every device, and wrong again the moment a consumer switched providers.
p90 rather than p50 or p99. At p50 half the continuations land late and the agent visibly drops to its floor mid-behaviour. At p99 the lead is long enough that the context goes stale for the tail. What would make this wrong: a provider whose latency is bimodal — a cache hit at 40ms and a miss at 3s — has a p90 that describes neither, and the answer there is a per-request estimate from the request's own shape, not a different percentile.
Constructor
new
constructor(capacity?: number, minSamples?: number)| Parameter | Type | Description |
|---|---|---|
capacity? | number | |
minSamples? | number |
Accessors
| Name | Type | Description |
|---|---|---|
samplesget | number | |
p90get | number | -1 until minSamples are in, which the watermark reads as "issue immediately". |
Methods
record
record(ms: number): void| Parameter | Type | Description |
|---|---|---|
ms | number |