Python
Basic Installation
With LangChain Support
pip install sentrial langchain-core
# Or install all optional dependencies
pip install sentrial[all]
Requirements
- Python 3.9 or higher
requests library (installed automatically)
langchain-core (optional, for LangChain integration)
TypeScript / Node.js
npm install @sentrial/sdk
Requirements
- Node.js 18 or higher
- TypeScript 5.0+ (for TypeScript projects)
Configuration
Environment Variables (Recommended)
Set your API key as an environment variable for automatic configuration:
# .env file
SENTRIAL_API_KEY=sentrial_live_xxxxxxxxxxxxx
# Optional: custom API URL (for self-hosted)
SENTRIAL_API_URL=https://api.sentrial.com
Python Configuration
import sentrial
# Option 1: Use environment variables (automatic)
sentrial.configure() # Reads SENTRIAL_API_KEY
# Option 2: Explicit configuration
sentrial.configure(
api_key="sentrial_live_xxx",
api_url="https://api.sentrial.com" # Optional
)
# Option 3: Create client directly
from sentrial import SentrialClient
client = SentrialClient(api_key="sentrial_live_xxx")
TypeScript Configuration
import { SentrialClient } from '@sentrial/sdk';
// Create client with API key
const client = new SentrialClient({
apiKey: process.env.SENTRIAL_API_KEY,
// Optional: custom API URL
apiUrl: 'https://api.sentrial.com'
});
Getting Your API Key
Go to Settings
Navigate to Settings → API Keys in the sidebar.
Create API Key
Click “Create API Key”, give it a name, and copy the key.
Keep your API key secure. Never commit your API key to version control. Use environment variables or a secrets manager.
Verify Installation
Run this quick test to verify everything is working:
import sentrial
# Configure
sentrial.configure(api_key="sentrial_live_xxx")
# Create a test session
interaction = sentrial.begin(
user_id="test_user",
event="test_event",
input="Testing Sentrial installation"
)
# Finish it
interaction.finish(
output="Installation verified!",
success=True
)
print("Sentrial is working correctly!")
Check your Sentrial dashboard. You should see the test session appear within seconds.
Next Steps