Set the posture once. Let each goal carry the detail.
Status: Beta Companion docs: Get started · Scopes and assets · Result
Three layers keep setup clear
The three-layer model, three nouns, one rule
Scope
A goal
Declare the goal once. Every asset bound to this scope shares the goal and its stacked policies.
tr.scope("refund-flow", goal="Resolve refunds within policy")- A baseline holds the common posture for governed work.
- A scope names a goal and groups the work that shares it.
- An asset is the model client, MCP server, CLI, Skill, connector, sandbox, or RAG system that does the work.
An asset at the root inherits the baseline. An asset created from a scope also inherits that scope’s goal and focused settings.
Baseline, scope, and asset
The same object model is available in Python and TypeScript.
- Python
- TypeScript
from trinitite import Trinitite
tr = Trinitite()
tr.govern(
frameworks=["soc2"],
policies=["refund-policy"],
mode="enforce",
)
refunds = tr.scope(
"refunds",
goal="Resolve valid refunds without exposing customer data.",
)
client = refunds.client(
"openai",
credential="cred_openai_prod",
)
import { Trinitite } from "@trinitite/sdk";
const tr = new Trinitite();
await tr.govern({
frameworks: ["soc2"],
policies: ["refund-policy"],
mode: "enforce",
});
const refunds = await tr.scope("refunds", {
goal: "Resolve valid refunds without exposing customer data.",
});
const client = refunds.client("openai", {
credential: "cred_openai_prod",
});
Asset constellation, one binding model
Selected asset
Client
- Binding
- Bind at the baseline or from a scope.
- Acquisition
- Inline (wrap), or split-govern for a direct provider call.
An asset with no scope inherits the baseline house rules. A scoped asset also inherits the scope goal and policies.
Start at the level you need
The ladder, one line, then composable, then fully customizable
Platform-default Guardian and policy bundle
Your governed call
Drop deeper only when you need to customize.
- Start simple: connect a model and inherit the shared baseline.
- Add a scope: group assets that work toward the same goal.
- Tune one edge: override a setting only for the asset or call that needs it.
This keeps common policy out of every request while preserving a clear escape hatch for sensitive work.
A result can reach you three ways
Three ways a result reaches you, one shape on every path
- 01Your codeThen
- 02tr.clientThen
- 03GuardianThen
- 04ProviderProduces
- One Result shapeverdict + diff + controls+ compliance + risk + receipt
tr.result(resp)Only acquisition differs. The result is the same, whichever path it came in on.
Inline
Your code makes a wrapped model call. Use tr.result(response) right away.
This is the main path in both Python and TypeScript.
Observed
Another system makes the call. Query the stored decision by ID, filters, or correlation. Both SDKs provide result lookup and correlation helpers.
Wait for an observed result
- Python
- TypeScript
result = tr.results.wait_for_correlation(
"refund-4821",
poll_interval_seconds=0.5,
max_wait_seconds=15,
)
const result = await tr.results.waitForCorrelation(
"refund-4821",
{
pollIntervalSeconds: 0.5,
maxWaitSeconds: 15,
},
);
Split governance
Split governance checks input and output around a provider call the platform cannot wrap. The current split-govern handle is Python-only. This is a local method difference, not a limit on the TypeScript SDK’s wrapped or observed paths.
input_result = tr.govern.input(
instructions="Do not expose customer data.",
input=messages,
masking=["pii"],
)
provider_messages = input_result.masked_body or messages
provider_response = provider.chat.completions.create(
model="gpt-4o",
messages=provider_messages,
)
output_result = tr.govern.output(
flow_id=input_result.flow_id,
instructions="Do not expose customer data.",
input=provider_messages + [{
"role": "assistant",
"content": provider_response.choices[0].message.content,
}],
)
Always forward masked_body when it is present. Unmask only inside the
approved trust boundary.
One result shape keeps app code steady
Each path gives you a GovernanceResult. Common fields include verdict,
diff, violations, compliance, and risk. Optional handles appear only
when that call produced them.
Governance result
One object, clear next steps
- Value
- Structured trace
- Use
- Call the method when a person needs the decision steps.
Methods such as explain() fetch deeper context only when you need it.
Optional receipt handles verify the decision without making every app path
carry audit logic.
Go deeper
- Verdicts and modes maps each result to an app action.
- Scopes and assets covers inheritance and overrides.
- The closed loop turns governed results into better releases.
- Traces and graph follows a decision through its linked evidence.