RANKIGI Python SDK — tamper-evident audit trails for AI agents
Project description
rankigi
Tamper-evident audit trails for AI agents. Non-blocking, zero-overhead governance that never impacts your agent's critical path.
Install
pip install rankigi
Optional extras:
pip install rankigi[langchain] # LangChain callback handler
pip install rankigi[signing] # Ed25519 passport signing
Quick Start
from rankigi import Rankigi
rk = Rankigi(
api_key="rk_live_...",
agent_id="your-agent-uuid",
)
# Track a tool call — input/output are SHA-256 hashed before transmission
rk.track_tool_call("web_search", {"query": "Q4 revenue"}, results)
# Track with intent reasoning (encrypted with AES-256-GCM)
rk.track_tool_call(
"web_search",
{"query": "Q4 revenue"},
results,
intent="User asked about quarterly financials, searching for latest data",
)
# Track agent output
rk.track_agent_output("The Q4 revenue was $12M.")
# Track errors
rk.track_error(some_exception)
# Track custom events
rk.track_custom_event("policy_check", {"rule": "pii_filter", "passed": True})
# Graceful shutdown (optional — flushes pending events)
rk.close()
Context Manager
with Rankigi(api_key="rk_live_...", agent_id="your-agent-uuid") as rk:
rk.track_tool_call("web_search", {"query": "test"}, {"results": []})
# Events are automatically flushed on exit
LangChain Integration
from rankigi.langchain import RangigiCallbackHandler
handler = RangigiCallbackHandler(
api_key="rk_live_...",
agent_id="your-agent-uuid",
)
# Add to any LangChain agent — governance is now automatic
agent = initialize_agent(
tools=tools,
llm=llm,
callbacks=[handler],
)
Features
- Non-blocking — events are queued and sent on a background daemon thread
- Privacy-first — inputs/outputs are SHA-256 hashed before transmission
- Intent Chain — optional AES-256-GCM encrypted agent reasoning
- Passport signing — Ed25519 event signatures for tamper-evident chains
- LangChain support — drop-in callback handler for automatic governance
- Zero dependencies — stdlib only (extras for LangChain, signing)
- Automatic retry — exponential backoff with local buffering
Configuration
rk = Rankigi(
api_key="rk_live_...", # Required: API key from /dashboard/keys
agent_id="your-agent-uuid", # Required: Agent ID from /dashboard/agents
base_url="https://rankigi.com", # Optional: custom deployment URL
on_error=lambda e: log(e), # Optional: error callback
max_retries=3, # Optional: retry attempts (default 3)
max_buffer=1000, # Optional: max buffered events (default 1000)
timeout=5.0, # Optional: HTTP timeout in seconds
signing_key="base64...", # Optional: Ed25519 key for passport signing
passport_id="passport-uuid", # Optional: passport ID for event signing
intent_key="hex-string", # Optional: AES-256 key for intent chain
)
Documentation
Full documentation at rankigi.com/docs
License
MIT
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
rankigi-1.0.0.tar.gz
(15.7 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
rankigi-1.0.0-py3-none-any.whl
(12.2 kB
view details)
File details
Details for the file rankigi-1.0.0.tar.gz.
File metadata
- Download URL: rankigi-1.0.0.tar.gz
- Upload date:
- Size: 15.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.9.6
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
80b1a9e776e81f9281b2180e4e9d9a568a1da7f17d1374eb3e7f9a4ce2b5a7e7
|
|
| MD5 |
394d199bffac461d1804c293924d1b84
|
|
| BLAKE2b-256 |
b2ee6691c6be6a7264ecbd05872454e5bbb3fa208ec78ae8c23e86ca0d204808
|
File details
Details for the file rankigi-1.0.0-py3-none-any.whl.
File metadata
- Download URL: rankigi-1.0.0-py3-none-any.whl
- Upload date:
- Size: 12.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.9.6
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
409ff859245819c3edc6ab3ce30f3a299d99f2241f52f569ec0a658adb22fa06
|
|
| MD5 |
1fc38a0a5a341cb4d8d5c6744f293375
|
|
| BLAKE2b-256 |
a3b5946f845081f551a77da93624769be25f7d99e330ce055a0f1da9530ff07e
|