Skip to main content

Runtime verification for non-deterministic AI agent actions and outputs — Python SDK

Project description

tobeverified — Python SDK

Runtime verification for non-deterministic AI agent actions and outputs.

tobeverified submits each call to an independent verification agent (LLM judge with your policy + authoritative typologies, low-confidence cases route 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

Verifications 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 verification 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.1.tar.gz (3.8 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.1-py3-none-any.whl (6.3 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: tobeverified-0.5.1.tar.gz
  • Upload date:
  • Size: 3.8 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.1.tar.gz
Algorithm Hash digest
SHA256 53e6be64548e0813bb0e37645929d16bc791fe0b204f2c10a7617b27663bec15
MD5 0943c2eb471365307264c479f97b41ef
BLAKE2b-256 ee571dab5b3581ee7ef986fc756371147b2b7e8b5108e8d5bfc21148107728c1

See more details on using hashes here.

File details

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

File metadata

  • Download URL: tobeverified-0.5.1-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.1-py3-none-any.whl
Algorithm Hash digest
SHA256 c7531bb7e38861aa85605024e5a9f28a6930984d9c689d5d6dfadc483ce329eb
MD5 b7390c7dbe8be3bfa49a0e47fa1da089
BLAKE2b-256 c98e989336453d335c60cb074ffe388704dcec4211596226ef05653181c73904

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