Admin Console

Approval Queue

Configure human-in-the-loop approval workflows for high-risk AI actions.

Overview

The approval queue enables human oversight for sensitive AI actions, allowing designated approvers to review and approve or reject requests before execution.

12

PENDING

458

APPROVED

23

REJECTED

5

EXPIRED

Configuring Approval Workflows

Define which actions require approval in your policies:

yaml
# policy.yaml
policies:
  - name: approve-high-value-transactions
    description: Require approval for transactions over $1000
    trigger: action
    action: APPROVAL
    conditions:
      - type: action_type
        value: "financial_transaction"
      - type: amount_greater_than
        value: 1000
    approval_config:
      approvers:
        - "finance-team@company.com"
        - "manager@company.com"
      required_approvals: 1  # How many approvers needed
      timeout_hours: 24
      on_timeout: "reject"  # or "auto_approve"

  - name: approve-external-communications
    description: Require approval for external emails
    trigger: action
    action: APPROVAL
    conditions:
      - type: action_type
        value: "send_email"
      - type: recipient_external
        value: true
    approval_config:
      approvers: ["communications@company.com"]
      required_approvals: 1
      timeout_hours: 4

Handling Approval Requests

Approvals are held by Tork, so they are created and polled over the REST API. There is no Python cloud SDK — @torknetwork/sdk is npm-only, and tork-governance on PyPI decides on-device and cannot hold a request open for a human. When an action needs approval, raise one and wait:

python
import os
import time
import requests

# There is no Python cloud SDK — use the REST API.
TORK_API_KEY = os.environ["TORK_API_KEY"]
headers = {
    "Authorization": f"Bearer {TORK_API_KEY}",
    "Content-Type": "application/json",
}

# Raise an approval request
created = requests.post(
    "https://tork.network/api/v1/approvals",
    headers=headers,
    json={
        "agent_id": "agent-123",
        "tool_name": "financial_transaction",
        "target": "acct_98765",
        "parameters": {"amount": 5000, "currency": "USD"},
        "expires_in_minutes": 30,
    },
).json()

approval_id = created["approval_id"]
print(f"Approval required: {approval_id}")

# Option 1: Poll for the decision
while True:
    status = requests.get(
        f"https://tork.network/api/v1/approvals/{approval_id}",
        headers=headers,
    ).json()

    if status["status"] != "pending":
        if status["status"] == "approved":
            execute_transaction()
        else:
            print(f"Not approved: {status['review_reason']}")
        break

    time.sleep(30)

# Option 2: Use webhooks for async notification instead of polling
# Subscribe to approval_approved / approval_rejected at https://dashboard.tork.network

Approving via API

Approvers can approve or reject requests programmatically:

python
# List pending approvals — this endpoint returns a bare JSON array
pending = requests.get(
    "https://tork.network/api/v1/approvals",
    headers=headers,
    params={"status": "pending", "limit": 50},
).json()

for item in pending:
    print(f"Request: {item['approval_id']}")
    print(f"  Agent: {item['agent_id']}")
    print(f"  Tool: {item['tool_name']}")
    print(f"  Requested: {item['requested_at']}")

# Approve a request
requests.post(
    "https://tork.network/api/v1/approvals/tork_123/approve",
    headers=headers,
    json={
        "reviewer_id": "user@company.com",
        "reason": "Approved after verification",
    },
)

# Reject a request — 'reason' is required when rejecting
requests.post(
    "https://tork.network/api/v1/approvals/tork_456/reject",
    headers=headers,
    json={
        "reviewer_id": "user@company.com",
        "reason": "Amount exceeds quarterly limit",
    },
)

Webhook Notifications

Receive notifications when approvals are decided:

json
{
  "event": "approval.decided",
  "approval_id": "apr_123",
  "timestamp": "2024-01-15T10:30:00Z",
  "data": {
    "decision": "approved",
    "approver": "manager@company.com",
    "comment": "Approved for Q1 budget",
    "agent_id": "agent-123",
    "action_type": "financial_transaction",
    "metadata": {
      "amount": 5000,
      "currency": "USD"
    }
  }
}

Integration: Connect approvals to Slack or email for real-time notifications. See Slack & Discord Integration.

Documentation

Learn to integrate TORK

Upgrade Plan

Current: free

Support

Get help from our team