Installation¶
Requirements¶
- Python 3.11 or later
- pip or uv package manager
Basic installation¶
This installs CT Toolkit's lightweight core dependencies. For CLI tools, the Web Audit Dashboard, PostgreSQL vaults, local ONNX embeddings, or OpenTelemetry, install the desired optional extras below or use ct-toolkit[all]:
Feature & Framework Extras¶
Install optional extras based on the features and frameworks you use:
Enables ct-toolkit status, ct-toolkit dashboard --web (Interactive Web UI), ct-toolkit audit, and ct-toolkit serve (click, rich, fastapi, uvicorn).
Enables SQLAlchemy / PostgreSQL provenance vaults (vault_url) and OpenTelemetry tracing/metrics (opentelemetry-api, opentelemetry-sdk).
Enables local ONNX embeddings (fastembed) for offline Contrastive L1 divergence analysis without external API calls.
Enables TheseusChatModel, TheseusLangChainCallback, TheseusCrewMiddleware, and TheseusAutoGenMiddleware.
Enables DivergencePenaltyLoss for PyTorch training loops (torch >= 2.0).
Development installation¶
For contributors or if you want to run the test suite:
git clone https://github.com/Theseus-Guard/ct-toolkit
cd ct-toolkit
# Using uv (recommended)
uv sync --all-extras
# Or with pip
pip install -e ".[dev,all]"
Run the tests:
Virtual environment (recommended)¶
Always use a virtual environment in production:
Verifying the installation¶
Or run a quick sanity check:
from ct_toolkit import TheseusWrapper, ConstitutionalKernel
kernel = ConstitutionalKernel.default()
print(f"Kernel: {kernel.name}")
print(f"Anchors: {len(kernel.anchors)}")
print(f"Commitments: {len(kernel.commitments)}")
Expected output:
Dependencies overview¶
CT Toolkit's lightweight core dependencies:
| Package | Purpose |
|---|---|
litellm |
Unified transport layer (OpenAI, Anthropic, Ollama, etc.) |
instructor |
Structured L2/L3 judge responses |
numpy |
L1 embedding calculations |
pyyaml |
Kernel and template YAML loading |
pydantic |
Config validation |
cryptography |
HMAC key management |
jinja2 |
System prompt templating |
Modular Optional Extras
CT Toolkit's core does not require PyTorch, FastAPI, or SQLAlchemy unless you opt into [ml], [server], or [enterprise].