PiQrypt Verifiable AI Agent Memory bridge for LangChain
Project description
piqrypt-langchain
Standard: AISS v2.0 · Full stack: piqrypt.com
Verifiable AI Agent Memory for LangChain.
Every tool call, LLM response, chain execution, and agent action — signed, hash-chained, tamper-proof.
pip install piqrypt-langchain
Quickstart — attach once, stamp everything
from langchain_openai import ChatOpenAI
from langchain.agents import AgentExecutor, create_openai_tools_agent
from piqrypt_langchain import PiQryptCallbackHandler
# One handler — stamps every LLM call, tool call, and chain event
handler = PiQryptCallbackHandler(identity_file="my-agent.json")
llm = ChatOpenAI(model="gpt-4o", callbacks=[handler])
agent = create_openai_tools_agent(llm, tools, prompt)
executor = AgentExecutor(agent=agent, tools=tools, callbacks=[handler])
result = executor.invoke({"input": "Analyze Q4 sales and flag anomalies"})
# Export verifiable memory
handler.export_audit("q4-analysis-audit.json")
# $ piqrypt verify q4-analysis-audit.json
Drop-in AgentExecutor
from piqrypt_langchain import AuditedAgentExecutor
# Replace AgentExecutor with AuditedAgentExecutor
executor = AuditedAgentExecutor(
agent=your_agent,
tools=your_tools,
identity_file="my-agent.json"
)
result = executor.invoke({"input": "Your query here"})
executor.export_audit("audit.json")
Wrap individual tools
from langchain.tools import tool
from piqrypt_langchain import piqrypt_tool
@tool
@piqrypt_tool(identity_file="my-agent.json")
def search_web(query: str) -> str:
"""Search the web for information."""
return your_search_logic(query)
@tool
@piqrypt_tool(identity_file="my-agent.json")
def execute_sql(query: str) -> str:
"""Execute a SQL query."""
return your_db_logic(query)
Wrap chain functions
from piqrypt_langchain import stamp_chain
@stamp_chain("document_analysis", identity_file="my-agent.json")
def analyze_document(doc: str) -> dict:
return your_chain.invoke({"input": doc})
What gets stamped
| Event | When |
|---|---|
callback_handler_initialized |
Handler creation |
llm_response |
After every LLM call |
tool_start |
Before tool execution |
tool_end |
After tool execution |
tool_error |
On tool failure |
chain_start |
Before chain runs |
chain_end |
After chain completes |
agent_action |
Every agent decision |
agent_finish |
Agent completion |
executor_invoke |
AgentExecutor input |
executor_complete |
AgentExecutor output |
All events Ed25519-signed, SHA-256 hash-chained.
Raw inputs and outputs never stored — only their SHA-256 hashes.
Verify
piqrypt verify langchain-audit.json
# ✅ Chain integrity verified — 32 events, 0 forks
piqrypt search --type tool_error
# All tool failures with timestamps
Why the callback handler is the best approach
LangChain's callback system is designed exactly for this — attach once at the top level, every nested component fires the same callbacks. One PiQryptCallbackHandler stamps your entire agent pipeline automatically, including:
- Every LLM call inside chains
- Every tool invocation
- Every intermediate chain step
- Every agent decision
No need to modify individual tools or chains.
Scope
| Use case | AISS profile |
|---|---|
| Development / PoC | AISS-1 (Free, included) |
| Non-critical production | AISS-1 (Free) |
| Regulated production | AISS-2 (Pro) |
Links
- PiQrypt core: github.com/piqrypt/piqrypt
- Integration guide: INTEGRATION.md — LangChain
- Issues: piqrypt@gmail.com
PiQrypt — Verifiable AI Agent Memory
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
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
File details
Details for the file piqrypt_langchain_integration-1.1.0.tar.gz.
File metadata
- Download URL: piqrypt_langchain_integration-1.1.0.tar.gz
- Upload date:
- Size: 3.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d85ac10b64b12963301a371b237ebd3794e03a490957be69ffa6d56b3ef56186
|
|
| MD5 |
6d0c494c9cf280db51e619bc774e1bd1
|
|
| BLAKE2b-256 |
d3371168f73bfc5ed31f8a879d6f278bc88bf6ca6905c17e4b4ed64e2e4bc977
|
Provenance
The following attestation bundles were made for piqrypt_langchain_integration-1.1.0.tar.gz:
Publisher:
publish.yml on PiQrypt/piqrypt-langchain-integration
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
piqrypt_langchain_integration-1.1.0.tar.gz -
Subject digest:
d85ac10b64b12963301a371b237ebd3794e03a490957be69ffa6d56b3ef56186 - Sigstore transparency entry: 1340462361
- Sigstore integration time:
-
Permalink:
PiQrypt/piqrypt-langchain-integration@8b04cc15abbad50ba1b447814548af1e13c8537b -
Branch / Tag:
refs/tags/v1.1.0 - Owner: https://github.com/PiQrypt
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@8b04cc15abbad50ba1b447814548af1e13c8537b -
Trigger Event:
release
-
Statement type:
File details
Details for the file piqrypt_langchain_integration-1.1.0-py3-none-any.whl.
File metadata
- Download URL: piqrypt_langchain_integration-1.1.0-py3-none-any.whl
- Upload date:
- Size: 4.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
190e142628f74c3b9cadf7fe3886b47696dbe4fde63333dcfa70c7da14b9681f
|
|
| MD5 |
0f9e1b4fdea80a1b1053e407c25a4bed
|
|
| BLAKE2b-256 |
481272dd1c2ed47037cf5fe9d2a222935756d3dd9e820c4f22e5d9a68d763942
|
Provenance
The following attestation bundles were made for piqrypt_langchain_integration-1.1.0-py3-none-any.whl:
Publisher:
publish.yml on PiQrypt/piqrypt-langchain-integration
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
piqrypt_langchain_integration-1.1.0-py3-none-any.whl -
Subject digest:
190e142628f74c3b9cadf7fe3886b47696dbe4fde63333dcfa70c7da14b9681f - Sigstore transparency entry: 1340462364
- Sigstore integration time:
-
Permalink:
PiQrypt/piqrypt-langchain-integration@8b04cc15abbad50ba1b447814548af1e13c8537b -
Branch / Tag:
refs/tags/v1.1.0 - Owner: https://github.com/PiQrypt
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@8b04cc15abbad50ba1b447814548af1e13c8537b -
Trigger Event:
release
-
Statement type: