Skip to main content
Production-ready setup

Make every result path easy to operate.

Install either live SDK, match the key to the environment, declare the baseline, and handle every verdict before the first production call.

Status: Beta · Python 0.0.3 · TypeScript 0.0.3 Companion docs: Authentication · Language compatibility · Result

1. Install​

Install the SDK

Your language choice stays selected across the docs.

Python / TypeScript
terminal
pip install trinitite==0.0.3

2. Choose an environment​

Set the API key and environment together. A mismatch stops at startup, before a development key can reach the production endpoint.

Configure the environment

Python / TypeScript
.env
TRINITITE_API_KEY=trnt_test_...
TRINITITE_ENV=test

Environment keyring

The key prefix must match the environment

Key prefix
trnt_test_...
Use
Forced verdicts and CI

3. Declare the baseline and call the model​

The baseline holds rules shared across governed work. Declare it once, then use the provider request shape you already know.

Code

Governed provider call

Both paths set the same baseline and return the same result model.

Python / TypeScript
governed_call.py
from trinitite import Trinitite

tr = Trinitite()
tr.govern(
frameworks=["soc2"],
mode="enforce",
)

response = tr.client(
"openai",
credential="cred_openai_prod",
).chat.completions.create(
model="gpt-4o",
messages=[{
"role": "user",
"content": "Refund order 4821.",
}],
)

result = tr.result(response)
GovernanceResult
First result
GovernanceResult
passed
verdict
passed
violations
[]
receipt
dlir_01J7FIRSTCALL

The verdict drives the app path. The receipt records the decision.

Guarded request route

Current step: dlir_ receipt. Records the decision.

  1. 1Your codeThe request you already make
  2. 2SDKRoutes the call
  3. 3GuardianChecks the request
  4. 4Model or toolHandles the allowed call
  5. 5Result: passedNames the outcome
  6. 6dlir_ receiptRecords the decision

The wrapped client returns a fully materialized response. Provider token streaming is not part of this onboarding contract.

4. Handle every verdict​

The verdict drives the app path. Other fields help people inspect, improve, and verify the decision.

Handle the complete result

Python / TypeScript
handle_result.py
if result.verdict == "passed":
use(result.body)
elif result.verdict == "corrected":
use(result.body)
record(result.diff)
elif result.verdict == "blocked":
show_safe_fallback()
elif result.verdict == "masked":
keep_tokens_outside_trust_boundary()
elif result.verdict == "hitl":
queue_for_review()
else:
follow_error_policy()

trace = result.explain()
verification = (
result.receipt.verify()
if result.receipt and result.receipt.get("id")
else None
)

Fields such as risk, flow_id, and receipt are optional. Check them before use. Call explain() when a person needs the structured decision trace.

5. Test every branch​

Forced verdicts make CI repeatable. They work only in development and test environments. Production rejects them before network I/O.

Test the blocked path

Exercise your own fallback without hoping a prompt triggers it.

Python / TypeScript
test_governance.py
test_tr = Trinitite(env="test")
test_tr.govern(mode="enforce")

response = test_tr.client("openai").chat.completions.create(
model="gpt-4o",
messages=[{"role": "user", "content": "Test blocked."}],
force_verdict="blocked",
)

assert test_tr.result(response).verdict == "blocked"

Verdict test bench

Choose a synthetic verdict to exercise that Result branch with a trnt_test_ key.

Selected verdict: Blocked

The request did not pass the check.

Handle the blocked branch in your app.

Result {
  verdict: "blocked"
  forced: true
  output
  diff
  violations
  compliance
  risk
  receipt_id: "dlir_…"
}
Test keySynthetic Result, no billing
Live keyForcedVerdictInProdError, request refused

Keep building​