@agentskit/observability — for agents
Console + LangSmith + OpenTelemetry logging, token counters, cost guard, trace viewer, signed audit log, devtools server.
#Install
npm install @agentskit/observability#Primary exports
#Loggers / tracers
consoleLogger(config?)— local dev logging.langsmith(config)— LangSmith observer.opentelemetry(config)— OTel observer.createTraceTracker({ onSpanStart, onSpanEnd })— low-level span lifecycle.
#Sinks (batch HTTP exporters)
datadogSink(config)— Datadog Logs intake.axiomSink(config)— Axiom dataset ingest.newRelicSink(config)— New Relic Log API.
#Guards + counters
costGuard(options)— dollar ceiling per run.multiTenantCostGuard(options)— per-tenant cost cap with shared bookkeeping.createAdvancedCostGuard({ budgets, caps, mode, disableRuntime, alertSinks })— production-grade guard withwarn/reject/killmodes, rolling window caps (perMinute/perDay/perMonth/ custom), 50/80/100 % threshold alerts, linear forecast alerts, and pluggable sinks.consoleAlertSink(),webhookAlertSink({ url, headers }),throttle(sink, windowMs)— built-in alert sinks.chargebackReport(samples, { groupBy, from, to })+chargebackReportToCsv(report)— pure cost-attribution exporter for finance / per-tenant invoicing.priceFor,computeCost,DEFAULT_PRICES.approximateCounter,countTokens,countTokensDetailed,createProviderCounter.
#PII redaction
wrapObserverWithRedaction(observer, { rules, mode?, vault?, allowedRoles? })— redact (or tokenize via@agentskit/core/security) string content fields in the AgentEvent stream (llm:end.content,tool:start.args,tool:end.result,agent:delegate:end.result,error.message) before they hit the underlying sink. Numeric / structural fields pass through unchanged so dashboards stay correct.
#Local trace viewer
createFileTraceSink(dir),buildTraceReport,renderTraceViewerHtml. See Trace viewer.
#Devtools server
createDevtoolsServer,toSseFrame. See Devtools server.createTopologyGraph— live multi-agent topology graph for the devtools UI.createControlSurface— production pause / step / replay control surface.
#SLO
sloObserver(targets?),DEFAULT_SLO_TARGETS— emit SLO breach events from latency / error / cost windows.
#Signed audit log
createSignedAuditLog,createInMemoryAuditStore. Hash-chain + HMAC. See Audit log.appendPiiAuditEvents(log, { actor, action, hits, subjectId?, reason? })— append one signed entry per PII redaction hit to an existingSignedAuditLog.actionispii:redact,pii:reveal, orpii:reveal-denied; each payload records rule id, counts, and matchoffset/lengthonly (no raw spans), for tamper-evident audit evidence alongside the hash chain.
#Minimal example
import { consoleLogger, costGuard } from '@agentskit/observability'
import { createRuntime } from '@agentskit/runtime'
const runtime = createRuntime({
adapter,
observers: [consoleLogger(), costGuard({ maxUsd: 0.5 })],
})#Related
- @agentskit/observability-langfuse — Langfuse logger backend.
- @agentskit/eval
- @agentskit/runtime
- @agentskit/core/security — vault / tokenization used by
wrapObserverWithRedaction.
#Source
- npm: https://www.npmjs.com/package/@agentskit/observability
- repo: https://github.com/AgentsKit-io/agentskit/tree/main/packages/observability
Explore nearby
- PeerFor agents — overview
Dense, LLM-friendly reference for every AgentsKit package. Designed to paste into an agent's context window.
- Peer@agentskit/core — for agents
Zero-dependency foundation. Contracts, chat controller, primitives, and a dozen feature subpaths.
- Peer@agentskit/adapters — for agents
Provider adapters (OpenAI-compatible + native) + router + ensemble + fallback + generic factory.
@agentskit/skills — for agents
Ready-made personas (system prompt + behavior) + composition + marketplace registry.
@agentskit/observability-langfuse — for agents
Langfuse tracing adapter — plan / tool / model / HITL spans with token, cost, latency capture and parent linking across multi-agent topologies.