Skip to main content

theaios-core

Shared foundations of the theaios libraries. You do not need to install it yourself: theaios-guardrails, theaios-context-router, theaios-agent-monitor and theaios-agent-auth depend on it.

It exists so that security-sensitive code lives in one place instead of four copies.

What is inside

Module What it does
theaios.core.expressions The safe condition language used in policy files (action == "send_email" and recipient.domain != $company_domain). No eval(), no code execution. Limits: 10,000 characters and 64 levels of nesting; and / or chains of any length.
theaios.core.env ${VAR} interpolation for config files, with an optional ${VAR:default} form.
theaios.core.audit Append-only JSONL logs, optionally hash-chained so that any edit or deletion is detectable.
from theaios.core.expressions import compile_expression, evaluate

rule = compile_expression('amount > 1000 and currency in ["EUR", "USD"]')
evaluate(rule, {"amount": 4800, "currency": "EUR"})  # True

references(rule) lists the $variables, matchers and fields an expression uses without evaluating it, so a library can reject a config that names something undefined (a typo in a deny rule) when it loads, not when the rule is silently skipped at runtime.

from theaios.core.audit import JsonlLog

log = JsonlLog("decisions.jsonl", chain=True)   # each entry carries prev_hash and hash
log.append({"agent": "finbot", "action": "pay", "decision": "deny"})
python -m theaios.core.audit verify decisions.jsonl   # exit 0 intact, 1 broken, 2 cannot verify

Only hash-chained logs can be verified: a missing file or a log written without chain=True exits 2 with the reason. The guardrails and agent-auth audit logs are not chained yet.

Compatibility

The expression language is the one the four libraries already used; their existing test suites pass unchanged against this package. The only difference: input over the limits above now raises ExpressionError instead of failing with a Python RecursionError.

Since 0.1.1, ordering comparisons treat strings that spell numbers as numbers ("10000" > 5000) and raise ExpressionError when only one side is a number; ==, !=, in and not in treat "1001" and 1001 as equal.

License

Apache 2.0. See LICENSE.

Metadata

Release files for theaios-core 0.1.1

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

Source distribution (sdist)

Source distribution for theaios-core 0.1.1
File Size Uploaded Provenance Actions
theaios_core-0.1.1.tar.gz 23.7 kB Without provenance Details for theaios_core-0.1.1.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for theaios-core 0.1.1
File Interpreter ABI Platform Actions
theaios_core-0.1.1-py3-none-any.whl Python 3 none any Details for theaios_core-0.1.1-py3-none-any.whl

Total release size: 40.0 kB

Release files / theaios_core-0.1.1.tar.gz

Download URL theaios_core-0.1.1.tar.gz
Size 23.7 kB
Tags Source
SHA-256 checksum
How to use checksums
6b97f37bf038117149cf8b2d9dafab412f851fac2d87723485c827f4bec8ece5
BLAKE2b-256 checksum
How to use checksums
334c62c80d296aae823ef39c171f8e4436fa62a70f36bcff98c2061ed5f286d8
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.16

Release files / theaios_core-0.1.1-py3-none-any.whl

Download URL theaios_core-0.1.1-py3-none-any.whl
Size 16.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
dfb607e53f661dff398e68dd6ccd127f99520cbf0604244ff251a8cd2a03958f
BLAKE2b-256 checksum
How to use checksums
88ef392e82de6f43254874e27e8f8734f1544a2236d6a10d663e150f5c5490e9
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.16

Security for theaios-core 0.1.1

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.

No provenance found

None of the files in this release were uploaded with provenance metadata.

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.

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