Skip to main content

claude-verified-agent

CI PyPI Python 3.12+ License: MIT offline

An end-to-end verified agent: every answer is cited or refused, every delivery passes safety gates, every run is CI-blocked on regression.

No hallucination by design, no PII/injection leak by gate, no silent regression by suite. Stdlib-only core, fully offline, no API key.

pip install -e .
make demo     # 1 command: cited answer + refusal + gate verdicts
make banking-demo  # banking & SecOps vertical: 4 asserted offline cases
make test     # 48 contract tests (pytest, offline)
make gates    # 4 llm-eval-ci suites, exit != 0 blocks CI

Architecture

 question
    |
    v
 [1] record-contexte (agent-context-bridge)
    |  acb record question + answer | acb search past context
    v
 [2] ask cite (cited-rag)
    |  BM25 + TF-IDF -> RRF -> verbatim sentences + [file:L1-L2]
    |  max_score < 0.35 or fidelity < 0.5 -> "Insufficient evidence"
    v
 [3] gate (llm-eval-ci)
    |  no_pii_leak + no_injection_obey over the produced answer
    |  red gate -> refusal (raw text never delivered)
    v
 cited answer  |  refusal (no-evidence / safety-gate)

Each stage prefers its pillar implementation and degrades to a compact stdlib equivalent when the pillar is not installed (backends field of every answer states which implementation served each stage, so the demo output is auditable). Set CVA_FORCE_FALLBACK=1 to exercise the portable path — the 48 tests pass identically on both paths.

The 3 pillars (used, not rewritten)

Stage Pillar repo How it is used here
Inter-agent memory agent-context-bridge MemoryStore + ContextRecord + search_records: every question and every verdict is recorded (acb record semantics) and past context is searched before retrieval
Cited RAG cited-rag build_index_data + Retriever.search + generate_answer: hybrid retrieval, extractive verbatim answers with exact [file:L1-L2] citations, Insufficient evidence refusal with zero citations
CI gates llm-eval-ci check_no_pii_leak + check_no_injection_obey gate every answer; evals/*.json suites run via llm-eval run with blocking exit codes

Eval results (reproduce with make gates + make test)

llm-eval run on the bundled suites (deterministic, offline):

Suite Cases Result
evals/non_regression.json cited answers (contains + citation regex + PII-free), off-corpus refusal 3/3 passed, exit 0
evals/schema.json JSON payload contract (cited + refused shapes, budgets) 2/2 passed, exit 0
evals/tripwires.json PII request refused, injection-laced prompt refused 2/2 passed, exit 0
evals/banking_compliance.json banking cited answer, off-corpus refusal, PII gate, injection gate, masked memory 5/5 passed, exit 0

pytest: 48/48 passed on the pillar path and 48/48 passed with CVA_FORCE_FALLBACK=1 (portable stdlib path): exact verbatim citations, refusal with zero citations, gate blocks PII/injection strings, injection-laced questions never obeyed, answer determinism, JSON contract, memory records, backend auditability. The count is 14 core contract tests (tests/test_verified_agent.py) plus 34 banking-compliance tests (tests/test_banking_compliance.py, 16 cases × 2 backends).

The red path (a leaked PII string or an obeyed injection fails the gate, exit 1) is proven in pytest, not in the suites: the suites must stay green or CI blocks.

Banking & SecOps Compliance Use Case (B2B)

A regulated-banking vertical built on the same verified pipeline, shipped under examples/banking-compliance/. The corpus is 100% synthetic — four bilingual (FR + EN) markdown files for the fictional Banque Exemple SA / Example Bank SA. Every file opens with a SYNTHETIC header; there is zero real enterprise data, no real PII, and no actual regulatory text (the BCEAO-inspired audit policy is explicitly labelled synthetic).

Topics: PCI DSS controls (AES-256 at rest, TLS 1.2+ in transit, PAN masking first-6/last-4, HSM key storage, 90-day key rotation), BCEAO-inspired audit logs (10-year retention, WORM integrity, NTP sync, maker/checker), a SecOps ransomware playbook (VLAN isolation, east-west blocking, forensic image before rebuild, RSSI/CISO escalation within 1 hour, 72-hour regulator notification), and IAM privileged access (mandatory bastion, phishing-resistant MFA, quarterly review, JIT elevation, session recording) ending in an assistant-secrecy section that serves as the injection tripwire target.

The offline demo (demo_banking.py, tempfile workspace, no API key) runs four cases with hard asserts (exit 1 on any failure):

Case Question theme Expected outcome
C1 PCI DSS key-rotation frequency (in-corpus) cited verbatim answer, gate PASS
C2 off-corpus trading query no-evidence refusal, zero citations
C3 IBAN + PAN + email probe gate blocks no_pii_leak; no raw value in answer or workspace; memory masked
C4 injection-laced IAM question safety-gate refusal via no_injection_obey
make banking-demo   # 4 asserted cases, offline, exit 0 on success
make gates          # 4 blocking eval suites (incl. banking_compliance)
make test           # 48 contract tests, both backends

PAN gate extension. The pillar PII patterns are frozen and carry no card-number rule, so the agent-side gate (verified_agent.gates) now supplements both backends with Luhn-validated PAN detection (_luhn_ok + _pan_candidates): 13-19 digit runs (separators stripped) that pass the Luhn checksum are flagged as pan under no_pii_leak and masked. Detection and masking share one overlap-safe span collector (_collect_spans), so a greedy IBAN match can no longer swallow an adjacent PAN and a phone sub-pattern cannot leave an IBAN fragment in the masked output (no raw value or digit fragment survives). 4111111111111111 is detected; 4111111111111112 (bad Luhn) is not. The demo and the 34 banking tests pass identically on the native-pillar path and with CVA_FORCE_FALLBACK=1.

Quickstart (3 commands)

pip install -e .
make demo    # offline demo, no key
make gates   # 4 blocking eval suites

CI (.github/workflows/ci.yml): job pytest + job gates (one step per suite, llm-eval run when installed, stdlib fallback runner otherwise). Any red gate fails the build.

Watchdog wrapper (autonomous, stdlib)

The repo includes an autonomous watchdog wrapper: scripts/run_watchdog.py (stdlib-only, Popen + start_new_session + 2 reader threads + 1s loop + 900s timeout + 300s stall detection + process-group kill, bounded output).

python3 scripts/run_watchdog.py --target demo --json
python3 scripts/run_watchdog.py --target gates --json --timeout 900 --stall-timeout 300
python3 scripts/run_watchdog.py --target all --json

With --json, the wrapper emits an additive JSON summary with at least: job_id/run_id, status (DONE|FAILED|TIMEOUT|STALLED), exit_code, started_at, finished_at, duration_s, reason, tail.

Makefile: the demo-wd and gates-wd targets go through the watchdog; demo and gates stay unchanged for compatibility.

Verification (3 trials)

scripts/verify_3_trials.py runs three independent trials (byte-compile, pytest -q, make gates) with the current interpreter (sys.executable). The verdict is PASS 3/3 only if every trial passes:

python3 scripts/verify_3_trials.py

Action gate / status JSON

  • verified_agent.gates.run_suite_file applies action-gate semantics: 0 allow, 2 deny (red gate / failed checks), 1 ask / fail-closed (usage, env, invalid, parse, unknown). On a red gate, no raw output is echoed; only the id, failed checks, and safe/masked info.
  • VerifiedAgent.ask() adds additive top-level fields scores, rejected, backtracks_count without breaking the existing backends field (memory, rag, gate).
  • emit_summary(result, json_mode=False) and print_status(result, json_mode=False) are exposed; demo/demo.py --json uses this path.

License

MIT — see LICENSE.

Metadata

Release files for claude-verified-agent 0.2.0

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

Source distribution (sdist)

Source distribution for claude-verified-agent 0.2.0
File Size Uploaded Provenance Actions
claude_verified_agent-0.2.0.tar.gz 24.0 kB With provenance Details for claude_verified_agent-0.2.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for claude-verified-agent 0.2.0
File Interpreter ABI Platform Actions
claude_verified_agent-0.2.0-py3-none-any.whl Python 3 none any Details for claude_verified_agent-0.2.0-py3-none-any.whl

Total release size: 44.4 kB

Release files / claude_verified_agent-0.2.0.tar.gz

Download URL claude_verified_agent-0.2.0.tar.gz
Size 24.0 kB
Tags Source
SHA-256 checksum
How to use checksums
16c1ba0ab665dd121632b881af4ec2fffed37f87136944c31ec1b1caab1b530c
BLAKE2b-256 checksum
How to use checksums
376ca76b413dfae63ad55124804aaa0c95783deed189c0c628f7f466ab50337a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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 Dec 2, 2026.

Transparency log

Release files / claude_verified_agent-0.2.0-py3-none-any.whl

Download URL claude_verified_agent-0.2.0-py3-none-any.whl
Size 20.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
a6a2622a6fa38f769035370a2b02e144752d964606ab063f1ef8702209042e27
BLAKE2b-256 checksum
How to use checksums
ffc18a3b699be4ce04ead424fc7b82536666483657e637abe93ec6f132a0069f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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 Dec 2, 2026.

Transparency log

Security for claude-verified-agent 0.2.0

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.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for claude_verified_agent-0.2.0.tar.gz

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 Dec 2, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.2.0 This release

2 release files Full provenance

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