Skip to main content

Runtime verification for non-deterministic LLM outputs — Python SDK

Project description

tobeverified — Python SDK

Runtime verification for non-deterministic LLM outputs.

tobeverified submits each AI-generated decision to an independent verifier (LLM judge with policy + low-confidence routing to a human reviewer). Use it where unit tests don't reach: refund classifications, fraud screens, PII redaction, intent routing, tool-call validation.

Install

pip install tobeverified

Use

from tobeverified import TBV

tbv = TBV()  # reads TBV_API_KEY and TBV_BASE_URL from env

result = tbv.verify(
    prompt="Is this customer message a refund request?",
    context={"message": "I'd like my money back."},
    allowed_verdicts=["yes", "no"],
    confidence_threshold=0.85,
)

print(result["final_verdict"], result["final_tier"])
# → 'yes' 'agent'   (or 'human' if confidence was below threshold)

verify() is fire-and-wait: submits, polls until terminal state. For non-blocking flows use submit() + wait() separately.

Decorator pattern

from tobeverified import verified

@verified(
    allowed_verdicts=["safe", "unsafe", "needs_review"],
    confidence_threshold=0.9,
    source="my-app/comment-mod",
)
def moderate(text: str) -> dict:
    return {
        "prompt": "Is this comment safe to publish?",
        "context": {"text": text},
    }

result = moderate("user-supplied content")
# result.verdict, result.tier, result.output

Get an API key

Sign in at app.tobeverified.comAPI keys → create. Plaintext is shown exactly once.

export TBV_API_KEY=tbv_live_...

Reviewer queue

Tasks routed to human_needed (confidence below threshold) appear at review.tobeverified.com for the account that submitted them. Anyone signed in to the account can resolve. The agent's first-pass verdict, confidence, and rationale are shown alongside the verdict form.

Reference

Method Purpose
TBV(base_url=None, api_key=None, timeout=30.0) Construct a client. Defaults read TBV_BASE_URL and TBV_API_KEY from env.
submit(prompt, allowed_verdicts, ...) Enqueue a verification task; returns {id, status, ...}.
get(task_id) Fetch current state.
wait(task_id, timeout=300.0, poll_interval=1.5) Block until terminal state.
verify(prompt, allowed_verdicts, ...) submit() + wait() in one call.

Errors raise TBVError (or TBVTimeoutError for wait() timeouts). Both inherit from Exception.

Status

Developer preview. Versioned 0.x until the API contract is frozen; expect minor surface changes. Production deployments tracked via docs.tobeverified.com.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

tobeverified-0.5.0.tar.gz (3.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

tobeverified-0.5.0-py3-none-any.whl (6.3 kB view details)

Uploaded Python 3

File details

Details for the file tobeverified-0.5.0.tar.gz.

File metadata

  • Download URL: tobeverified-0.5.0.tar.gz
  • Upload date:
  • Size: 3.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.5

File hashes

Hashes for tobeverified-0.5.0.tar.gz
Algorithm Hash digest
SHA256 ab2a1469233ff4cf4b51cb9bb1bd4f26646865a933dff2b4089a5b424a8a33aa
MD5 89d7b426cd960af9916494f6a979f676
BLAKE2b-256 748811bb0445662703433feeb2c1b20b8d62d3a5790f7de011dd273cbe14407f

See more details on using hashes here.

File details

Details for the file tobeverified-0.5.0-py3-none-any.whl.

File metadata

  • Download URL: tobeverified-0.5.0-py3-none-any.whl
  • Upload date:
  • Size: 6.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.5

File hashes

Hashes for tobeverified-0.5.0-py3-none-any.whl
Algorithm Hash digest
SHA256 660be56bafc911e33676f01b74adbe416febb072c135d49abe523139d45d39e8
MD5 f3f60b31b278d8e1c55c8023a221d7ab
BLAKE2b-256 5180a2665d4ab05d1f78905b949e85f094fc0c88e3ce1b8f83f6d9659f791112

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page