TypeScript SDK
Complete API reference for the Sentrial TypeScript SDK.
Coming Soon
The TypeScript SDK is currently under development. Check back soon or use the Python SDK in the meantime.
Installation (Preview)
npm install @sentrial/sdk
# or
pnpm add @sentrial/sdk
# or
yarn add @sentrial/sdkBasic Usage (Preview)
import { SentrialClient } from '@sentrial/sdk';
// Initialize client
const client = new SentrialClient({
apiKey: process.env.SENTRIAL_API_KEY,
projectId: process.env.SENTRIAL_PROJECT_ID
});
// Create a session
const sessionId = await client.createSession({
name: 'Customer Support Agent',
metadata: { userId: 'user_123' }
});
// Track tool call
await client.trackToolCall({
sessionId,
toolName: 'searchKB',
toolInput: { query: 'password reset' },
toolOutput: { articles: ['KB-001', 'KB-002'] },
reasoning: 'Searching for relevant articles'
});
// Track decision
await client.trackDecision({
sessionId,
reasoning: 'User needs escalation',
alternatives: ['Direct reset', 'Escalate'],
chosen: 'Escalate',
confidence: 0.85
});
// Close session
await client.closeSession(sessionId);Type Safety
The TypeScript SDK is fully typed with TypeScript definitions:
import type {
Session,
Event,
ToolCall,
Decision,
LLMCall
} from '@sentrial/sdk';
// Full IntelliSense and type checking
const session: Session = await client.getSession(sessionId);