Getting Started
Installation
Install Tork for Python or JavaScript to add AI governance to your applications. Tork ships two different packages — decide which one you want before you run an install command.
Two packages — pick deliberately
tork-governance (PyPI and npm) is the on-device package installed on this page. Its entry class is Tork. tork-governance makes the governance decision on your machine. PII detection, redaction and the returned verdict are computed on-device. With no API key it makes zero network calls: prompts, completions and detected PII values never leave the machine, and nothing appears in your dashboard.
@torknetwork/sdk (npm, v2.0.0) is the cloud package. Its entry class is TorkClient. It sends your content to Tork, Tork makes the decision server-side, and the receipt is written to your dashboard as capture_mode=cloud attested_by=tork. Both families can populate a dashboard; this is the one whose row records a decision Tork executed rather than a claim you attested.
TorkClient and AsyncTorkClient do not exist in tork-governance. Importing them after a tork-governance install is an ImportError in Python and undefined in JavaScript.
Local governance is free and unlimited — decisions made on your own machine are never metered. Evidence is what is metered: attestations, receipts and anchoring.
Python Installation — on-device (tork-governance)
Installs the on-device package. It governs locally and produces a local result; it does not populate your dashboard. The import root is tork_governance, not tork.
JavaScript / TypeScript Installation — on-device (tork-governance)
Installs the on-device package. It governs locally and produces a local result; it does not populate your dashboard. Import { Tork } — this package has never exported TorkClient.
Verify Installation
Test the on-device install by governing a line of text. There is no API health check to run here — with no API key this makes zero network calls, so a successful result proves the package works locally, not that you can reach Tork.
The Python result is a dataclass — read fields with result.action, not result['action']. The returned fields are action, output, pii, receipt and report. There is no redacted field — the governed text is in output.
Reporting On-Device Decisions to Your Dashboard
Supply an API key and the SDK additionally reports a metadata-only attestation of each decision — the action taken, PII type labels and counts, a risk classification, policy labels and a salted fingerprint. It never sends input text, output text or PII values. The decision itself is still made on-device and is never delayed or changed by reporting. Those attestations appear in your dashboard and are included in the daily on-chain anchor — each one recorded as a client attestation (capture_mode=edge, attested_by=client), a claim Tork recorded but did not execute and cannot independently verify. Requires tork-governance 0.24.0+ (PyPI) or 0.11.0+ (npm).
A decision reported by an on-device SDK is recorded as a client attestation (capture_mode=edge, attested_by=client): a claim Tork recorded but did not execute and cannot independently verify. A decision made by @torknetwork/sdk is recorded as capture_mode=cloud, attested_by=tork — Tork made that call itself. Both are equally immutable once anchored; they differ in what is immutable. A client attestation freezes your claim. A server-governed receipt freezes Tork's own decision.
Cloud Installation — @torknetwork/sdk
Install this instead if you want Tork to make the governance decision and write a receipt to your dashboard today. It sends your content to Tork. This is the package that exports TorkClient. It is npm-only — there is no PyPI equivalent, so Python users needing dashboard receipts should call the REST API directly.
A plain REST call with a Bearer token to https://tork.network/api/v1/govern is equally server-governed and works from any language.
Next Step: Configure your API key and environment. See Configuration.