Skip to main content

Computational Theseus Toolkit (CT Toolkit)

Identity Continuity Guardrails for Agentic Systems

Python 3.11+ License: Apache 2.0 PyPI version Documentation PyPI Downloads codecov

CT Toolkit is an open-source security layer designed to preserve the identity continuity of AI agents over time. It implements the Nested Agentic Architecture (NAA) framework to prevent Sequential Self-Compression (SSC) in multi-agent hierarchies.


📖 Official Documentation

For full API reference, architecture details, examples, and integration guides, visit our documentation site: 👉 https://hakandamar.github.io/ct-toolkit/


Why CT Toolkit?

In complex agentic workflows, LLMs tend to "drift" from their original instructions. CT Toolkit provides the mathematical and cryptographic guardrails to ensure your agents remain aligned with their core constitution, even across deep hierarchies.

  • Staged Approval (Cooldown): Verify risky kernel updates in a sandbox via shadow requests before production promotion.
  • Passive Context Compression Detection: Automatically detects silent provider-side history compression (e.g., OpenAI/Anthropic).
  • Constitutional Kernels: Axiomatic identity anchors.
  • Standalone Auditor CLI: Rapidly audit any LLM endpoint for identity drift without writing code.
  • Autonomous Self-Correction: Active L2->L1 feedback loop that retries and corrects divergent responses before they reach the user.
  • Divergence Engine: Multi-tiered drift analysis (L1/L2/L3).
  • Hierarchical Propagation: Mother-to-child constraint inheritance.
  • Provenance Log: Immutable HMAC-signed interaction history.

Quick Start

pip install ct-toolkit
from ct_toolkit import TheseusWrapper, WrapperConfig

# Protect against silent provider context compression
config = WrapperConfig(compression_passive_detection=True)

# One-line injection for any LLM provider
client = TheseusWrapper(provider="openai", config=config)

# Guardrails and drift analysis applied automatically
response = client.chat("What are your core security axioms?")

print(response.content)
print(f"Divergence Score: {response.divergence_score}")

🔍 Standalone Auditor (CLI)

Audit any LLM endpoint (OpenAI, Ollama, LM Studio) directly from your terminal:

# Audit a local Ollama model
ct-toolkit audit --url http://localhost:11434/v1 --kernel defense

# List available kernels and templates
ct-toolkit list-kernels
ct-toolkit list-templates

If you want a runnable application example instead of a CLI-only flow, see ct-toolkit-fastapi, a small FastAPI validation project that developers can use to test CT Toolkit locally with automated endpoints and pytest coverage.

For Deep Agents workflows, see ct-toolkit-deep-agents, a reference integration project for validating CT Toolkit in multi-agent orchestration scenarios.


🚦 Project Health & Status

Metric Status
Tests ✅ 397 passed, 3 skipped (100% success rate, 90% coverage)
Downloads PyPI Downloads
Last Phase ✅ v0.3.34: Security patches for pillow, aiohttp, pyasn1, setuptools, torch — 20+ Dependabot alerts
Current Goal 🔶 Phase 7: Multi-Agent Synchronization (Integration)

Framework & Model Support

Seamlessly integrate with your favorite frameworks and local models:

  • Local Models: Support for LM Studio, Ollama, and local Qwen/Llama endpoints.
  • LangChain & Deep Agents: wrap_deep_agent_factory.
  • CrewAI: TheseusCrewMiddleware.apply_to_crew.
  • AutoGen: register_reply hooks.

Theoretical Foundation

Translating the framework proposed in The Computational Theseus (2025) into engineering practice.


Community


License

Apache License 2.0.

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

ct_toolkit-0.3.34.tar.gz (94.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

ct_toolkit-0.3.34-py3-none-any.whl (105.1 kB view details)

Uploaded Python 3

File details

Details for the file ct_toolkit-0.3.34.tar.gz.

File metadata

  • Download URL: ct_toolkit-0.3.34.tar.gz
  • Upload date:
  • Size: 94.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for ct_toolkit-0.3.34.tar.gz
Algorithm Hash digest
SHA256 0fbc039342595bdea0bbf96fe253fec0f617f7736a56bc5bebabf4e5c66f15c6
MD5 0bc40bdf3aa44b34193d50e987e467cd
BLAKE2b-256 2549015607062ce9945fe7d2ad6c7f3fb07ad4903f40e87e24a237f0fbac032b

See more details on using hashes here.

File details

Details for the file ct_toolkit-0.3.34-py3-none-any.whl.

File metadata

  • Download URL: ct_toolkit-0.3.34-py3-none-any.whl
  • Upload date:
  • Size: 105.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for ct_toolkit-0.3.34-py3-none-any.whl
Algorithm Hash digest
SHA256 6f6a78da1f568a9abfcfc031a8fe0320e499c70691abfa77a49d1d901c9251d2
MD5 a22cbafdeef69f0a97d920b4412b9bcf
BLAKE2b-256 20790dafa797bb4c853edf1fbd5336fa312e5dc6eace8755b103ad62151c390f

See more details on using hashes here.

Release history Release notifications | RSS feed

0.3.35

2 files

This release

0.3.34 This release

2 files

0.3.33

2 files

0.3.32

2 files

0.3.31

2 files

0.3.30

2 files

0.3.29

2 files

0.3.28

2 files

0.3.27

2 files

0.3.26

2 files

0.3.25

2 files

0.3.23

2 files

0.3.22

2 files

0.3.21

2 files

0.3.20

2 files

0.3.19

2 files

0.3.18

2 files

0.3.17

2 files

0.3.16

2 files

0.3.15

2 files

0.3.14

2 files

0.3.13

2 files

0.3.12

2 files

0.3.11

2 files

0.3.10

2 files

0.3.9

2 files

0.3.8

2 files

0.3.7

2 files

0.3.6

2 files

0.3.5

2 files

0.3.4

2 files

0.3.3

2 files

0.3.2

2 files

0.3.1

2 files

0.3.0

2 files

0.2.9

2 files

0.2.8

2 files

0.2.6

2 files

0.2.5

2 files

0.2.4

2 files

0.2.3

2 files

0.2.2

2 files

0.2.1

2 files

0.2.0

2 files

0.1.7

2 files

0.1.6

2 files

0.1.5

2 files

0.1.4

2 files

0.1.3

2 files

0.1.2

2 files

0.1.1

2 files

0.1.0

2 files

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page