reference

@kestrel-agents/observability

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

SDKintermediateCurrent releases
Verified 2026-08-04View 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.8.5 @kestrel-agents/sdk@0.8.5

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

Trace context and attributes

Trace context connects actor, tenant, request, correlation, session, thread, run, turn, operation, tool/effect, and terminal identities. Resolve trusted actor fields at the application boundary and propagate identifiers unchanged.

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

Model/tool operations, terminal outcomes, waits, recovery choices, external approvals/effects, and evaluations remain separately identifiable within the trace. Provider reasoning and agent-authored progress keep their declared source and retention boundary.

Propagation and correlation

Generate request/correlation identity once, carry it across application, runner, worker, provider/tool, and result, and verify all records agree before joining them.

Use the trace data

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

Retention and security

Do not export credentials, active leases, approval secrets, provider continuation state, private reasoning, or unrestricted tool payloads. Apply tenant authorization and retention to trace inspection.

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