Skip to content

Guardrails API

Generated from the typed public surface.

tesserix_adk.guardrails.Containment

Stability: alpha

What a run is, in the three terms untrusted content is trying to change.

class Containment(AdkModel) {hold(self, proposed: 'Containment', *, source: 'ContentSource') -> 'None'}

Typed errors: None declared.

Runnable recipe: examples/guardrails.py — ordered checks fail closed.

tesserix_adk.guardrails.ContentFilterGuard

Stability: alpha

Refuses content that reaches this tenant's bar, on either stage.

class ContentFilterGuard(Guard) {check_input(self, content: 'str') -> 'GuardResult'; check_output(self, content: 'str') -> 'GuardResult'; classify(self, content: 'str') -> 'Classification'; raise_for(self, content: 'str', *, stage: 'str' = 'input') -> 'None'}

Typed errors: None declared.

Runnable recipe: examples/guardrails.py — ordered checks fail closed.

tesserix_adk.guardrails.Guard

Stability: alpha

A guard that allows everything, for a subclass to narrow one stage at a time.

class Guard(object) {check_input(self, content: 'str') -> 'GuardResult'; check_output(self, content: 'str') -> 'GuardResult'}

Typed errors: None declared.

Runnable recipe: examples/guardrails.py — ordered checks fail closed.

tesserix_adk.guardrails.GuardResult

Stability: alpha

One guard's answer about one piece of content.

class GuardResult(object)

Typed errors: None declared.

Runnable recipe: examples/guardrails.py — ordered checks fail closed.

tesserix_adk.guardrails.GuardStage

Stability: alpha

Where in a run a check happened. Carried on every verdict and every refusal.

class GuardStage(StrEnum)

Typed errors: None declared.

Runnable recipe: examples/guardrails.py — ordered checks fail closed.

tesserix_adk.guardrails.GuardVerdict

Stability: alpha

What a guard decided.

class GuardVerdict(StrEnum)

Typed errors: None declared.

Runnable recipe: examples/guardrails.py — ordered checks fail closed.

tesserix_adk.guardrails.GuardrailPipeline

Stability: alpha

An ordered, fail-closed chain of guards over one stage of a run.

class GuardrailPipeline(object) {check_input(self, content: 'str') -> 'str'; check_output(self, content: 'str') -> 'str'; check_stream(self, chunks: 'AsyncIterator[str]') -> 'AsyncIterator[str]'}

Typed errors: ConfigurationError, ProtocolConformanceError

Runnable recipe: examples/guardrails.py — ordered checks fail closed.

tesserix_adk.guardrails.InjectionGuard

Stability: alpha

Screens untrusted content for text shaped like an instruction to the agent.

class InjectionGuard(Guard) {check_input(self, content: 'str') -> 'GuardResult'; inspect(self, content: 'str', *, source: 'ContentSource' = ContentSource(origin=<Origin.RETRIEVAL: 'retrieval'>, name='unnamed')) -> 'tuple[InjectionSignal, ...]'; raise_for(self, content: 'str', *, source: 'ContentSource') -> 'None'}

Typed errors: None declared.

Runnable recipe: examples/guardrails.py — ordered checks fail closed.

tesserix_adk.guardrails.PIIGuard

Stability: alpha

Replaces personal identifiers with placeholders on both stages of a run.

class PIIGuard(Guard) {apply(self, content: 'str') -> 'Redacted'; check_input(self, content: 'str') -> 'GuardResult'; check_output(self, content: 'str') -> 'GuardResult'}

Typed errors: None declared.

Runnable recipe: examples/guardrails.py — ordered checks fail closed.

tesserix_adk.guardrails.PolicyGuard

Stability: alpha

Applies this tenant's rules to an answer that has already parsed.

class PolicyGuard(Guard) {check(self, result: 'BaseModel') -> 'PolicyReport'; correction(self, report: 'PolicyReport') -> 'str'; raise_for(self, result: 'BaseModel', *, attempts: 'int' = 1) -> 'None'}

Typed errors: None declared.

Runnable recipe: examples/guardrails.py — ordered checks fail closed.

tesserix_adk.guardrails.SchemaGuard

Stability: alpha

Turns what a provider returned into the declared type, or into a typed error.

class SchemaGuard(Guard) {check_output(self, content: 'str') -> 'GuardResult'; parse(self, content: 'str') -> 'BaseModel'}

Typed errors: None declared.

Runnable recipe: examples/guardrails.py — ordered checks fail closed.

tesserix_adk.guardrails.ToolAllowlistGuard

Stability: alpha

The allowlist as it is enforced, holding the tally of what it turned away.

class ToolAllowlistGuard(object) {check(self, name: 'str') -> 'None'; decide(self, name: 'str') -> 'ToolDecision'; delegating(self, declared: 'Iterable[str]', *, agent: 'str' = '') -> 'Self'; permitted(self, names: 'Iterable[str]') -> 'tuple[str, ...]'}

Typed errors: None declared.

Runnable recipe: examples/guardrails.py — ordered checks fail closed.

tesserix_adk.guardrails.allowlist.ToolAllowlistGuard

Stability: alpha

The allowlist as it is enforced, holding the tally of what it turned away.

