ResultSeal logo ResultSeal

Validate tool results before agents state them as fact.

Deterministic Python library, CLI, and MCP hook blocking empty [], HTTP 200 error envelopes, stale cache, and partial payloads.

Scenarios
Raw Tool Observation (JSON) input
Observation Contract (JSON) contract

Runs offline via browser JSON engine. Python CLI handles YAML and SHA-256 records.

Why schema validation isn't enough

Typed schemas (Pydantic, Instructor, JSON Schema) and HTTP status checks validate shape, not whether a tool observation may back a factual claim. When a SQL query returns [], Redis returns nil, DynamoDB returns {"Items": [], "Count": 0}, Slack Web API returns HTTP 200 with {"ok": false, "error": "channel_not_found"}, or GraphQL returns HTTP 200 with {"data": null, "errors": [...]}, transport and type checks pass, and agents hallucinate "not found" or "done".

ResultSeal runs offline in Python (3.11+) with one runtime dependency (pyyaml), zero network calls, and zero LLM-as-judge calls. You declare per-tool contracts specifying required fields, source and target identity, freshness bounds, explicit not_found_sentinel values, and effect evidence. Everything empty, partial, stale, mismatched, errored, or unverified fails closed before it reaches the model.

HTTP 200 envelope vs contract
# Passes Pydantic and HTTP 200 check:
{"status_code": 200,
 "body": {"ok": false,
          "error": "channel_not_found"}}

# ResultSeal verdict (exit 1):
decision:     blocked
truth_state:  partial
reason_code:  MISSING_REQUIRED_FIELD

How ResultSeal fits alongside existing tools

Tool / Layer What it checks ResultSeal complement
Pydantic / Instructor Type and schema structure on parsed objects Blocks valid-typed empties ([], Items: []), HTTP 200 error envelopes, and stale revisions.
Guardrails AI / NeMo Guardrails LLM prose quality, PII, toxicity, dialogue rails Runs offline before generation with pyyaml only and zero LLM calls.
OpenAI ToolOutputGuardrail Framework callback hook attached to tools Supplies deterministic 10-step fail-closed contract rules across 7 frameworks.
MCP security hooks (e.g. prompt-injection scanners) Malicious payloads, tool poisoning, command rules Enforces tool-data completeness and protocol integrity via PostToolUse contracts; not a cryptographic receipt signer.

Quickstart: Python, CLI & Claude Code / Codex Hook

Install (Python 3.11+)
pip install resultseal
Python: fail-closed resultseal.seal()
import resultseal

contract = resultseal.load_contract({
    "schema_version": "1",
    "claim_type": "found",
    "required_fields": ["customer_id", "name"],
    "freshness": {"mode": "not_required"},
    "source_ref": "crm://customers",
    "target_ref": "customer:42",
})

# Raises BlockedObservation on [], HTTP 200 errors, or gaps
payload = resultseal.seal(
    {
        "kind": "json",
        "source_ref": "crm://customers",
        "target_ref": "customer:42",
        "body": [],
    },
    contract,
)

Shipped backend failure fixtures (20)

Every fixture in FIXTURE_CATALOG.md embeds its own contract and replays deterministically via resultseal replay fixtures/*.yaml.

Showing 20 of 20 fixtures
Fixture Backend / Scenario Outcome Playground
sql-empty-query.yaml SQL query returning [] empty / blocked Try preset
redis-nil-response.yaml Redis GET miss (nil / null) empty / blocked Try preset
dynamodb-empty-query.yaml DynamoDB Query with Items: [], Count: 0 partial / blocked Try preset
elasticsearch-zero-hits.yaml Search with hits.total.value: 0 partial / blocked CLI replay
graphql-error-200.yaml GraphQL HTTP 200 with data: null and errors partial / blocked Try preset
slack-ok-false-200.yaml Slack Web API HTTP 200 with ok: false and error partial / blocked Try preset
http-404-structured-error.yaml HTTP 404 with JSON error body (TRANSPORT_FAILED) unknown / blocked Try preset
empty-result.yaml HTTP 200 empty body on not_found claim empty / blocked Try preset
explicit-not-found.yaml Explicit not_found_sentinel with matching source/target not_found / sealed Try preset
partial-response.yaml Object missing contract required_fields partial / blocked CLI replay
stale-response.yaml Cached revision older than min_source_version stale / blocked Try preset
wrong-target.yaml Returned record target differs from contract (TARGET_MISMATCH) source_mismatch / blocked CLI replay
unverified-write.yaml Effect result missing evidence_refs unverified_effect / blocked CLI replay
no-dispatch-success-claim.yaml Claim without dispatch record (NO_DISPATCH) unknown / blocked CLI replay
complete-fresh-result.yaml Complete payload meeting required fields and freshness sealed / sealed MCP sealed preset
malformed-json.yaml Unparseable JSON response body parse_error / blocked CLI replay
unsafe-input.yaml Unsafe YAML tag or alias rejected before evaluation rejected (exit 3) CLI replay
bare-json-payload.yaml kind: json omitting body wrapper empty / blocked CLI replay
empty-body-effect.yaml HTTP 204 empty body on effect claim empty / blocked CLI replay
effect-with-recorded-facts.yaml Effect recording HTTP 204 status and evidence_refs sealed / sealed CLI replay

Decision reason codes (12)

NO_DISPATCH
No dispatch record: the tool was never shown to have run, so nothing it claims can be promoted.
TRANSPORT_FAILED
Transport failure: a failed HTTP status or non-zero exit is transport evidence, never a domain answer such as not_found.
PARSE_FAILED
Parse failure: the payload could not be parsed, so there is no observation to evaluate.
PROTOCOL_CONFLICT
Protocol conflict: the tool reported an error (isError: true), so its content cannot be promoted as an answer.
EMPTY_WITHOUT_NOT_FOUND_SENTINEL
Empty is not not-found: without the contract's explicit not_found_sentinel, an empty result proves nothing about existence.
SOURCE_MISMATCH
Identity mismatch: the observation's source_ref differs from the contract.
TARGET_MISMATCH
Identity mismatch: the observation's target_ref differs from the contract.
STALE_OBSERVATION
Stale observation: the evidence is older than the contract's freshness requirement.
SCHEMA_INVALID
Unusable input or timestamp: e.g., max_age_seconds freshness requires an offset-aware ISO-8601 observed_at.
MISSING_REQUIRED_FIELD
Partial observation: the payload is missing top-level fields required by the contract or MCP outputSchema.
UNVERIFIED_EFFECT
Unverified effect: an effect_observed or task_complete claim needs evidence_refs proving the effect happened.
SEALED_WITH_REQUIRED_EVIDENCE
Sealed: every contract condition holds, so this observation may support the claim.