AI Control Tower

Documentation

Complete guide to integrating and using AI Control Tower

Quick Start

Get started with AI Control Tower in less than 10 minutes. Track your first AI decision and start building compliance from day one.

Prerequisites

  • Node.js 18+ or Python 3.8+
  • An AI Control Tower account
  • Your API key from the settings page

Installation

JavaScript/TypeScript

npm install @ai-control-tower/sdk

# or

yarn add @ai-control-tower/sdk

Python

pip install ai-control-tower

Other Languages

Use our REST API directly. SDKs for Go, Ruby, and Java coming soon.

Authentication

Initialize the SDK with your API key:

JavaScript/TypeScript

import { AIControlTower } from '@ai-control-tower/sdk';

const act = new AIControlTower({
  apiKey: process.env.ACT_API_KEY,
});

Python

from ai_control_tower import AIControlTower

act = AIControlTower(api_key=os.environ["ACT_API_KEY"])

Track AI Decision

Track every AI decision with full context, inputs, outputs, and metadata:

const decision = await act.trackDecision({
  model: "gpt-4",
  provider: "openai",
  input: "What is the capital of France?",
  output: "The capital of France is Paris.",
  metadata: {
    userId: "user_123",
    sessionId: "session_456",
    environment: "production",
  },
  cost: 0.0023,
  latency: 234,
  tokens: {
    input: 8,
    output: 7,
    total: 15,
  },
});

console.log("Decision ID:", decision.id);

Generate Explanation

Generate human-readable explanations for AI decisions to meet regulatory requirements:

const explanation = await act.explainDecision({
  decisionId: decision.id,
  framework: "gdpr", // or "hipaa", "eu-ai-act", etc.
});

console.log(explanation.summary);
// "This AI decision used GPT-4 to answer a factual question..."

Check Policy Compliance

Validate decisions against your governance policies before execution:

const policyCheck = await act.checkPolicy({
  model: "gpt-4",
  provider: "openai",
  input: userPrompt,
});

if (policyCheck.status === "violation") {
  console.error("Policy violation:", policyCheck.violations);
  // Block the AI request
} else {
  // Proceed with AI request
  const response = await openai.chat.completions.create({...});

  // Track the decision
  await act.trackDecision({...});
}

REST API

Use the REST API directly if you prefer:

Base URL

https://api.aicontroltower.com/v1

POST /decisions

Track a new AI decision

curl -X POST https://api.aicontroltower.com/v1/decisions \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "gpt-4",
    "provider": "openai",
    "input": "What is the capital of France?",
    "output": "The capital of France is Paris.",
    "cost": 0.0023,
    "latency": 234
  }'

POST /explanations

Generate an explanation for a decision

curl -X POST https://api.aicontroltower.com/v1/explanations \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "decision_id": "dec_abc123",
    "framework": "gdpr"
  }'

POST /policy-checks

Check if a decision would violate policies

curl -X POST https://api.aicontroltower.com/v1/policy-checks \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "gpt-4",
    "provider": "openai",
    "input": "Sensitive user prompt"
  }'

Webhooks

Configure webhooks to receive real-time notifications for policy violations and other events:

Event Types

  • policy.violation - A decision violated a policy
  • cost.threshold - Cost threshold exceeded
  • decision.created - New decision tracked

Webhook Payload

{
  "event": "policy.violation",
  "timestamp": "2024-01-20T15:30:00Z",
  "data": {
    "decision_id": "dec_abc123",
    "policy_id": "pol_xyz789",
    "severity": "high",
    "violation_details": {
      "rule": "cost_limit",
      "threshold": 0.01,
      "actual": 0.023
    }
  }
}

Configure webhooks in your notification settings.

Need Help?

Our team is here to help you integrate AI Control Tower into your stack.