The Python client
reliafy-client is the Python client for the API, and it installs the reliafy command line too. Pure standard library, no dependencies; you bring SurPyval (docs) for your own fits.
Install and sign in
pip install reliafy-client # installed as reliafy-client, imported as `reliafy`
from reliafy import Client
rf = Client(token="rlf_...") # or RELIAFY_TOKEN, or the token saved by `reliafy login`- Version 0.3 needs a Reliafy server with the tools API: reliafy.com has it from this release; a self-hosted server needs a build where
GET /api/v1/toolsanswers. Against an older server the new calls stop withreliafy.ServerTooOld, and everything from 0.2 keeps working. - Self-hosted:
Client(base_url="https://reliafy.example.com"). A local server with sign-in off needs no token.
Every tool: Client.call
Client.call(tool, action=None, /, wait=False, **args)POST /api/v1/{tool}/{action}Call any tool action with its arguments, exactly as the Claude connector does. Leave out action for a tool without actions. wait=True (or a number of seconds) polls a long-running job until it finishes.
tool | str | required | The tool, e.g. "life_data_analysis". |
action | str | optional | The action (or kind), e.g. "fit". |
wait | bool | float | optional | Wait for a job_id result to finish (True, or at most this many seconds). |
**args | any | optional | The action's arguments; None values are left out. |
{ … } # the tool's result, the same JSON an AI assistant getsrf.call("list", "models")
rf.call("life_data_analysis", "fit", distribution="weibull",
data=[120, 340, 510, 700, 980], censored=[0, 0, 1, 0, 0], unit="hours")
rf.call("guide", topic="life_data") # a tool without actions
rf.call("rbd_analysis", "analyze", rbd_id="…", simulate=True, wait=True)
rf.tools() # the tools and actions you may call (GET /api/v1/tools)
rf.spec() # the OpenAPI spec- Shortcuts:
rf.list(kind),rf.get(kind, id),rf.fit(data, distribution=…, censored=…),rf.reliability(model_id, times),rf.guide(topic),rf.wait(job_id). reliafy.call(tool, action, **args)does the same with the configured token.- A refused call raises
reliafy.ReliafyErrorwithstatus(the HTTP status) anddetail(what Reliafy said).
Files, photos and data
rf.upload_dataset("bearings.xlsx", name="Bearings") # CSV or .xlsx, as a dataset
rf.import_rbd("plant.xml") # BlockSim, Open-PSA, Galileo, RePyability, the Excel template
rf.import_excel("fmea.xlsx", target="rcm") # dataset, rcm or rbd
rf.add_photo("nameplate.jpg", target_id="…") # Reliafy Maintenance users
rf.push_usage(fleet_id, [{"name": "Truck 01", "current_use": 5230}])
rf.push_measurements(tracked_fleet_id, file="readings.csv")
rf.push_lives(dataset_id, file="new_failures.csv") # appends, then refits its modelsFiles are streamed from disk. The ingest helpers take rows, csv= text or file= a path, and are also on the module (reliafy.push_usage(…)). Reliafy Maintenance users also have push_readings for meter and condition readings.
The 0.2 functions (still supported)
Everything from 0.2 works unchanged, on any server: reliafy.configure(token=…), then the functions below. Each maps to one of the original routes; open one for its parameters and what it returns.
reliafy.models
models.push(model, name, *, data=True, unit=None)POST /api/import/modelsPush a fitted SurPyval model and return its URL.
models.push(model, name, *, data=True, unit=None)POST /api/import/modelsmodel | SurPyval model | required | A fitted SurPyval distribution. |
name | str | required | Model name. |
data | bool | optional | Upload the fitted observations too (default True → full plot, refittable). False = params only. |
unit | str | optional | Unit of the time axis. |
"https://reliafy.com/modelling/m/a1b2…" # str — open in the appmodels.push_params(distribution, params, name, *, unit=None, extras=None)POST /api/import/modelsPush a model by distribution + parameter values (no SurPyval object).
models.push_params(distribution, params, name, *, unit=None, extras=None)POST /api/import/modelsdistribution | str | required | e.g. "weibull". |
params | number[] | {name,value}[] | required | Parameter values. |
name | str | required | Model name. |
unit | str | optional | Time unit. |
extras | dict | optional | gamma / p / f0 for offset / LFP / zero-inflation. |
"https://reliafy.com/modelling/m/…" # strmodels.list()GET /api/v1/modelsYour saved models.
models.list()GET /api/v1/models[ { "id": "a1b2…", "name": "Bearing life", "distribution": "Weibull",
"kind": "distribution", "n": 30, "unit": "hours", "url": "/modelling/m/…" }, … ]models.get(model_id)GET /api/v1/models/{id}One model's fit.
models.get(model_id)GET /api/v1/models/{id}model_id | str | required | Model id. |
{ "id": …, "distribution": "Weibull", "params": [{name, value, se, ci}],
"coefficients": [], "metrics": null, "gof": [{id, label, value}] }models.reliability(model_id, t=None, covariates=None)POST /api/v1/models/{id}/reliabilityEvaluate the reliability functions.
models.reliability(model_id, t=None, covariates=None)POST /api/v1/models/{id}/reliabilitymodel_id | str | required | Model id. |
t | number | optional | Time to evaluate at. Omit for the whole curve. |
covariates | dict | optional | Covariate values for a proportional-hazards model. |
{ "at": { "reliability": 0.666, "failure": 0.334, "hazard": …,
"cumulative_hazard": …, "density": … } } # or {"curves": {...}}models.fit(dataset_id, distribution, name, *, mapping=None, unit=None, covariates=None, formula=None)POST /api/v1/fitFit and save a model from one of your datasets.
models.fit(dataset_id, distribution, name, *, mapping=None, unit=None, covariates=None, formula=None)POST /api/v1/fitdataset_id | str | required | Dataset to fit. |
distribution | str | required | e.g. weibull, weibull_ph, best. |
name | str | required | Model name. |
mapping | dict | required | Role → column, e.g. {"x": "hours", "c": "failed"}. |
unit | str | optional | Time unit. |
covariates | str[] | optional | Covariate columns (PH). |
formula | str | optional | Formulaic covariate formula. |
{ "id": …, "name": "Bearing life", "distribution": "Weibull", "url": "/modelling/m/…" }reliafy.data
data.upload(name, *, csv=None, data=None)POST /api/v1/datasetsCreate a dataset from CSV text or column arrays.
data.upload(name, *, csv=None, data=None)POST /api/v1/datasetsname | str | required | Dataset name. |
csv | str | optional | Raw CSV text (with a header). Provide this or data. |
data | dict | optional | Column arrays, e.g. {"hours": [...], "failed": [...]}. |
{ "id": "d3…", "name": "Bearings", "n_rows": 8, "columns": ["hours","failed"], "url": "/modelling/data/…" }reliafy.strategy
strategy.optimal_replacement(distribution, params, planned_cost, unplanned_cost, *, unit=None)POST /api/v1/strategy/optimal-replacementCost-optimal preventive-replacement interval.
strategy.optimal_replacement(distribution, params, planned_cost, unplanned_cost, *, unit=None)POST /api/v1/strategy/optimal-replacementdistribution | str | required | e.g. weibull. |
params | number[] | required | Distribution parameters. |
planned_cost | number | required | Cost of a planned replacement. |
unplanned_cost | number | required | Cost of a failure. |
unit | str | optional | Time unit. |
{ "optimal_time": 580.5, "optimal_cost_rate": 0.51, "beneficial": true, "mttf": 1272.4 }strategy.failure_finding(distribution, params, target_availability, *, unit=None)POST /api/v1/strategy/failure-findingInspection interval for a hidden (protective) function.
strategy.failure_finding(distribution, params, target_availability, *, unit=None)POST /api/v1/strategy/failure-findingdistribution | str | required | e.g. exponential. |
params | number[] | required | Distribution parameters. |
target_availability | number | required | Target availability in (0,1), e.g. 0.99. |
unit | str | optional | Time unit. |
{ "interval": 176.4, "method": "…", "mttf": 8760, "target_availability": 0.99 }strategy.demonstration_test(reliability, *, confidence=0.95, mission_time=None, failures=0, test_multiple=1.0, shape=None, units=None, method='attribute', mtbf=None, design_reliability=None, design_mtbf=None, producer_risk=None, unit=None, b_life=None, shape_interval=None)POST /api/v1/strategy/demonstration-testPlan a reliability demonstration test: units to test, test time per unit, allowed failures.
strategy.demonstration_test(reliability, *, confidence=0.95, mission_time=None, failures=0, test_multiple=1.0, shape=None, units=None, method='attribute', mtbf=None, design_reliability=None, design_mtbf=None, producer_risk=None, unit=None, b_life=None, shape_interval=None)POST /api/v1/strategy/demonstration-testreliability | number | required | Reliability to show over one mission, in (0,1). |
confidence | number | optional | Confidence in (0,1), default 0.95. |
mission_time | number | optional | The mission the reliability is over. |
failures | int | optional | Failures allowed, default 0 (success run). |
test_multiple / shape | number | optional | Test each unit k missions, Weibull shape known. |
units | int | optional | Units available: solve for test time per unit (needs shape). |
design_reliability / design_mtbf | number | optional | A good design's true reliability (or MTBF): its chance of passing. |
producer_risk | number | optional | With the good design: the most chance of failing it, e.g. 0.2. The plan keeps both risks and chooses the failures allowed. |
b_life | number | optional | A B-life requirement instead of reliability: 10 for “B10 ≥ mission_time”. |
shape_interval | number[2] | optional | β’s interval [lower, upper]: adds shape_sensitivity, warning when β is too poorly known for the plan. |
{ "units": 128, "failures": 8, "consumer_risk": 0.097, "producer_risk": 0.192, "summary": "Test 128 units…", "oc_curve": {…}, "tradeoff": {…} }reliafy.fleet
fleet.forecast(fleet_id)GET /api/v1/fleets/{id}/forecastThe live failure forecast for one of your fleets.
fleet.forecast(fleet_id)GET /api/v1/fleets/{id}/forecastfleet_id | str | required | Fleet id (from /fleet/forecasts/<id>). |
{ "fleet": {id, name, model_id}, "forecast": {status, method, periods, expected_failures, …} }- Errors raise
reliafy.ReliafyError; reads/writes are scoped to your own data. - Full request and response field tables are on Original routes and ingest.