Metadata-Version: 2.5
Name: theaios-core
Version: 0.1.0
Summary: Shared foundations of the theaios libraries: safe expressions, env interpolation, audit logs
Project-URL: Homepage, https://github.com/Cohorte-ai/theaios-core
Project-URL: Repository, https://github.com/Cohorte-ai/theaios-core
Author-email: Charafeddine Mouzouni <charafeddine@cohorte.co>
License-Expression: Apache-2.0
License-File: LICENSE
License-File: NOTICE
Keywords: agent-governance,ai-agents,audit-log,policy-engine
Classifier: Development Status :: 3 - Alpha
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: Apache Software License
Classifier: Programming Language :: Python :: 3
Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
Requires-Python: >=3.10
Provides-Extra: dev
Requires-Dist: mypy<1.20,>=1.19; extra == 'dev'
Requires-Dist: pytest<10,>=8.0; extra == 'dev'
Requires-Dist: ruff<0.16,>=0.15; extra == 'dev'
Description-Content-Type: text/markdown

# theaios-core

Shared foundations of the [theaios](https://github.com/Cohorte-ai) 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. |

```python
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
```

```bash
python -m theaios.core.audit verify .guardrails_audit/audit.jsonl
```

## 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`.

## License

Apache 2.0. See [LICENSE](LICENSE).
