Skip to main content
IIOS — The platform for organizational reasoning
Reference

SDK Guides

First-class SDKs for TypeScript and Python. Both generate types from your ontology, scope every request to your tenant, and return results with provenance and confidence attached.

TypeScript

The TypeScript SDK is the recommended way to build web and Node applications on IIOS.

Install
Terminal
npm install @iios/sdk

Query the graph

query.ts
import { createClient } from "@iios/sdk"

const iios = createClient({
  tenant: process.env.IIOS_TENANT,
  token: process.env.IIOS_TOKEN,
})

// Query the Industrial Knowledge Graph
const { entities } = await iios.graph.query({
  type: "Asset",
  where: { site: "PLANT-04", status: "degraded" },
  traverse: { events: { since: "-90d" }, evidence: true },
})

// Types are generated from your ontology
for (const asset of entities) {
  console.log(asset.id, asset.confidence, asset.evidence.length)
}

Run reasoning

reason.ts
const answer = await iios.reason({
  question: "Which assets at PLANT-04 are most likely to fail this quarter?",
  scope: { site: "PLANT-04" },
})

console.log(answer.summary)
console.log(answer.confidence)     // calibrated 0-1 score
console.log(answer.evidence)       // linked source records

Python

The Python SDK mirrors the TypeScript API and is ideal for data science and pipeline workloads.

Install
Terminal
pip install iios

Query the graph

query.py
from iios import Client

iios = Client(tenant="acme-industrial")

result = iios.graph.query(
    type="Asset",
    where={"site": "PLANT-04", "status": "degraded"},
    traverse={"events": {"since": "-90d"}, "evidence": True},
)

for asset in result.entities:
    print(asset.id, asset.confidence, len(asset.evidence))

Events & webhooks

Subscribe to graph changes and reasoning outputs to trigger downstream workflows the moment new evidence arrives or a confidence score shifts.

subscribe.ts
// Subscribe to graph changes and reasoning outputs
const stream = iios.events.subscribe({
  on: ["evidence.added", "confidence.changed"],
  where: { site: "PLANT-04" },
})

for await (const event of stream) {
  console.log(event.type, event.entityId, event.confidence)
}