Feature Flags Guide¶
Feature flags enable gradual rollout and experimentation in Victor.
Overview¶
Victor uses feature flags to control the availability of experimental features, phased rollouts, and architectural transitions. Feature flags allow:
- Gradual rollout — Enable features incrementally for users
- A/B testing — Compare different implementations
- Quick rollback — Disable features without deploying
- Architecture migrations — Transition between implementations safely
Using Feature Flags¶
Checking Feature Flags¶
from victor.core.feature_flags import feature_flags, FeatureFlag
# Check if a feature is enabled
if feature_flags.is_enabled(FeatureFlag.USE_EDGE_MODEL):
# Use edge model for micro-decisions
service = create_edge_decision_service()
else:
# Use fallback
service = create_heuristic_service()
# Check with default value
enabled = feature_flags.is_enabled(
FeatureFlag.EXPERIMENTAL_FEATURE,
default=False
)
Setting Feature Flags¶
Feature flags can be set via:
- Environment variables (highest priority)
- Configuration file (
~/.victor/settings.yaml) - Default values (in code)
# Via environment variable
export VICTOR_USE_EDGE_MODEL=true
export VICTOR_USE_PROVIDER_POOLING=false
Available Feature Flags¶
AI/ML Features¶
use_edge_model¶
Purpose: Enable fast edge model for micro-decisions instead of cloud LLM
Default: false
Configuration:
Environment Variable: VICTOR_USE_EDGE_MODEL=true
See Also: Edge Model Guide, FEP-0001
Impact:
- Reduces token usage by ~500M tokens/year
- Improves latency for micro-decisions (<2s vs 2-5s)
- Requires Ollama with small model (1.1-3GB)
Migration: See Edge Model Guide for setup instructions
Note:
use_semantic_tool_selectionanduse_provider_poolingare Settings keys
(tool_settings.use_semantic_tool_selection,providers.pooling_enabled), not
FeatureFlagenum members. See Configuration Guide.
Architecture & Refactoring¶
use_composition_over_inheritance¶
Purpose: Phase 4 — Use composition-based verticals instead of inheritance
Default: false
Environment Variable: VICTOR_USE_COMPOSITION_OVER_INHERITANCE=true
Status: 🔄 In Development
Impact:
- Changes vertical integration architecture
- Required for external vertical packages
- Breaking change for custom verticals
Migration: See vertical migration history and current contract boundary
use_strategy_based_tool_registration¶
Purpose: Phase 5 — Use strategy pattern for tool registration
Default: false
Environment Variable: VICTOR_USE_STRATEGY_BASED_TOOL_REGISTRATION=true
Status: ⏳ Planned
Impact:
- More flexible tool registration system
- Enables dynamic tool discovery
- Breaking change for tool providers
Migration: Not yet ready for production use
Service Layer (Phase 3) — Complete ✅¶
Status: All core agent services are now mandatory and bootstrapped
through the canonical runtime/service bundle.
The following service layer flags have been removed as services are now always enabled:
- → ChatService is mandatoryuse_new_chat_service
- → ToolService is mandatoryuse_new_tool_service
- → ContextService is mandatoryuse_new_context_service
- → ProviderService is mandatoryuse_new_provider_service
- → RecoveryService is mandatoryuse_new_recovery_service
- → SessionService is mandatoryuse_new_session_service
Impact:
- Cleaner separation of concerns (completed)
- Better testing and mocking (completed)
- Foundation for future features (completed)
Migration: No action needed. Service-selection flags and their environment
variables are no longer supported; runtime wiring now resolves the canonical
service bundle automatically.
Note:
use_emojisanduse_mcp_toolsare Settings keys (ui.use_emojis,
mcp.enabled), notFeatureFlagenum members.
See Configuration Guide.
UI & Output¶
Integration¶
Feature Flag Lifecycle¶
Phase 1: Development¶
Phase 2: Testing¶
Phase 3: Gradual Rollout¶
Phase 4: Default Enable¶
Phase 5: Removal¶
Best Practices¶
1. Default to Disabled¶
New features should default to false to avoid disrupting existing users:
2. Document Dependencies¶
If a feature flag depends on other flags or configuration:
"""
FeatureFlag.MY_FEATURE requires:
- FeatureFlag.DEPENDENCY_FEATURE enabled
- external_package installed
- API_KEY configured
"""
3. Provide Migration Path¶
Users need a clear path when flags are removed:
# Deprecated: Remove in v1.0
if feature_flags.is_enabled(FeatureFlag.OLD_FEATURE):
warnings.warn(
"OLD_FEATURE is deprecated and will be removed in v1.0. "
"Use NEW_FEATURE instead."
)
4. Monitor Usage¶
Track feature flag usage to guide rollout decisions:
if feature_flags.is_enabled(FeatureFlag.EXPERIMENTAL):
analytics.track("experimental_feature_used")
# ... feature code
5. Safe Fallback¶
Always provide a fallback when features are disabled:
if feature_flags.is_enabled(FeatureFlag.NEW_FEATURE):
result = new_implementation()
else:
result = old_implementation() # Fallback
Troubleshooting¶
Feature Flag Not Working¶
Symptom: Feature flag change has no effect
Solutions:
1. Check environment variable spelling: VICTOR_USE_FEATURE_NAME
2. Verify configuration file location: ~/.victor/settings.yaml
3. Check for conflicting settings (env var > config file > default)
4. Enable debug logging: victor chat --log-level debug
Multiple Flags Interacting¶
Symptom: Unexpected behavior when multiple flags enabled
Solutions:
1. Check flag dependencies in documentation
2. Test flags individually before combining
3. Review flag interaction matrix in docs
Performance Issues¶
Symptom: Enabling a flag causes slowdown
Solutions:
1. Profile with and without flag: victor chat --profile
2. Check flag documentation for known performance impacts
3. Report issue if not documented
References¶
- Feature flag implementation:
victor/core/feature_flags.py(no dedicated ADR exists; graduation policy is tracked as TD-17 in the tech-debt register) - Edge Model Guide
- Configuration Guide
- Architecture Decision Records