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.2

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.2
File Size Uploaded Provenance Actions
theaios_core-0.1.2.tar.gz 24.6 kB Without provenance Details for theaios_core-0.1.2.tar.gz

Built distribution (wheel)

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

Total release size: 41.8 kB

Release files / theaios_core-0.1.2.tar.gz

Download URL theaios_core-0.1.2.tar.gz
Size 24.6 kB
Tags Source
SHA-256 checksum
How to use checksums
def927d81267de8ec8269ccfc2ab46f654f8814c27d04e3138ed7133b838bc78
BLAKE2b-256 checksum
How to use checksums
c12017e8f9b6975c6581e12ea63252e7acdd3d070c9c389d5da631b9eada9f32
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.2-py3-none-any.whl

Download URL theaios_core-0.1.2-py3-none-any.whl
Size 17.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
b4ec6977df33d710fb6ddbf5027b1a3d2680f93225137ad84f3aec4927370683
BLAKE2b-256 checksum
How to use checksums
47885e3ad58a83ff21e9013ea558b0ed4f2ea934ba15a86ca987d4d63de0c8a9
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.2

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