Skip to content
AgentsKit

@agentskit/observability — Variables

API variables for @agentskit/observability.

#Variable: approximateCounter

const approximateCounter: TokenCounter

Defined in: observability/src/token-counter.ts:44

A fast, zero-dependency approximate token counter.

Uses the chars / 4 heuristic plus a small per-message overhead to account for chat framing tokens.

Good enough for budget checks and context-window guards. For exact counts, use a provider-specific counter (e.g. createTiktokenCounter).

#Example

import { approximateCounter } from '@agentskit/observability'

const tokens = approximateCounter.count(messages)
if (tokens > 120_000) trimOldMessages(messages)

#Variable: DEFAULT_PRICES

const DEFAULT_PRICES: Record<string, TokenPrice>

Defined in: observability/src/cost-guard.ts:23

Pricing registry keyed by model name (case-insensitive prefix match). Ordered: longest prefix wins so gpt-4o-mini matches before gpt-4o.

Baseline as of late 2025 — keep in sync with provider docs or override via the prices option.


#Variable: DEFAULT_SLO_TARGETS

const DEFAULT_SLO_TARGETS: Required<SloTargets>

Defined in: observability/src/slo.ts:47

Explore nearby