Docs/Getting Started

Quick Start

5 min

Get 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.

bash
pip install tork-governance
MCP Users
If you're using Claude, Cursor, or other MCP-compatible tools, you can also install our MCP server: npm install -g @torknetwork/mcp-server

2. Initialize Tork

The entry class is Tork. In Python the import root is tork_governance, not tork. No API key is needed:

python
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
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. Local governance is free and unlimited — decisions made on your own machine are never metered. Evidence is what is metered: attestations, receipts and anchoring.

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:

python
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 dashboard

The 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:

javascript
// 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
Never commit your API key to version control. Use environment variables or a secrets manager in production.
Reporting from the on-device SDK
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.

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.

Open Dashboard
Congratulations!
You've set up Tork and made your first governance call. You now know which of your calls are decided on your machine and which are decided by Tork — and which of them leave evidence behind.

Next Steps