ruleflow-sdk
Python SDK for RuleFlow — evaluate published business rules from your application, with in-memory caching so repeated evaluations don't hit the network every time.
Install
pip install ruleflow-sdk
Usage
from ruleflow_sdk import DecisionEngine
# Create once (e.g. at app startup) and reuse — it holds an in-memory cache.
engine = DecisionEngine(
base_url="https://your-ruleflow-backend.example.com",
api_key="your-ruleflow-api-key",
cache_ttl_seconds=60, # optional, defaults to 60
)
result = engine.evaluate("premium_pod_limit", {"plan": "premium", "country": "india"})
if result:
max_pods = result["max_pods"]
else:
max_pods = default_limit # conditions didn't match
evaluate(rule_id, context):
- Fetches the rule's published DSL (cached for
cache_ttl_seconds— repeat calls within that window never hit the network). - Evaluates the conditions locally against
context. - Returns the rule's action dict if matched, else
None. - Records an analytics event on the backend (fire-and-forget — never raises, even if the backend is briefly unreachable).
refresh(rule_id=None) — force-bust the cache for one rule, or all cached
rules, instead of waiting out the TTL.
Requirements
- Python >= 3.10
- A running RuleFlow backend, reachable from wherever this SDK is used, with the target rule already published.
License
MIT — see LICENSE.
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file ruleflow_sdk-0.1.0.tar.gz.
File metadata
- Download URL: ruleflow_sdk-0.1.0.tar.gz
- Upload date:
- Size: 4.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via:
twine/7.0.0 CPython/3.14.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a4ffebcfd486e4c7d8c29230c9c438c3480071c56cea9d854a7d31fccc852747
|
|
| MD5 |
ea2f9822a4c8f2ecc95706be7dbcd08b
|
|
| BLAKE2b-256 |
9f96ba25de90b7018804c13b2b918388995330562e42bfaf3760cf9f1116a7ee
|
File details
Details for the file ruleflow_sdk-0.1.0-py3-none-any.whl.
File metadata
- Download URL: ruleflow_sdk-0.1.0-py3-none-any.whl
- Upload date:
- Size: 6.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via:
twine/7.0.0 CPython/3.14.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
306ead560f8ac66271fd1bdc9589571bca307f73ea5c547b53cf2a217cce7ec8
|
|
| MD5 |
13514eb73f7b66d8ba255a8bd8575cf2
|
|
| BLAKE2b-256 |
3922ca854610916602998d5d4be0d98c2904dd74a11eeb5bd40f45fe8b76b0c2
|