agentassert-typec-core
Formal behavioral contract kernel. Provider-blind, transport-blind.
This is the core engine — zero LLM deps, zero HTTP deps. Every adapter (proxy, SDK, hook) imports this.
Features
- 7 Process Contract Operators — tool_blocklist, tool_allowlist, must_state, must_precede, context_budget, process_drift, judge_predicate
- ContractSpec DSL — YAML-based,
dsl_version: "0.4"for full Type-C,dsl_version: "0.3"for ABC compatibility - JSD Drift Tracker — Welford-style incremental (O(1) per update), frozen baseline at window boundary
- Θ Reliability Scorer — Θ = 0.35C̄ + 0.25(1-D̄) + 0.20/(1+E) + 0.20S
- Thread-safe SessionMonitor — RLock-protected, evaluate() never blocks for >10ms
- Pre-compiled AST — all regex patterns compiled once at SessionStart
Install
pip install agentassert-typec-core
Quickstart
from agentassert_typec_core import SessionMonitor, PreAction, DecisionResult
monitor = SessionMonitor.from_yaml("contract.yaml")
event = PreAction(session_id="s1", contract_id="c1", tool="Read", args={})
result = monitor.evaluate(event)
print(result.decision.name) # ALLOW or DENY
Optional: OTel
pip install agentassert-typec-core[otel]
License
MIT
Metadata
Release files for agentassert-typec-core 0.7.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| agentassert_typec_core-0.7.0.tar.gz | 3.2 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| agentassert_typec_core-0.7.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 6.4 kB
Release files / agentassert_typec_core-0.7.0.tar.gz
| Download URL | agentassert_typec_core-0.7.0.tar.gz |
|---|---|
| Size | 3.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
b9642ef921dc949f4dd9a3889f6085938f5a917d93a5fa318d946e4e30332c9c
|
|
BLAKE2b-256 checksum How to use checksums |
5eae8e54714d19a412bd2342a0f0e87b5564f33e51f3021505c53257d57229ed
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.12.13
|
Release files / agentassert_typec_core-0.7.0-py3-none-any.whl
| Download URL | agentassert_typec_core-0.7.0-py3-none-any.whl |
|---|---|
| Size | 3.2 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
51e14688e1509ed7204d8b2dc67632c5c999084b6e6bbfdd8346cbe9bf9b1485
|
|
BLAKE2b-256 checksum How to use checksums |
947d9eddb9201800cdbe700b691406bcc2c792a73d4085fcf365b67ea330a7e6
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.12.13
|