mixle.substrate.harness module¶
Application harnesses around a configured reasoner.
A Harness wraps a Reasoner with
input validation, an action whitelist, secret-redaction guardrails, and an
optional escalation callback. Each request returns a HarnessResult
whose status is refused, answered, or escalated.
support_triage_harness and monitoring_harness provide ready-made
templates. register_harness and find_harnesses store harnesses as
scoped substrate artifacts so teams can discover reusable shells.
- class HarnessResult(status, answer=None, reason='', investigation=None, redactions=0)[source]
Bases:
objectOne request’s outcome: which gate decided (refused/answered/escalated), and the evidence.
- status: str
- reason: str = ''
- investigation: Any = None
- redactions: int = 0
- class Harness(reasoner, *, name, description='', validate=None, allowed_kinds=None, escalate=None, min_confidence=0.15, on_result=None)[source]
Bases:
objectSchema + whitelist + guardrails + escalation around a reasoner (see module docstring).
- Parameters:
reasoner (Reasoner) – the configured
Reasoner(answerer + substrate + skills + actions).description (str) – identity, used by the registry.
validate (Callable[[str], str | None] | None) –
(request) -> None | str– return an error string to REFUSE the request before any model runs (the input schema, as a callable so any validator plugs in).allowed_kinds (tuple[str, ...] | None) – action kinds the reasoner may fire (whitelist; None = all).
escalate (Callable[[str, Any], str] | None) –
(request, result) -> str– called on abstention; its return is the escalated answer handed back (e.g. a ticket id). None = abstentions surface as ‘escalated’ with no handler note.min_confidence (float) – the answer bar (passed through to
ask).on_result (Callable[[HarnessResult], None] | None) – optional UI hook, called with every HarnessResult (fire-and-forget).
name (str)
description
- support_triage_harness(substrate, answerer, *, escalate=None, max_chars=2000)[source]
Support triage: retrieve-only over the team’s knowledge, refuse empty/oversized requests, escalate anything the knowledge base cannot support – the canonical ‘never guess at a customer’.
- monitoring_harness(reasoner, *, escalate=None)[source]
Monitoring/alerting: compute + simulate allowed (run checks, what-ifs), no delegation out.
- register_harness(substrate, harness, *, scope='local')[source]
Index a harness on the substrate as a scoped artifact – discoverable and shareable (P-scoped).