Skip to main content

evidence-gap-router

Route work by missing evidence, not by agent count.

A small Python SDK that chooses the next acquisition or verification from missing evidence and unfinished checks in a finite, host-declared action set.

Python 3.12+ · Apache-2.0 · 日本語 · Documentation

When to use it

Use it when permitted work depends on the material already obtained, verification results, prerequisites, costs or changed rules. It retains evidence, issued checks, failures, expenses and unresolved requirements across explicit continuation.

A fixed pipeline is usually sufficient when every input and step is already known. The SDK does not supply agents, models, a network gateway or a scheduler. Tracking verification history does not guarantee semantic truth. Separate calls to the same model do not establish statistically independent judgments.

Install and check

python -m pip install evidence-gap-router==0.2.4
egr --version
egr demo --json

These commands need no model or network after installation. The demo uses artificial data. Getting started creates actual UTF-8 CSV/JSON files, including quoted paths with spaces and Japanese characters, then checks them with egr check-data.

Connect a callback

This complete ordinary-wheel example parses the supplied content, selects a check, records its actual result and shows the remaining blocking issues:

from hashlib import sha256
from evidence_gap_router import (
    ActionCandidate,
    Budget,
    CallbackView,
    CheckerPermission,
    Evidence,
    HandlerRegistration,
    Obligation,
    Policy,
    Resources,
    State,
    plan,
    run,
)

content = "4"
evidence = Evidence(
    id="answer",
    obligation_id="sum",
    scope="example",
    digest=sha256(content.encode()).hexdigest(),
    content=content,
    producer="calculator",
    source="local-calculation",
    provenance_group="calculator",
)
state = State(
    obligations=(
        Obligation(
            id="sum",
            description="Check arithmetic",
            scope="example",
            acceptance="Parsed answer equals 2 + 2",
        ),
    ),
    evidence=(evidence,),
)
action = ActionCandidate(
    id="check-answer",
    obligation_id="sum",
    scope="example",
    kind="verify",
    handler_id="check",
    target_evidence_id="answer",
    target_digest=evidence.digest,
    checker_id="arithmetic-check",
    resources=Resources(actions=1, verifications=1),
)
policy = Policy(
    trusted_verifiers=("arithmetic-check",),
    handlers=(
        HandlerRegistration(
            handler_id="check",
            roles=("verify",),
            checkers=(CheckerPermission(checker_id="arithmetic-check"),),
        ),
    ),
)


def check(view: CallbackView):
    passed = int(view.inputs[0].content or "") == 2 + 2
    return view.result(
        actual_resources=Resources(actions=1, verifications=1),
        checks=(view.check(status="PASS" if passed else "FAIL", reason="Compared with 2 + 2"),),
    )


budget = Budget(limits=Resources(actions=1, verifications=1))
next_step = plan(state, (action,), budget, policy)
assert next_step.action is not None
print(next_step.action.id)  # check-answer

report = run(
    state,
    (action,),
    budget,
    policy,
    {"check": check},
    max_steps=8,
)
print(report.state.checks[-1].status)  # PASS
print(report.decision.stop_reason)  # satisfied
print([r.code for r in report.decision.residuals if r.blocking])  # []

The host registers checker permission; view.check binds the issued target, contract and inputs. An ID supplied by an output grants no authority. step invokes at most one callback; run has a finite step limit. Runner stops and unresolved domain requirements are separate. Pending attempts and unknown budgeted consumption block automatic continuation.

See Concepts, API and snapshot/migration for acquisition, invalidation, rechecking, selectors and retained costs. Limited callback views are application disclosures, not a Python sandbox. The host owns input trust, effects, costs and single-writer use.

Local Ollama experiment

The optional Ollama guide uses source-level examples with an ordinary installed SDK and explicit local inference. Ollama is not required by core imports or the offline CLI. Model weights and user credentials are absent from the package; normal tests and release CI do not run model inference.

A uses EGR ordering; B uses strong verify-first ordering with the same public runner, pool, permissions, callbacks and budgets. C is a pooled-information reference. The comparison concerns extra selection value within the shared feasibility mechanism, not independent agent frameworks or a model ranking.

Current local tags qwen3.6:35b-a3b and gemma4:e4b completed 96 main trials on one Windows CPU host. Each arm has 16 artificial parents: 12 answerable and four insufficient. Verified completion requires independently supported evidence and the current review/acceptance conditions.

Model Arm Answerable verified /12 All verified /16 False acceptance /16
Qwen A 0 0 15
Qwen B 8 10 4
Qwen C 12 15 1
Gemma A 3 4 2
Gemma B 8 9 1
Gemma C 10 14 2

A underperformed B in this frozen profile. All main trials have known usage; there were zero unexecuted trials or transport/format faults. Small artificial tasks share development families; these results do not establish general performance. All 64 stop-sensitivity trials completed; recovery triggered zero times, so its benefit remains unmeasured. Initial invalid measurements and all expenses remain retained separately. See the technical report, Japanese summary and archived v0.2.3 report.

Audit · Validation · Releasing · Security

Metadata

Release files for evidence-gap-router 0.2.4

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for evidence-gap-router 0.2.4
File Size Uploaded
evidence_gap_router-0.2.4.tar.gz 855.2 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for evidence-gap-router 0.2.4
File Interpreter ABI Platform
evidence_gap_router-0.2.4-py3-none-any.whl Python 3 none any Details

Total release size: 915.6 kB

Release files / evidence_gap_router-0.2.4.tar.gz

Download URL evidence_gap_router-0.2.4.tar.gz
Size 855.2 kB
Tags Source
SHA-256 checksum
How to use checksums
a760b958063fb596297b60ca8c91373bead58b6d51582bd907e4dc3b10df7228
BLAKE2b-256 checksum
How to use checksums
388c7a48bed8132056fc5c45efb55f867f15e7ff340b38598317cbcdb318806b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 6, 2026.

Transparency log

Release files / evidence_gap_router-0.2.4-py3-none-any.whl

Download URL evidence_gap_router-0.2.4-py3-none-any.whl
Size 60.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
059afb24a5ddf4ccbd16347be6bcc352cbbc4552d8a1bc27f21e0d92d5a169c3
BLAKE2b-256 checksum
How to use checksums
721dd55dbae61474e28342c6a9d5593a9caf89d92d6cbf6fc89be5a6f4014f02
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 6, 2026.

Transparency log

Release history Release notifications | RSS feed

0.3.0

2 release files

This release

0.2.4 This release

2 release files

0.2.3

2 release files

0.2.2

2 release files

0.2.1

2 release files

0.2.0

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page