tessl install tessl/pypi-posthog@6.7.0Integrate PostHog into any python application.
Agent Success
Agent success rate when using this tile
89%
Improvement
Agent success rate improvement when using this tile compared to baseline
1.03x
Baseline
Agent success rate without this tile
86%
Build a configuration service that uses feature flags to control application behavior and provide dynamic configuration values.
Your service should:
Create a FeatureFlagService class with the following methods:
__init__(api_key: str, host: str): Initialize the service with API credentials and host URLis_feature_enabled(feature_name: str, user_id: str) -> bool: Returns whether the feature is enabled for the userget_feature_variant(feature_name: str, user_id: str) -> str | bool | None: Returns the variant/value of the feature flagget_all_features(user_id: str) -> dict: Returns a dictionary of all feature flags for the userget_feature_config(feature_name: str, user_id: str) -> dict | None: Returns the configuration payload for the featureProvides analytics and feature flag evaluation capabilities.
@test
Input:
Expected Behavior:
The is_feature_enabled method should return a boolean indicating whether the feature is enabled.
File: test_feature_service.py { .test-file }
def test_feature_enabled():
service = FeatureFlagService(api_key="test_key", host="http://localhost")
result = service.is_feature_enabled("new_dashboard", "user_123")
assert isinstance(result, bool)@test
Input:
Expected Behavior:
The get_feature_variant method should return the variant value (could be a string, boolean, or None).
File: test_feature_service.py { .test-file }
def test_feature_variant():
service = FeatureFlagService(api_key="test_key", host="http://localhost")
result = service.get_feature_variant("button_color", "user_456")
assert result is not None or result is None # Can be any value@test
Input:
Expected Behavior:
The get_all_features method should return a dictionary containing all feature flags.
File: test_feature_service.py { .test-file }
def test_all_features():
service = FeatureFlagService(api_key="test_key", host="http://localhost")
result = service.get_all_features("user_789")
assert isinstance(result, dict)@test
Input:
Expected Behavior:
The get_feature_config method should return a dictionary with the feature's payload data.
File: test_feature_service.py { .test-file }
def test_feature_config():
service = FeatureFlagService(api_key="test_key", host="http://localhost")
result = service.get_feature_config("pricing_config", "user_101")
assert result is None or isinstance(result, dict)