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

1. Install the SDK

Install the Tork SDK using your package manager:

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 the Client

Create a client instance with your API key:

python
from tork import TorkClient

# Initialize with API key
client = TorkClient(api_key="tork_sk_your_key_here")

# Or use environment variable
# export TORK_API_KEY=tork_sk_your_key_here
client = TorkClient()  # Reads from TORK_API_KEY
Keep your API key secure
Never commit your API key to version control. Use environment variables or a secrets manager in production.

3. Make Your First API Call

Let's scan some content for PII (Personally Identifiable Information):

python
from tork import TorkClient

client = TorkClient(api_key="your_api_key")

# Scan for PII
result = client.pii.scan(
    content="Contact john@example.com or call 555-123-4567"
)

print(f"PII Found: {result['found']}")
print(f"Types: {result['types']}")
print(f"Redacted: {result['redacted']}")

# Output:
# PII Found: True
# Types: ['email', 'phone']
# Redacted: Contact [EMAIL] or call [PHONE]

4. Check Policy Before Actions

Before your agent takes an action, check if it's allowed by policy:

python
# Check if an action is allowed
result = client.policy.check(
    agent_id="my-agent",
    action_type="send_email",
    content="Sending confirmation to user"
)

if result['allowed']:
    # Proceed with the action
    print("Action allowed, proceeding...")
    send_email()
else:
    # Handle policy violation
    print(f"Blocked: {result['reason']}")
    print(f"Policy: {result['policy_name']}")

5. View Your Dashboard

Now that you've made API calls, visit your dashboard to see the results:

Tork Dashboard

View audit logs, TORKING-X scores, and manage your governance settings.

Open Dashboard
Congratulations!
You've successfully set up Tork and made your first API calls. Your AI agents are now protected with PII detection and policy enforcement.

Next Steps