TypeScript SDK, REST API, sub-100ms edge assignments. Four bandit algorithms that automatically optimize traffic. Not a marketer's drag-and-drop tool.
import { BanditClient } from '@bandit/sdk';
const bandit = new BanditClient({
apiUrl: 'https://api.runbandit.com',
apiKey: 'your-api-key'
});
// Get the best variant for this user
const { treatment } = await bandit.getAssignment('headline-test', 'user-123');
// Track when they convert
bandit.trackEvent({ eventType: 'CONVERSION', value: 29.99 });Pass user context for smarter targeting. The contextual bandit uses device type, location, and custom features to personalize assignments.
import { BanditClient } from '@bandit/sdk';
const bandit = new BanditClient({
apiUrl: 'https://api.runbandit.com',
apiKey: 'your-api-key'
});
// Get assignment with context for smarter targeting
const { treatment, confidence } = await bandit.getAssignment(
'headline-experiment',
'user-123',
{
deviceType: 'mobile',
location: 'US',
referrer: 'google'
}
);
// Show the winning variant
document.getElementById('hero').innerHTML = treatment.config.html;
// Track conversion with value
bandit.trackEvent({
eventType: 'CONVERSION',
value: 29.99,
metadata: { product: 'premium-plan' }
});From SDK call to optimized assignment in under 100ms.
Each algorithm has different trade-offs. Choose based on your traffic and goals.
When you want simplicity with a tunable exploration rate.
When you want confidence-bound driven exploration.
When you have low traffic and need Bayesian efficiency.
When user context (device, location) should inform selection.
This is a simulation of Thompson Sampling allocating traffic across three variants. In production, this happens automatically on every request.
Traffic automatically shifts to the best-performing variant. No manual intervention needed.
npm install @bandit/sdknew BanditClient({ apiUrl, apiKey })bandit.getAssignment(expId, userId)bandit.trackEvent({ eventType, value })open dashboard → watch it optimize
Start optimizing in five minutes. Free tier available, no credit card required.