Installation
Quick Start
SentrialClient
constructor(config)
createSession(params)
Create a new tracking session. Returns string | null (null when failSilently is true and the request fails).
trackToolCall(params)
Track a tool call event.
trackDecision(params)
Track an agent decision.
completeSession(params)
Complete a session with final metrics.
trackError(params)
Track an error event.
begin(params) / interaction.finish()
Simplified API that auto-manages sessions. Returns an Interaction object.
begin() also accepts name (session title override; auto-named {event}:{id} otherwise) and
model. After begin(), interaction.setMetadata(obj) merges keys into the session metadata
and interaction.setModel(model) records the session-level model — both are applied on
finish() (an explicit finish-time model wins). Client-level equivalents:
client.setSessionMetadata(sessionId, obj) / client.setSessionModel(sessionId, model).
interaction.reportDiagnostic(report)
Record an agent’s observation about missing context, a tool problem, a missing capability, or
uncertain completion. Call this explicitly while the interaction is active. It does not call a model,
change session success, or create a confirmed signal or training label.
Agent reports are included in the unreleased SDK changes. Staging acceptance is complete; package
publication is pending. Use matching SDK, collector and trace UI builds to test this feature.
await client.reportDiagnostic({ sessionId, report }). Use the same client
that created the active session. Both methods resolve to null; resolution is not a durable-delivery
receipt. Check transport diagnostics and the retained trace. Finished or degraded interactions do not
accept new reports.
The SDK sets the report revision and origin; do not supply extra fields. Configured metadata PII
redaction, batching, retry and
failSilently behavior apply. Each call creates a separate event;
recovery does not overwrite the original report or prove business success. The trace UI labels these
Agent report and Reported recovered. Older collectors retain generic metadata without the
validated report presentation. Absence of a report does not establish success.
LLM Auto-Wrappers
Automatically track all LLM calls with token counts, cost, and latency.wrapAnthropic(client), wrapGoogle(model), wrapLLM(client) (auto-detect).
Decorators & Higher-Order Functions
Event Batching
Queue tracking calls and flush them periodically instead of sending each one immediately. Reduces HTTP overhead for high-throughput agents.PII Redaction
Automatically redact sensitive data before it leaves your infrastructure.Auto-fetching (
pii: true) requires the API key to have the pii-config:read scope. If the key
lacks it the fetch is refused and the SDK falls back to the default redaction config (label mode,
default fields, builtin patterns) — your org’s configured mode/fields/custom patterns are NOT
applied. The SDK logs a one-time warning when this happens.Cost Calculation
Exported helper functions for calculating LLM API costs. Updated pricing for latest models.Complete Example
Environment Variables
Transport
The SDK ingests over OTLP (/api/otel/v1/traces) — this is the sole ingestion path. The OTLP path
requires the API key to carry both sessions:write and events:write scopes — dashboard-generated
keys include both, but a manually-scoped sessions:write-only key will silently drop data. Add
events:write to the key.
Next Steps
Python SDK
Python SDK with LangChain support.
Claude Code Integration
Auto-track Claude Agent SDK sessions and tool calls.
Vercel AI SDK
Auto-track generateText, streamText, and tool calls.
OpenAI Agents SDK
Mirror every Agents SDK run into a session — LLM calls, tools, handoffs, guardrails.
Sessions API
REST API reference.

