Quick Start
5 minGet up and running with Tork in 5 minutes. This guide covers installation, initialization, and your first API calls.
Prerequisites
- Python 3.10+ or Node.js 18+
- Nothing else for steps 1–3. The on-device package needs no account and no API key.
- For step 4 (server-governed receipts in your dashboard): a Tork account — Sign up free — and an API key from your Dashboard
1. Install the SDK
Install tork-governance, the on-device package. It governs on your machine and produces a local result. It does not populate your dashboard — step 4 covers that.
pip install tork-governanceMCP Users
npm install -g @torknetwork/mcp-server2. Initialize Tork
The entry class is Tork. In Python the import root is tork_governance, not tork. No API key is needed:
from tork_governance import Tork
# No API key: the decision is made on this machine and
# nothing is sent anywhere. This is free and unlimited.
tork = Tork()TorkClient is a different package
TorkClient and AsyncTorkClient belong to @torknetwork/sdk, not to tork-governance. Importing them here is an ImportError in Python and undefined in JavaScript. See step 4.What this does and does not produce
3. Make Your First Governance Call
Call govern() to scan text for PII and apply the redaction. It is synchronous in both languages — the decision is computed locally, so there is no network call to await:
from tork_governance import Tork
tork = Tork()
result = tork.govern("Check this text for PII: john@example.com")
print(result.action) # GovernanceAction.REDACT
print(result.output) # "Check this text for PII: [EMAIL_REDACTED]"
print(result.receipt.receipt_id) # "rcpt_..." — a LOCAL receipt, not in your dashboardThe returned fields are action, output, pii, receipt and report. There is no redacted field — the governed text is in output. In Python the result is a dataclass, so read it with result.action, not result['action'].
4. Get Receipts in Your Dashboard
Steps 1–3 never contact Tork, so nothing from them appears in your dashboard. To get a receipt today, let Tork make the decision server-side — either with @torknetwork/sdk (npm, v2.0.0, entry class TorkClient) or with a plain REST call. Both send your content to Tork and are recorded as capture_mode=cloud attested_by=tork:
// npm install @torknetwork/sdk
import { TorkClient } from '@torknetwork/sdk';
const client = new TorkClient({ apiKey: 'tork_sk_your_key_here' });
// Sends content to Tork; Tork decides server-side and writes a receipt.
const result = await client.govern('Check this text for PII: john@example.com');
console.log(result.action);Keep your API key secure
Reporting from the on-device SDK
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.
5. View Your Dashboard
If you ran step 4, visit your dashboard to see the receipts. If you only ran steps 1–3, your dashboard will be empty — that is expected, because those calls never left your machine.
Tork Dashboard
View audit logs, TORKING-X scores, and manage your governance settings.