Metadata-Version: 2.4
Name: axiom-lang
Version: 0.1.0
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.12
Classifier: Programming Language :: Rust
Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
Classifier: Topic :: Security
Summary: Python bindings for Axiom - a verification-first policy engine for AI agents
Keywords: policy,ai,safety,verification,agents
Author: Axiom Contributors
License: Apache-2.0
Requires-Python: >=3.12
Description-Content-Type: text/markdown; charset=UTF-8; variant=GFM
Project-URL: Homepage, https://github.com/latentcollapse/Axiom
Project-URL: Repository, https://github.com/latentcollapse/Axiom

# axiom-py

Python bindings for Axiom — a verification-first policy engine for AI agents.

## Installation

```bash
pip install axiom-lang
```

Or build from source:

```bash
cd axiom_py
pip install maturin
maturin develop
```

## Quick Start

```python
from axiom import AxiomEngine

# Load a policy file
engine = AxiomEngine.from_file("security.axm")

# Verify an intent
verdict = engine.verify("WriteFile", {
    "path": "/tmp/test.txt",
    "content": "hello world"
})

if verdict.allowed:
    print("Action permitted")
else:
    print(f"Denied: {verdict.reason}")
```

## API Reference

### AxiomEngine

The main policy engine class.

#### Class Methods

- `AxiomEngine.from_file(path: str) -> AxiomEngine`
  - Load a policy from a `.axm` file

- `AxiomEngine.from_source(source: str) -> AxiomEngine`
  - Load a policy from source code string

#### Methods

- `verify(intent_name: str, fields: dict) -> Verdict`
  - Verify an intent against the policy
  - Pure operation - no side effects

- `intents() -> list[str]`
  - Get all intent names in the policy

- `intent_signature(name: str) -> IntentSignature | None`
  - Get metadata about an intent

- `has_intent(name: str) -> bool`
  - Check if an intent exists

### Verdict

Result of a verification operation.

#### Attributes

- `allowed: bool` — Whether the intent is permitted
- `reason: str | None` — Reason for denial (None if allowed)
- `guidance: str` — Human-readable guidance
- `category: str` — Policy decision category

### IntentSignature

Metadata about an intent.

#### Attributes

- `name: str` — Intent name
- `takes: list[tuple[str, str]]` — Input parameters (name, type)
- `gives: list[tuple[str, str]]` — Output parameters (name, type)
- `effect: str` — Effect class (READ, WRITE, NETWORK, etc.)
- `conscience: list[str]` — Applicable conscience predicates

### Module Functions

- `verify(policy_path: str, intent_name: str, fields: dict) -> Verdict`
  - One-shot verification helper

- `version() -> str`
  - Get version information

## Example Policy

```axiom
module security {
    intent ReadFile {
        takes:   path: String;
        gives:   content: String;
        effect:  READ;
        conscience: path_safety;
    }

    intent WriteFile {
        takes:   path: String, content: String;
        gives:   success: bool;
        effect:  WRITE;
        conscience: path_safety, no_exfiltrate;
    }
}
```

## License

Apache-2.0

