semvec/pypi-packages huggingface dataset:
lazarus-langchain 1.0.0
Receipt emission and verification helpers for LangChain (auditor-grade action logging)
License: Apache-2.0
Requires Python: >=3.9
Keywords: ai-governance, audit, compliance, cryptographic, langchain, merkle, receipts

# lazarus-langchain

Cryptographic receipts for LangChain - auditor-grade AI action verification.

## Installation

```bash
pip install lazarus-langchain
```

## Quick Start

```python
from langchain_openai import ChatOpenAI
from lazarus_langchain import LazarusCallbackHandler, configure_signer

# Optional: Enable signing (otherwise receipts are unsigned but still verifiable)
# configure_signer(my_32_byte_seed, key_id="my-key")

# Create handler
handler = LazarusCallbackHandler(agent_id="my-agent")

# Use with any LangChain component
llm = ChatOpenAI(model="gpt-4")
response = llm.invoke("Hello, world!", callbacks=[handler])

# Export receipts for audit
handler.export_jsonl("receipts.jsonl")
handler.export_bundle("bundle.json")
```

## Features

- **RFC 8785 (JCS) Canonicalization**: Cross-language deterministic JSON serialization
- **Ed25519 Signatures**: Optional cryptographic signing with PyNaCl
- **Positional Merkle Proofs**: Auditor-grade proof structure (v1.0.1 rule)
- **Hash-Only Payloads**: Privacy-preserving - stores SHA-256 hashes, not raw content
- **Offline Verification**: Auditors can verify without network/vendor access

## Verification

Use the [lazarus CLI](https://github.com/805-ai/lazarus-receipts-cli) to verify receipts:

```bash
lazarus report --input bundle.json --output audit.json
```

## Event Types

| Event | Description |
|-------|-------------|
| `LLM_START` | LLM invocation begins |
| `LLM_END` | LLM returns output |
| `CHAIN_START` | Chain execution begins |
| `CHAIN_END` | Chain returns output |
| `TOOL_START` | Tool invocation begins |
| `TOOL_END` | Tool returns result |
| `AGENT_ACTION` | Agent takes action |
| `AGENT_FINISH` | Agent completes |
| `*_ERROR` | Error in any component |

## License

Apache-2.0