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.
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.Cost Calculation
Exported helper functions for calculating LLM API costs. Updated pricing for latest models.Complete Example
Environment Variables
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.
Sessions API
REST API reference.