class ToolAllowlistGuard(object) {check(self, name: 'str') -> 'None'; decide(self, name: 'str') -> 'ToolDecision'; delegating(self, declared: 'Iterable[str]', *, agent: 'str' = '') -> 'Self'; permitted(self, names: 'Iterable[str]') -> 'tuple[str, ...]'}

Typed errors: None declared.

Runnable recipe: examples/guardrails.py — ordered checks fail closed.

tesserix_adk.guardrails.base.Guard

Stability: alpha

A guard that allows everything, for a subclass to narrow one stage at a time.

class Guard(object) {check_input(self, content: 'str') -> 'GuardResult'; check_output(self, content: 'str') -> 'GuardResult'}

Typed errors: None declared.

Runnable recipe: examples/guardrails.py — ordered checks fail closed.

tesserix_adk.guardrails.content_filter.ContentFilterGuard

Stability: alpha

Refuses content that reaches this tenant's bar, on either stage.

class ContentFilterGuard(Guard) {check_input(self, content: 'str') -> 'GuardResult'; check_output(self, content: 'str') -> 'GuardResult'; classify(self, content: 'str') -> 'Classification'; raise_for(self, content: 'str', *, stage: 'str' = 'input') -> 'None'}

Typed errors: None declared.

Runnable recipe: examples/guardrails.py — ordered checks fail closed.

tesserix_adk.guardrails.content_filter.refusal_of

Stability: alpha

A provider's own safety refusal, as the kit's violation.

def refusal_of(categories: 'tuple[str, ...]', *, severity: 'str' = 'high', classifier: 'str' = 'provider', stage: 'str' = 'output') -> 'ContentBlockedError'

Typed errors: None declared.

Runnable recipe: examples/guardrails.py — ordered checks fail closed.

tesserix_adk.guardrails.injection.Containment

Stability: alpha

What a run is, in the three terms untrusted content is trying to change.

class Containment(AdkModel) {hold(self, proposed: 'Containment', *, source: 'ContentSource') -> 'None'}

Typed errors: None declared.

Runnable recipe: examples/guardrails.py — ordered checks fail closed.

tesserix_adk.guardrails.injection.InjectionGuard

Stability: alpha

Screens untrusted content for text shaped like an instruction to the agent.

class InjectionGuard(Guard) {check_input(self, content: 'str') -> 'GuardResult'; inspect(self, content: 'str', *, source: 'ContentSource' = ContentSource(origin=<Origin.RETRIEVAL: 'retrieval'>, name='unnamed')) -> 'tuple[InjectionSignal, ...]'; raise_for(self, content: 'str', *, source: 'ContentSource') -> 'None'}

Typed errors: None declared.

Runnable recipe: examples/guardrails.py — ordered checks fail closed.

tesserix_adk.guardrails.output.PolicyGuard

Stability: alpha

Applies this tenant's rules to an answer that has already parsed.

class PolicyGuard(Guard) {check(self, result: 'BaseModel') -> 'PolicyReport'; correction(self, report: 'PolicyReport') -> 'str'; raise_for(self, result: 'BaseModel', *, attempts: 'int' = 1) -> 'None'}

Typed errors: None declared.

Runnable recipe: examples/guardrails.py — ordered checks fail closed.

tesserix_adk.guardrails.output.SchemaGuard

Stability: alpha

Turns what a provider returned into the declared type, or into a typed error.

class SchemaGuard(Guard) {check_output(self, content: 'str') -> 'GuardResult'; parse(self, content: 'str') -> 'BaseModel'}

Typed errors: None declared.

Runnable recipe: examples/guardrails.py — ordered checks fail closed.

tesserix_adk.guardrails.output.validated

Stability: alpha

The answer a caller may be handed, after at most attempts tries.

def validated(content: 'str', *, schema: 'SchemaGuard', policy: 'PolicyGuard | None' = None, reask: 'Reask | None' = None, attempts: 'int' = 1) -> 'BaseModel'

Typed errors: GuardrailEvaluationError, OutputValidationError

Runnable recipe: examples/guardrails.py — ordered checks fail closed.

tesserix_adk.guardrails.pii.PIIGuard

Stability: alpha

Replaces personal identifiers with placeholders on both stages of a run.

class PIIGuard(Guard) {apply(self, content: 'str') -> 'Redacted'; check_input(self, content: 'str') -> 'GuardResult'; check_output(self, content: 'str') -> 'GuardResult'}

Typed errors: None declared.

Runnable recipe: examples/guardrails.py — ordered checks fail closed.

tesserix_adk.guardrails.refusal_of

Stability: alpha

A provider's own safety refusal, as the kit's violation.

def refusal_of(categories: 'tuple[str, ...]', *, severity: 'str' = 'high', classifier: 'str' = 'provider', stage: 'str' = 'output') -> 'ContentBlockedError'

Typed errors: None declared.

Runnable recipe: examples/guardrails.py — ordered checks fail closed.

tesserix_adk.guardrails.validated

Stability: alpha

The answer a caller may be handed, after at most attempts tries.

def validated(content: 'str', *, schema: 'SchemaGuard', policy: 'PolicyGuard | None' = None, reask: 'Reask | None' = None, attempts: 'int' = 1) -> 'BaseModel'

Typed errors: GuardrailEvaluationError, OutputValidationError

Runnable recipe: examples/guardrails.py — ordered checks fail closed.