Skip to main content

Python SDK for Niyati, the hosted engine for reachability, fragility, and collapse-aware decision intelligence

Project description

niyati-core

Python SDK for Niyati, the hosted engine for:

  • reachable-future analysis
  • collapse and fragility detection
  • point-of-no-return tracking
  • decision support under resource and timing constraints

Niyati is for cases where probability forecasts are not enough and you need to know what remains structurally possible.

Typical use cases:

  • startup runway and survival planning
  • prediction market and scenario elimination
  • game decision validation and scoring
  • strategic planning under budget, constraint, and path dependence

Install

Published package flow:

pip install niyati-core

Local development flow:

pip install maturin
maturin develop

Build

maturin build --release

Python 3.8 through 3.13 are supported directly. Python 3.14+ requires PYO3_USE_ABI3_FORWARD_COMPATIBILITY=1.

Hosted API

Default production API:

  • https://api.causalorlabs.com

The current Python release line targets the live hosted API contract and sends the required version header automatically.

Usage

import json
import niyati

schema = {
    "version": "1.0.0",
    "metadata": {"name": "SDK Demo"},
    "time": {"type": "discrete", "horizon": 4},
    "resources": {
        "money": {"initial": 1000.0, "min": 0.0, "max": 10000.0}
    },
    "variables": {
        "x": {
            "type": "float",
            "initial": 0.0,
            "min": 0.0,
            "max": 10.0,
            "discretization": 1.0
        }
    },
    "actions": [
        {
            "name": "increment",
            "cost": {"money": 10.0},
            "effects": {"x": {"op": "add", "value": 1.0}},
            "preconditions": []
        }
    ],
    "transitions": [],
    "constraints": [],
    "goal": {
        "type": "threshold",
        "conditions": [{"variable": "x", "operator": "gte", "value": 3.0}]
    }
}

session = niyati.NiyatiSession(
    json.dumps(schema),
    api_key="your_api_key_here",
    base_url="https://api.causalorlabs.com"
)

remote_result = json.loads(session.evaluate())
local_result = json.loads(session.simulate_local())

What You Get Back

Responses include:

  • verdict
  • timeline
  • point_of_no_return
  • recommendation
  • trust_level
  • error_bounds

That means the SDK is not just returning a binary answer; it gives you enough structure to build operator dashboards, game loops, alerts, and scenario tooling.

Functions

  • simulate(schema_json, budget=None, api_key=None, base_url=None, capability=None) - one-off remote evaluation (capability: full or lite, default full)
  • simulate_local(schema_json, budget=None) - one-off local engine execution
  • NiyatiSession.evaluate(budget=None, capability=None) - remote evaluation with timeout and retries
  • NiyatiSession.simulate_local(budget=None) - capped local execution
  • NiyatiSession.solve_reachability(payload_json) - calls /v1/solve/reachability
  • NiyatiSession.solve_fragility(payload_json) - calls /v1/solve/fragility
  • NiyatiSession.solve_trajectory(payload_json) - calls /v1/solve/trajectory
  • NiyatiSession.solve_multiagent(payload_json) - calls /v1/solve/multiagent
  • NiyatiSession.solve_competition(payload_json) - calls /v1/solve/competition
  • NiyatiSession.solve_pareto(payload_json) - calls /v1/solve/pareto

Runtime Notes

  • Remote calls send the version header required by the hosted API.
  • Retry attempts preserve X-Niyati-Key.
  • POST /v1/simulate can be used anonymously, but /v1/solve/* requires a valid API key.
  • Legacy class alias CausalorSession remains available during migration.
  • Local execution is capped to <= 5 variables and horizon <= 12.
  • The production hosted API for Niyati is expected at https://api.causalorlabs.com.

Learn More

  • GitHub: https://github.com/CausalorLabs/Niyati
  • API onboarding: niyati-core/docs/API_ONBOARDING.md
  • Developer guide: niyati-core/docs/DEVELOPER_GUIDE.md

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

niyati_core-0.3.18.tar.gz (186.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

niyati_core-0.3.18-cp312-abi3-macosx_11_0_arm64.whl (1.4 MB view details)

Uploaded CPython 3.12+macOS 11.0+ ARM64

File details

Details for the file niyati_core-0.3.18.tar.gz.

File metadata

  • Download URL: niyati_core-0.3.18.tar.gz
  • Upload date:
  • Size: 186.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: maturin/1.12.6

File hashes

Hashes for niyati_core-0.3.18.tar.gz
Algorithm Hash digest
SHA256 a0464afddc641f4fb56dc3a9dff363df2622911dc9ef2a25af877e0aae589533
MD5 4055450cc46cad4f6cacf2edfc4df16b
BLAKE2b-256 3be7b02ee45d402e0880328d9d9f88f5ee4bc91f6e72350cc049fe8ef0200298

See more details on using hashes here.

File details

Details for the file niyati_core-0.3.18-cp312-abi3-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for niyati_core-0.3.18-cp312-abi3-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 3e860f0f2b80c7fd2dd877b9ef02fae6fbb1c29b5d97ef8b19115061384a12ce
MD5 a519dcdf02751ede881a2c70e3a962fa
BLAKE2b-256 3c129bc3db8ccfa1e7c603a922f1277187233b2b00a4d783cafd38802e82c7e2

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page