Intelligence · interface

AiUsage

What an agent has spent.

Explained in Agents and behaviour.

interface AiUsage
import type { AiUsage } from '@driftengine/ai';

In depth

Mutated in place. A session charges per event, and allocating a usage object per event would put an allocation on the path a streaming response takes hundreds of times per request.

Properties

NameTypeDescription
inputTokensnumber
outputTokensnumber
requestsnumber
preemptedRequestsnumberRequests aborted because a higher-priority observation arrived.
More

The token price of responsiveness, and the number a consumer tunes its priority thresholds against. Separate from abortedRequests because disposal and hot reload also abort, and no threshold a consumer can set changes those.

abortedRequestsnumber
costMicrosnumber
latencyMsP90number