Manage agent configurations, prompts, and tool versions with rollback capabilities
Versioning enables you to track, manage, and control different versions of your agent configurations, allowing safe experimentation, rollback, and deployment strategies.
The Versioning primitive provides version control for your agent configurations, including system prompts, tools, rules, and parameters. Like Git for code, versioning for agents lets you experiment safely, maintain production stability, and rollback when needed.Versioning is essential for:
Safe Experimentation: Test new prompts and configurations without affecting production
Rollback Capability: Quickly revert to previous working versions if issues arise
A/B Testing: Compare different agent configurations to find optimal setup
Environment Management: Maintain different configurations for dev, staging, and production
Audit Trail: Track changes to agent behavior over time
Configuration Snapshots
Capture complete agent configuration at any point in time
Instant Rollback
Revert to any previous version instantly if problems occur
Parallel Testing
Run multiple versions simultaneously for comparison
import { Agentbase } from '@agentbase/sdk';const agentbase = new Agentbase({ apiKey: process.env.AGENTBASE_API_KEY});// Create a versioned agent configurationconst v1 = await agentbase.createVersion({ name: "customer-support-v1.0.0", description: "Initial customer support agent", config: { system: "You are a friendly customer support specialist.", mode: "base", rules: [ "Always be polite and professional", "Verify user identity before sharing account details" ] }});console.log('Version created:', v1.version); // "1.0.0"// Use the versioned configurationconst result = await agentbase.runAgent({ message: "I need help with my account", version: "customer-support-v1.0.0"});
// Create new version with improvementsconst v2 = await agentbase.createVersion({ name: "customer-support-v1.1.0", description: "Added empathy and faster response guidelines", basedOn: "customer-support-v1.0.0", // Track lineage config: { system: `You are a friendly and empathetic customer support specialist. Guidelines: - Respond quickly and efficiently - Show empathy for customer frustrations - Provide step-by-step solutions - Always verify identity before sharing account details`, mode: "base", rules: [ "Always be polite, professional, and empathetic", "Verify user identity before sharing account details", "Provide solutions in clear, numbered steps" ] }, changelog: [ "Added empathy guidance to system prompt", "Expanded guidelines for better clarity", "Added rule for step-by-step solutions" ]});// Test new versionconst testResult = await agentbase.runAgent({ message: "I'm frustrated, my order hasn't arrived", version: "customer-support-v1.1.0"});
// Production is on v2.0.0, but issues detectedconst productionVersion = "customer-support-v2.0.0";try { // Attempt to use current production version const result = await agentbase.runAgent({ message: "Test production version", version: productionVersion });} catch (error) { console.error('Production version failed:', error); // Rollback to previous stable version await agentbase.setProductionVersion({ name: "customer-support", version: "customer-support-v1.1.0" // Last known good version }); console.log('Rolled back to v1.1.0'); // Log rollback for audit trail await logRollback({ from: "customer-support-v2.0.0", to: "customer-support-v1.1.0", reason: "Production errors detected", timestamp: new Date() });}
Breaking Changes: Fundamental changes to agent behavior or interface
Copy
// v1.0.0 → v2.0.0const v2 = await agentbase.createVersion({ name: "support-agent-v2.0.0", description: "Complete rewrite with new capabilities", config: { system: "You are an AI-powered support specialist with access to advanced troubleshooting tools.", mcpServers: [ { serverName: "diagnostics", serverUrl: "https://api.company.com/mcp" } ], // Completely new approach and capabilities }, breaking: true, changelog: [ "BREAKING: Changed from basic support to advanced troubleshooting", "BREAKING: Added diagnostic tool requirements", "BREAKING: Modified response format" ]});
Minor Version (x.Y.0)
New Features: Backwards-compatible improvements
Copy
// v1.0.0 → v1.1.0const v1_1 = await agentbase.createVersion({ name: "support-agent-v1.1.0", description: "Added multilingual support", basedOn: "support-agent-v1.0.0", config: { system: `You are a customer support specialist. NEW: Support multiple languages: - Auto-detect customer language - Respond in their preferred language - Maintain professional tone across languages`, // All previous capabilities maintained }, changelog: [ "Added multilingual support", "Improved language detection", "Maintained all v1.0.0 capabilities" ]});
Patch Version (x.y.Z)
Bug Fixes: Backwards-compatible bug fixes
Copy
// v1.1.0 → v1.1.1const v1_1_1 = await agentbase.createVersion({ name: "support-agent-v1.1.1", description: "Fixed response formatting issue", basedOn: "support-agent-v1.1.0", config: { // Same configuration as v1.1.0 // with minor prompt adjustment system: `You are a customer support specialist. Support multiple languages... FIX: Always format responses with proper markdown`, }, changelog: [ "Fixed markdown formatting in responses", "Corrected edge case in language detection" ]});
Problem: Specified version doesn’t existSolution: Verify version name and check available versions
Copy
// List available versionsconst versions = await agentbase.listVersions("support-agent");console.log('Available:', versions.map(v => v.name));// Check if specific version existsconst exists = await agentbase.versionExists("support-agent-v1.2.0");
Configuration Conflict
Problem: Version configuration has conflicting settingsSolution: Validate configuration before creating version