reference

@kestrel-agents/observability

Kestrel-native tracing and OpenTelemetry export for runs, streams, resumptions, and subscriptions.

SDKintermediate0.7.0 Stable
Verified 2026-03-20View sourceReport a docs issue

The package starts with a Kestrel-native trace model and offers OTEL export as a bridge.

Install

Bash
pnpm add @kestrel-agents/observability@0.7.0 @kestrel-agents/sdk@0.7.0

Core APIs

APIPurposeCommon use
createTracer()construct the tracerattach processors and exporters
InMemoryTraceProcessorkeep traces in processlocal debugging and tests
wrapAgent()instrument one agentadd trace coverage without changing route logic
toOpenTelemetrySpans()bridge to OTEL-compatible recordsvendor-neutral export

Wrap an agent

TypeScript
const tracer = createTracer({
  processors: [new InMemoryTraceProcessor()],
});
 
const tracedAgent = tracer.wrapAgent(agent);

What gets instrumented

Agent callTrace kind
run()run
stream()stream
resume()resume
subscribe()subscription

Use the trace data

Your application continues to work with runs, sessions, and subscriptions while exporters translate trace records for external observability tools.

Common failure cases

FailureUsually means
no traces appearwrapped agent is not the one used by routes
traces lack actor or tenant metadatarequest context is incomplete
export succeeds but related activity is hard to followroutes, runs, or reports do not share correlation identifiers

Use traces in operation