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.5.tar.gz (93.1 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.5-cp312-abi3-macosx_11_0_arm64.whl (1.3 MB view details)

Uploaded CPython 3.12+macOS 11.0+ ARM64

File details

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

File metadata

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

File hashes

Hashes for niyati_core-0.3.5.tar.gz
Algorithm Hash digest
SHA256 63fabf9a2061bd32127112e654f76b39244266bf8e8c838a4049aff736ddb8b4
MD5 6d0216600e1f973a40c3b1d79d5b775c
BLAKE2b-256 b970c122180bb6210d10d08e6f6e97a7e62a4901616fb451606def845b948778

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for niyati_core-0.3.5-cp312-abi3-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 441dd82e6d7da48c80a64294277801250ff093704cd0d1ea8ec31b8d450a891c
MD5 802d04f43c570f32ad92b37f3a056c70
BLAKE2b-256 c213c9635a7faeb5ee5826d183e16e3cf7686fe24959838415917da1a5bd6fb8

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