Documentation Index
Fetch the complete documentation index at: https://www.sentrial.com/docs/llms.txt
Use this file to discover all available pages before exploring further.
Requires:
@anthropic-ai/claude-agent-sdk v0.2.0+ as a peer dependency. Works with the query() function for one-shot and multi-turn interactions.What Gets Tracked Automatically
Sessions
Created on init, completed on result — with agent name, user ID, and metadata.
Tool Calls
Every tool execution (Bash, Read, Write, etc.) with input, output, and tool use ID.
Tokens & Cost
Prompt tokens, completion tokens, total tokens, and estimated cost in USD.
Conversation Threading
Group related sessions with
convoId — multi-turn conversations appear linked.Errors
Failed tool calls, errored sessions, and generator exceptions — all recorded.
Duration
Wall-clock time from start to result, plus API-side duration when available.
Consume the stream until the
result message to record final tokens/cost/output. If you close the
generator early (for example via break/return), the session is marked failed with
Session interrupted (generator closed early) so runs do not remain stuck in running.Installation
Quick Start
Wrap thequery() function once, then use it exactly like normal.
Configuration Options
Conversation Threading
UseconvoId to group related sessions into a conversation. Each call to trackedQuery() creates a new session, but they appear linked in the dashboard.
How Tool Tracking Works
The wrapper uses PostToolUse and PostToolUseFailure hooks to capture every tool execution. Hooks fire asynchronously and never block the agent. A session-ready gate ensures hooks wait for session creation before tracking.Error Handling
If the agent errors, the generator throws, or the consumer closes the stream early, the session is automatically marked as failed with a clear failure reason.Full Production Example
What You See in the Dashboard
Session Overview
Agent name, user ID, conversation thread, status, duration, cost.
Input / Output
The prompt and Claude’s final response.
Tool Call Timeline
Every Bash, Read, Write, Glob call — with input, output, and tool use ID.
Token & Cost Breakdown
Prompt tokens, completion tokens, total, estimated USD cost.
Next Steps
Claude Code (Python)
Same integration for the Python Claude Agent SDK.
TypeScript SDK Reference
Full SDK documentation with all methods and options.

