Metadata-Version: 2.4
Name: veralog
Version: 0.2.2
Summary: Cryptographic audit trails for AI agents — Ed25519 + PTA Behavioral Layer
Home-page: https://www.vrlg.tech
Author: Anton Kupreev
Author-email: liquidcrystalcore@gmail.com
Keywords: ai agent audit log cryptographic ed25519 pta behavioral-layer enterprise security
Classifier: Development Status :: 4 - Beta
Classifier: Intended Audience :: Developers
Classifier: Topic :: Software Development :: Libraries
Classifier: Topic :: Security
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.8
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Requires-Python: >=3.8
Description-Content-Type: text/markdown
Dynamic: author
Dynamic: author-email
Dynamic: classifier
Dynamic: description
Dynamic: description-content-type
Dynamic: home-page
Dynamic: keywords
Dynamic: requires-python
Dynamic: summary

# Veralog Python SDK

Cryptographic audit trails for AI agents. Add one line to your agent, get a tamper-proof signed log of every action.

**[www.vrlg.tech](https://www.vrlg.tech)**

## Installation

```bash
pip install veralog
```

## Quick start

```python
import veralog

veralog.configure(api_key="vrlg_...")

result = veralog.record(
    agent_id="sales-bot",
    action="send_proposal",
    payload={"client": "acme-corp", "deal_value": 50000},
    status="success",
)

print(result.verify_url)
```

## Get an API key

```python
import veralog
account = veralog.register(email="you@yourcompany.com")
print(account["api_key"])
```

Or register at [www.vrlg.tech](https://www.vrlg.tech).

## Configuration

```python
# Explicit
veralog.configure(api_key="vrlg_...")

# Or via environment variable
export VERALOG_API_KEY="vrlg_..."
```

## Record an event

```python
result = veralog.record(
    agent_id="sales-bot",           # required: your agent's ID
    action="send_proposal",         # required: what it did
    payload={"client": "acme"},     # required: arbitrary dict
    status="success",               # success | warning | error | crash | timeout | blocked | cancelled
    severity="info",                # debug | info | warning | error | critical
    flags=[],                       # loop_detected | policy_violation | data_exposure | ...
    trace_id="trace-abc-123",       # optional: correlation ID
    tool_name="gmail_api",          # optional: tool used
)

print(result.event_id)    # UUID
print(result.verify_url)  # https://www.vrlg.tech/verify/{id}/page
print(result.events_used) # running total
```

## Query events

```python
events = veralog.get_events(
    status="blocked",
    agent_id="sales-bot",
    since="2026-06-01T00:00:00",
    limit=50,
)
print(events["total"])
print(events["events"])
```

## Export all events

```python
data = veralog.export()
# Returns dict with all events, signatures, and public keys
```

## Verify an event

```python
event = veralog.verify("8b466b96-8663-4742-a6a6-8964ce69e5d4")
print(event["signature"])
print(event["public_key"])
```

## LangChain example

```python
from langchain.agents import AgentExecutor
import veralog

veralog.configure(api_key="vrlg_...")

def run_agent_with_audit(agent_executor, input_text):
    try:
        result = agent_executor.invoke({"input": input_text})
        veralog.record(
            agent_id="langchain-agent",
            action="invoke",
            payload={"input": input_text, "output": result["output"][:200]},
            status="success",
        )
        return result
    except Exception as e:
        veralog.record(
            agent_id="langchain-agent",
            action="invoke",
            payload={"input": input_text, "error": str(e)},
            status="error",
            severity="error",
        )
        raise
```

## CrewAI example

```python
from crewai import Agent, Task, Crew
import veralog

veralog.configure(api_key="vrlg_...")

class AuditedCrew(Crew):
    def kickoff(self, inputs=None):
        result = super().kickoff(inputs=inputs)
        veralog.record(
            agent_id="crewai-crew",
            action="kickoff",
            payload={"inputs": inputs, "result": str(result)[:200]},
            status="success",
        )
        return result
```

## Independent verification

Every event is signed with **Phantom Trust Algorithm (PTA) v1.0** вЂ” the first cryptographic algorithm born from AI physics. You can verify any event without Veralog:

```python
import binascii, struct

event = veralog.verify("your-event-id")

# PTA verification вЂ” no external library needed
sig = binascii.unhexlify(event["signature"])

# Check PTA version marker
assert sig[:4] == b"PTA1", "Not a PTA signature"

# Extract endo/exo genome key pair
endo, exo = struct.unpack(">HH", sig[4:8])

# Core PTA check: genome resonance >= 12/16 bits
resonance = bin((~(endo ^ exo)) & 0xFFFF).count("1")
assert resonance >= 12, f"Resonance {resonance}/16 below minimum"

print(f"PTA Verified вЂ” resonance {resonance}/16 вЂ” event was not tampered with")
```

> **Phantom Trust Algorithm (PTA) v1.0** вЂ” patent pending (Rospatent в†’ PCT).
> Algorithm origin: God Code physics engine вЂ” endo_bits/exo_bits resonance.

## Links

- Website: [www.vrlg.tech](https://www.vrlg.tech)
- API docs: [www.vrlg.tech/docs](https://www.vrlg.tech/docs)
- Contact: liquidcrystalcore@gmail.com
