Installation
This page is for the Python library. For a coding agent, you don't install anything; see Agent setup.
jes needs Python 3.11 or newer.
pip install jes
The core depends only on
langchain-typesafe,
the client for the judge. Importing jes does not
import torch.
The first quickstart example calls the decision model (Jev) and needs a TypeSafe
key. The second also needs jes[pii] and a spaCy model, for names.
TypeSafe credentials
Every judgment asks a decision model on the TypeSafe API, Jev by default:
export TYPESAFE_API_KEY=...
export TYPESAFE_BASE_URL=... # optional, default https://api.typesafe.ai
The library reads these from the process environment only. It doesn't load
.env files or the key saved by jes login; that's for the
agent hooks.
To set them in code instead, pass a TypeSafeClassifier(api_key=..., base_url=...) as model=. See The judge.
Transforms and offline tests with FakeBackend need no key.
Extras
Install an extra only when you use the feature that needs it:
pip install 'jes[pii,secrets,crypto]'
| Extra | Needed for |
|---|---|
pii | The PERSON entity of pii(), which pii() checks by default (Presidio with a spaCy model). The other entities are patterns and need no extra |
secrets | The secrets() policy (detect-secrets) |
crypto | Redactions.dumps and Redactions.loads (AES-256-GCM) |
regex | The regex() policy (a regex engine with timeouts) |
tokens | The token_limit() policy (tiktoken) |
json | json_check(repair=True) |
PERSON uses Presidio, which loads a spaCy English model. Download one once
after installing. en_core_web_lg, md, and sm all work:
python -m spacy download en_core_web_lg
Without it, pii() raises PolicyError. Pass the entities you want, such as
pii(["EMAIL_ADDRESS"]), to skip names.
Next: the quickstart.