Skip to main content

crocotiger

Public SDK for the crocotiger sentence-level prompt guardrail — LangChain and LlamaIndex framework adapters.

Installation

The open wrapper and the engine is on public PyPI:

pip install crocotiger
pip install crocotiger_engine

Quick start

Build (or load an existing) SentenceValidator, then validate a prompt directly — no framework required.

import asyncio
from pathlib import Path
from crocotiger_engine import SentenceValidator, build_sentence_validator

VALIDATOR_PATH = Path("./my_validator/sentence_validator")
DATASETS_PATH = Path("./datasets")  # dataset corpus is downloaded here on first use

if VALIDATOR_PATH.exists():
    # Later runs: just load the saved artifact back, no rebuild needed.
    sentence_validator = SentenceValidator.load_from(str(VALIDATOR_PATH))
else:
    # First run: builds and saves a validator (needs an LLM API key — OPENAI_API_KEY,
    # GEMINI_API_KEY, or DEEPSEEK_API_KEY — and downloads the dataset corpus on first use).
    sentence_validator = build_sentence_validator(
        output_dir=VALIDATOR_PATH.parent,
        topic="customer support for an online banking product",
        context="a banking customer support assistant",
        restricted_topics=["hacking or unauthorized system access"],
        total_topic_questions=500,
        datasets_path=DATASETS_PATH,
    )

result = asyncio.run(sentence_validator.validate("How do I hack into a database?"))
print(result.valid)  # False

Framework integrations

crocotiger works as a drop-in component in:

  • LangChain — from crocotiger.integrations.langchain import SentenceValidatorMiddleware
  • LlamaIndex — from crocotiger.integrations.llamaindex import SentenceValidatorLLMGuard

Both examples below reuse the sentence_validator loaded in Quick start above, and need their respective LLM provider package (pip install langchain-openai / pip install llama-index-llms-openai) — swap in whichever provider you actually use, this library is LLM-provider-agnostic.

LangChain

import asyncio
from crocotiger.integrations.langchain import SentenceValidatorMiddleware
from langchain.agents import create_agent

agent = create_agent(
    model="openai:gpt-4o",
    middleware=[SentenceValidatorMiddleware(sentence_validator)],
)
result = asyncio.run(
    agent.ainvoke({"messages": [{"role": "user", "content": "How do I hack into a database?"}]})
)
print(result["validation_result"])

LlamaIndex

import asyncio
from crocotiger.integrations.llamaindex import SentenceValidatorLLMGuard
from llama_index.llms.openai import OpenAI

guarded_llm = SentenceValidatorLLMGuard(
    llm=OpenAI(model="gpt-4o"),
    sentence_validator=sentence_validator,
)
response = asyncio.run(guarded_llm.aquery("How do I hack into a database?"))
print(response.metadata["validation_result"])

See docs/examples/example_framework_integrations.py for a full, runnable script wiring both frameworks to the same validator.

Contributing

Contributions to crocotiger are welcome. Because this is a dual-licensed open-core project, we require every commit to carry a Developer Certificate of Origin (DCO) sign-off before we can merge. This lets us keep the open-core model viable and continue offering crocotiger under Apache 2.0. See CONTRIBUTING.md for details.

We do not accept contributions to the proprietary engine.

Trademarks

"crocotiger", "TekDatum", and associated logos are trademarks of TekDatum. The Apache 2.0 license for the open code does not grant rights to use these marks. You may build on and redistribute the open code, but you may not use our names or logos in a way that implies endorsement or that misrepresents the origin of a fork. See TRADEMARKS.md.

Documentation

Document Description
Concepts How the guardrail works, build vs load, optimization strategies
API Reference Full public API
Examples Runnable scripts

License

  • The contents of this repository are licensed under the Apache License, Version 2.0 — see LICENSE.
  • The proprietary crocotiger-engine binary is licensed under a Commercial EULA — see EULA.md.
  • Third-party components and their licenses are listed in NOTICE.

License boundary

This project uses an open-core model. It has two layers with different licenses:

Layer Package License Where it lives
Open wrapper + SDK crocotiger Apache License 2.0 This repo · public PyPI
Proprietary engine crocotiger-engine Commercial EULA (closed binary) Private GitHub Releases · requires access

What this means in practice:

  • The code in this repository is free and open under Apache 2.0. You can read it, fork it, modify it, and build on it, including commercially, subject to the Apache 2.0 terms.
  • The wrapper depends on a separate, proprietary binary package (crocotiger-engine) that contains TekDatum's core IP. That binary is not open source. Installing and using it requires accepting the Commercial EULA and, for production use, a license from TekDatum.
  • Calling the proprietary engine through this open SDK does not make your own code subject to the EULA — your application code is yours. The EULA governs only the proprietary binary itself.

If you only want to read or contribute to the open layer, you never need a license. If you want to run the full product, you need the engine.

What's open and what's not

Open (Apache 2.0, in this repo):

  • The SDK and public API surface
  • Framework adapters (LangChain / LlamaIndex)
  • Configuration schema, type stubs, examples, and docs

Proprietary (Commercial EULA, separate binary):

  • The core guardrail implementation

We keep this boundary deliberate and documented so you always know which terms apply to which code.


© 2026 TekDatum.

Metadata

Release files for crocotiger 0.1.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for crocotiger 0.1.1
File Size Uploaded
crocotiger-0.1.1.tar.gz 13.4 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for crocotiger 0.1.1
File Interpreter ABI Platform
crocotiger-0.1.1-py3-none-any.whl Python 3 none any Details

Total release size: 25.2 kB

Release files / crocotiger-0.1.1.tar.gz

Download URL crocotiger-0.1.1.tar.gz
Size 13.4 kB
Tags Source
SHA-256 checksum
How to use checksums
a9cdee76dc553a91937fccee12a8ec19b16c724297c554df7ad12e0bf68d9fcf
BLAKE2b-256 checksum
How to use checksums
bb132a7b936e49433749d8082f4a7f73c400b37aef1d4fcaa48424015a18103f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.11.15

Release files / crocotiger-0.1.1-py3-none-any.whl

Download URL crocotiger-0.1.1-py3-none-any.whl
Size 11.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
a0837e4e83b5e7e585e519f13fb96f0bb45a95eaceb018a79da65b4754c2d21a
BLAKE2b-256 checksum
How to use checksums
5125c4620ba3c428dd47470557f23ce21673e54592b52a122198a8ae21fd0e11
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.11.15

Release history Release notifications | RSS feed

This release

0.1.1 This release

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page