Skip to main content

Merkleon Python SDK

PyPI Python License

Cryptographic proof of every AI agent action — tamper-evident, externally verifiable.

Drop this SDK into your agent and every LLM call, tool invocation, file operation, or network request is hashed (SHA-256), chained (Merkle), and signed (Ed25519). The result is a server-side audit trail that any third party can mathematically verify — no trust in Merkleon required.

Why

Logs aren't proof. A startup with s3://my-bucket/logs/ has nothing a regulator, lawyer, or post-incident investigator can rely on — they can be edited after the fact. Merkleon turns each event into a link in a hash chain anchored by per-tenant Ed25519 keys. Tampering is detectable down to the byte.

  • ✅ Tamper-evident — break the chain, break the proof
  • ✅ Externally verifiable — public verifier, no Merkleon trust needed
  • ✅ Stable across redeploys — your signing identity survives
  • ✅ 4 lines of code to instrument any agent

Install

pip install merkleon-sdk

Optional auto-instrumentation extras:

pip install "merkleon-sdk[langchain]"   # LangChain callback
pip install "merkleon-sdk[openai]"      # OpenAI client wrapper
pip install "merkleon-sdk[all]"

Quickstart

from merkleon import Merkleon

m = Merkleon(
    endpoint="https://api.merkleon.in",
    api_key="va_…",                  # Settings → API Keys → Generate
    agent_id="research-bot",
)

# Sign one action
result = m.prove(
    "gpt-4o called: summarize Q4 earnings",
    agent="research-bot",
)
print(result["event_id"], result["event_hash"])

The response includes the server-assigned event_id, the SHA-256 event_hash, the prev_hash that anchors this event to the chain tip, an Ed25519 signature, and any anomaly alerts the detection layer raised:

{
  "status": "ingested",
  "event_id": "evt_c2db625a1166429c",
  "event_hash": "c0664aba383cf8a8…",
  "prev_hash": "0000000000000000…",
  "signature": "5e2b9d7c…",
  "alerts": []
}

Get an API key

  1. Sign up at merkleon.in
  2. Settings → API Keys → Generate
  3. Set in your environment:
export MERKLEON_API_KEY="va_…"

The SDK reads MERKLEON_API_KEY and MERKLEON_ENDPOINT from the environment, so most code only needs:

from merkleon import Merkleon
m = Merkleon(agent_id="research-bot")

Higher-level helpers

m.track_llm(model="gpt-4o", prompt="...", token_count=412, cost_usd=0.0021)
m.track_tool(tool="bash", args={"cmd": "ls /tmp"})
m.track_file_read(path="/etc/secrets.json")
m.track_network(host="api.openai.com", port=443)

Each one wraps prove() with the right event-type shape so you don't have to think about it.

Verifying a proof

Anyone — including you, your customer's auditor, or a regulator — can verify an event without trusting Merkleon's server:

curl "https://api.merkleon.in/api/v1/chain/integrity?agent_id=research-bot"
# → {"clean": true, "events_verified": 1247, "broken_at": null}

Or use merkleon.in/verify and paste an event_id.

What gets sent

Hashes, never raw content (unless you opt in). Default behaviour:

Field Sent?
Prompt text ❌ Only its SHA-256 hash
Response text ❌ Only its SHA-256 hash
Tool arguments Hashed when the tool is sensitive
File path ✅ As-is (PII scrubbed)
Token count, cost, model name ✅
Process name, cmdline ✅ (PII scrubbed)
Network destination host + port ✅

PII scrubbing is on by default. Disable with Merkleon(scrub_pii=False).

Async / batched mode

For high-throughput agents, batch events client-side and flush periodically:

m = Merkleon(async_mode=True, batch_size=20, flush_interval=2.0)
# prove() now returns immediately and pushes to an in-memory queue
# Background thread flushes every 2s or every 20 events
m.flush()  # explicit flush before shutdown

Pricing

Free tier covers small projects: 100K events / month, 7-day retention, 1 agent. Paid tiers add longer retention, witness cosigners, SIEM export, and SOC 2 evidence packs. See pricing.

License

MIT — see LICENSE.

Metadata

Release files for merkleon-sdk 0.3.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for merkleon-sdk 0.3.1
File Size Uploaded Provenance Actions
merkleon_sdk-0.3.1.tar.gz 16.7 kB Without provenance Details for merkleon_sdk-0.3.1.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for merkleon-sdk 0.3.1
File Interpreter ABI Platform Actions
merkleon_sdk-0.3.1-py3-none-any.whl Python 3 none any Details for merkleon_sdk-0.3.1-py3-none-any.whl

Total release size: 35.8 kB

Release files / merkleon_sdk-0.3.1.tar.gz

Download URL merkleon_sdk-0.3.1.tar.gz
Size 16.7 kB
Tags Source
SHA-256 checksum
How to use checksums
0e8a8fd8aaf6166fa37568c5de9b0e0e646218fdf911ed1c9d5309e39bf5870e
BLAKE2b-256 checksum
How to use checksums
ada43c2a0189dfb234497210792fcc5b3c30541393cc8ce99919ff0062980c0f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.13.3

Release files / merkleon_sdk-0.3.1-py3-none-any.whl

Download URL merkleon_sdk-0.3.1-py3-none-any.whl
Size 19.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
c02390f6d6ca78042c40b45556d2cab3ddfd49aed81f58fa3d3bbced7a78fcf7
BLAKE2b-256 checksum
How to use checksums
00589ae572847cfa52f8d8133dc4a553f71b915cc0c0e85c5718f2772af41acf
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.13.3

Security for merkleon-sdk 0.3.1

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.

Release history Release notifications | RSS feed

This release

0.3.1 This release

2 release files No provenance

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