Getting Started with Savvagent
Get up and running with Savvagent in less than 5 minutes. This guide will walk you through creating your first feature flag and integrating it into your application.
Quick Start Checklist
- β Create a Savvagent account
- β Create your first organization
- β Add an application and get your SDK key
- β Create a feature flag
- β Install the SDK in your app
- β Evaluate the flag in your code
Step 1: Create an Account
Savvagent uses TOTP-based passwordless authentication for enhanced security. No passwords to remember!
- Visit savvagent.com/signup
- Enter your email address and name
- Scan the QR code with your authenticator app (Google Authenticator, Authy, 1Password, etc.)
- Enter the 6-digit code to verify your device
- Save your backup recovery codes in a safe place
β οΈ Important: Save Your Backup Codes
Your backup codes are the only way to recover your account if you lose access to your authenticator app. Store them securely (password manager, encrypted file, etc.).
Step 2: Create an Organization
Organizations are the top-level tenant boundary in Savvagent. Each organization can have multiple applications (web, mobile, API, etc.).
- After signing up, you'll be prompted to create your first organization
- Enter your organization name (e.g., "Acme Inc", "My Startup")
- Click "Create Organization"
Step 3: Add an Application
Applications represent different parts of your system. Each application gets unique SDK keys for secure access.
- Navigate to the "Applications" page from the sidebar
- Click "New Application"
- Enter a name (e.g., "web-app", "mobile-ios", "api-server")
- Copy your SDK key and server key (you'll need these later)
Step 4: Create Your First Flag
Feature flags control which features are enabled in your application. Let's create a simple boolean flag.
- Navigate to the "Flags" page
- Click "New Flag"
- Enter a flag key (e.g., "new-dashboard", "beta-features")
- Add a description (e.g., "Enable new dashboard redesign")
- Configure environment settings (enable for dev, disable for production, etc.)
- Optionally set percentage rollout or targeting rules
- Click "Create Flag"
Step 5: Install the SDK
Currently we support JavaScript/TypeScript. More SDKs coming in Phase 2!
JavaScript/TypeScript (NPM)
Step 6: Use the Flag in Your Code
Initialize the SDK and start evaluating flags:
Basic Usage (JavaScript)
import { SavvagentClient } from '@savvagent/client-web';
// Initialize the client
const client = new SavvagentClient({
sdkKey: 'sdk_1a2b3c4d5e6f7g8h9i0j',
apiUrl: 'https://api.savvagent.com', // Or your self-hosted URL
environment: 'production'
});
// Initialize the client (fetches all flags)
await client.initialize();
// Evaluate a flag
const isEnabled = client.isEnabled('new-dashboard', {
userId: 'user-123',
attributes: {
email: 'user@example.com',
plan: 'pro'
}
});
if (isEnabled) {
// Show new dashboard
console.log('New dashboard enabled!');
} else {
// Show old dashboard
console.log('Old dashboard');
}React Example
import { useState, useEffect } from 'react';
import { SavvagentClient } from '@savvagent/client-web';
const client = new SavvagentClient({
sdkKey: 'sdk_1a2b3c4d5e6f7g8h9i0j',
apiUrl: 'https://api.savvagent.com'
});
function App() {
const [showNewDashboard, setShowNewDashboard] = useState(false);
useEffect(() => {
client.initialize().then(() => {
const enabled = client.isEnabled('new-dashboard', {
userId: getCurrentUserId()
});
setShowNewDashboard(enabled);
// Listen for real-time updates
client.on('flagsUpdated', () => {
const enabled = client.isEnabled('new-dashboard', {
userId: getCurrentUserId()
});
setShowNewDashboard(enabled);
});
});
}, []);
return (
<div>
{showNewDashboard ? <NewDashboard /> : <OldDashboard />}
</div>
);
}Real-time Flag Updates
Savvagent automatically connects to our Server-Sent Events (SSE) endpoint to receive flag updates in real-time. No polling required!
// Subscribe to flag updates
client.on('flagsUpdated', (flags) => {
console.log('Flags updated:', flags);
// Re-evaluate your flags
});
// Unsubscribe when done
client.off('flagsUpdated', listener);Advanced Features
Percentage Rollouts
Gradually roll out features to a percentage of users. Users are "sticky" - they'll always see the same variation.
In the Savvagent dashboard, set a percentage rollout (e.g., 25% for beta testing). The SDK uses consistent hashing to ensure the same users always see the feature.
Targeting Rules
Target specific users, countries, or custom attributes:
const isEnabled = client.isEnabled('premium-features', {
userId: 'user-123',
attributes: {
country: 'US',
plan: 'enterprise',
betaTester: true
}
});Flag Scheduling
Schedule flags to activate or deactivate automatically at specific times (perfect for time-limited promotions).
AI Error Detection
Savvagent's AI automatically detects when errors correlate with flag changes. Integrate with Sentry to get alerts when your flags cause issues.
Next Steps
π Flag Consumer API Reference
Complete REST API documentation for flag evaluation, telemetry, analytics, and audit endpoints.
π§ SDK Integration Guide
Complete SDK documentation with framework examples, best practices, and integration guides.
π You're All Set!
You've successfully created your first feature flag with Savvagent. Start experimenting with advanced features like AI error detection, MCP integrations, and real-time updates.
Go to Dashboard β