-
Notifications
You must be signed in to change notification settings - Fork 0
running features
Features are resolved through variations of relevant experiences. When you run a feature, the SDK finds all experiences whose variations include a fullStackFeature change linked to that feature, evaluates targeting rules, buckets the visitor, and returns the resolved feature status and variable values. See the data model for the full resolution chain.
Returns a single feature's status and variable values for the current visitor.
from convert_sdk import FeatureStatus
# Returns FeatureResult | None — None is a normal miss (feature not declared, or
# the visitor isn't bucketed into a variation carrying it), not an error:
feature = context.run_feature("feature-key")
if feature is not None and feature.status is FeatureStatus.ENABLED:
headline = feature.variables.get("headline") # cast to the variable's declared typeParameters:
| Parameter | Type | Required | Description |
|---|---|---|---|
| featureKey | string | Yes | The feature's unique key |
| attributes | object | No | Bucketing attributes (see creating a user context for the full attributes reference), plus: |
typeCasting (boolean) -- auto-convert values to the variable's defined type (default: true) |
|||
experienceKeys (string[]) -- limit evaluation to specific experiences only |
Returns all features with their status and variable values for the current visitor.
for feature in context.run_features():
if feature.status is FeatureStatus.ENABLED:
print("enabled:", feature.feature_key)Parameters:
| Parameter | Type | Required | Description |
|---|---|---|---|
| attributes | object | No | Bucketing attributes (see creating a user context for the full attributes reference), plus typeCasting (boolean, default: true) |
Returns: An array of BucketedFeature objects.
Each resolved feature is returned as a BucketedFeature with the following fields:
| Field | Type | Description |
|---|---|---|
featureId |
string | The feature ID |
featureKey |
string | The feature key |
status |
string / FeatureStatus |
"enabled" or "disabled" (PHP uses the FeatureStatus enum) |
variables |
object / array | The feature variables with their resolved values |
End-to-end flow: initialize the SDK, create a user context, run a feature, and check its status and variables.
from convert_sdk import Core, SDKConfig, FeatureStatus
core = Core(SDKConfig(sdk_key="your-sdk-key")).initialize()
context = core.create_context("user-unique-id")
feature = context.run_feature("feature-key")
# run_feature returns None on a miss (unlike the Ruby/Swift disabled-sentinel):
if feature is not None and feature.status is FeatureStatus.ENABLED:
cta_color = feature.variables.get("ctaColor", "#0066ff")
core.close()Copyrights © 2025 All Rights Reserved by Convert Insights, Inc.
Getting Started
Python SDK
- Quickstart
- Installation
- Initialization
- Configuration
- Code Examples
- Type Hints
- Diagnostics
- Extending
- Testing
- Async & Frameworks
Migration
Core Concepts
- Experiences & Variations
- Feature Flags
- Bucketing Algorithm
- Rule Evaluation
- Segments
- Data Management
- Event System
- API Communication
How-To Guides
- Running Experiences
- Running Features
- Tracking Conversions
- Visitor Context
- Persistent DataStore
- Troubleshooting
Edge & Integrations
Maintainers