Metadata-Version: 2.4
Name: spolm-checks
Version: 0.1.1
Summary: Checks-as-code for AI agents: define invariants once, enforce them in replay, simulation, and at runtime.
Author: Spolm
License: Apache-2.0
Project-URL: Homepage, https://spolm.com
Project-URL: Repository, https://github.com/Tanrocode/spolm
Keywords: ai,agents,llm,verification,guardrails,evaluation,testing,checks
Classifier: Development Status :: 4 - Beta
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: Apache Software License
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Topic :: Software Development :: Testing
Classifier: Topic :: Software Development :: Quality Assurance
Requires-Python: >=3.10
Description-Content-Type: text/markdown
Requires-Dist: pydantic>=2
Requires-Dist: PyYAML>=6
Requires-Dist: jsonschema>=4
Requires-Dist: cel-python>=0.1.5

# spolm-checks

Checks-as-code for AI agents. Define an invariant once — enforce it in replay
(CI regression), simulation (certification), and inline at runtime (action gate).

Deterministic first: `predicate` (CEL — sandboxed, guaranteed-terminating),
`schema` (JSON Schema), and `policy` (trajectory patterns: `never X`,
`X only after Y`, `X at most N`, tool allow/deny lists). No LLM-as-judge in
the core engine, by design.

## Example check

```yaml
check:
  id: refund-within-order-total
  version: 1
  severity: block
  scope:
    workflow: refunds-agent
    target: tool_call
    tool: refund
  assert:
    type: predicate
    expr: "args.amount <= context.order.total && args.currency == context.order.currency"
  provenance:
    source: mined
    cluster_id: c_8842
  on_fail:
    runtime: block
    simulation: record_violation
    replay: fail_regression
```

## CLI

```bash
spolm-check lint ./checks
spolm-check run ./checks --traces traces.jsonl
```

`run` exits non-zero if any `block`-severity check has violations — wire it
straight into CI.

## Python

```python
from spolm_checks import load_suite, IRTrace, run_replay

checks = load_suite("./checks")
report = run_replay(checks, traces)   # traces: list[IRTrace]
```

Apache-2.0.
