description: "Session-telemetry capture seam for deployments and backend authors choosing a reporting backend, mounting redaction rules, or implementing the backend contract."
English | 中文
Session telemetry lets deployments send ordered copies of session activity for reporting while preserving the canonical session log. Deployments choose one reporting backend and can redact each outbound copy before delivery; without redaction rules, captured data leaves the process unchanged. The handoff is non-blocking, so reporting does not delay session processing. Delivery is best effort, and queued records may be lost if the process crashes.
As a deployment, choose a backend, mount it, and add redaction rules when records must not leave the process as captured. As a backend author, implement the three-member contract and compose the coordinator with a capture mode.
Load exactly one backend plugin; it registers ctx.sessionTelemetry with the capture coordinator and its delivery pipeline. A duplicate load throws. The required sharing member reports the deployment mode, not per-session admission or delivery. A consumer may report "not configured" only when no telemetry service is mounted. The /feedback command confirms recording without reading this policy.
A backend implements three members: emit(record) must be a non-blocking enqueue because it runs synchronously on the session-event path; optional flush() is a fire-and-forget hint after a turn ends, which most backends omit in favor of their SDK's own batching schedule; shutdown() drains queued records and resolves when the SDK stops, and disposal awaits it. A backend that implements flush() must order concurrent flushes with the final shutdown() drain.
Capture runs in one of two modes. live capture follows session events as they are appended, replays already-live sessions at mount time, and records lifecycle markers; on-demand capture reads the canonical session log only when the backend requests a prefix through captureSession(session, throughSeq?). Coordinator options select whether stored history is included. Every canonical session event maps to one ledger record in order. An assistant/message or assistant/attempt record carries its complete embedded compact stream, including failed and retried output. Each ledger record also carries session.id, session.format_version, the numeric event identity, optional header facts, and a pre-mapped severity (error for tool/result.isError, turn/end error reasons, and agent-error; info otherwise).
Every backend discloses its deployment mode through sharing: full, feedback-only, or disabled. A backend may additionally restrict eligible Sessions. This property is not a delivery receipt; handoff is a non-blocking enqueue, and batching, retry, and loss policy belong to the backend SDK.
Every outbound record passes the sessionTelemetry/record waterfall after the coordinator copies its canonical event. This package ships no rules: with no listener mounted, records reach the backend exactly as captured, so exported data is as clean as the rules a deployment mounts. Listeners stack by transforming next()'s return value; a throwing listener withholds that one record fail-closed. Redaction applies to the outbound copy only — the canonical session log is never rewritten.
Read these pages when the seam contract is not enough. They move from the shipped backend to the subsystem reference and the decision evidence.
None, as the seam observes the session stream and hands redacted copies outward; it registers nothing model-facing.
None; the package neither assembles nor sends a provider request.
These limits define the delivery and data-protection guarantees a deployment gets. They are current package constraints.
sessionTelemetry/record listener mounted, records leave the process exactly as captured, including any credentials embedded in file contents or command output; a deployment exporting to a shared collector owns its rule set.captureSession() deep-copies and redacts their current values with the policy mounted at that time, and there is no capture-time telemetry snapshot or durable pre-capture spool.Runtime invariant: No companion is published. The package's whole output is the backend handoff — a synchronous emit() call outside every authoritative event stream — and its capture side never appends session events, so no event/data relation exists for an independent companion to observe.