Skip to main content

piqrypt-langchain

Standard: AISS v2.0 · Full stack: piqrypt.com

Verifiable AI Agent Memory for LangChain.

PyPI Downloads License: MIT PiQrypt

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)


PiQrypt — Verifiable AI Agent Memory

Metadata

Release files for piqrypt-langchain-integration 1.1.0

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

Source distribution (sdist)

Source distribution for piqrypt-langchain-integration 1.1.0
File Size Uploaded
piqrypt_langchain_integration-1.1.0.tar.gz 3.9 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for piqrypt-langchain-integration 1.1.0
File Interpreter ABI Platform
piqrypt_langchain_integration-1.1.0-py3-none-any.whl Python 3 none any Details

Total release size: 8.0 kB

Release files / piqrypt_langchain_integration-1.1.0.tar.gz

Download URL piqrypt_langchain_integration-1.1.0.tar.gz
Size 3.9 kB
Tags Source
SHA-256 checksum
How to use checksums
d85ac10b64b12963301a371b237ebd3794e03a490957be69ffa6d56b3ef56186
BLAKE2b-256 checksum
How to use checksums
d3371168f73bfc5ed31f8a879d6f278bc88bf6ca6905c17e4b4ed64e2e4bc977
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.12

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Apr 19, 2026.

Transparency log

Release files / piqrypt_langchain_integration-1.1.0-py3-none-any.whl

Download URL piqrypt_langchain_integration-1.1.0-py3-none-any.whl
Size 4.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
190e142628f74c3b9cadf7fe3886b47696dbe4fde63333dcfa70c7da14b9681f
BLAKE2b-256 checksum
How to use checksums
481272dd1c2ed47037cf5fe9d2a222935756d3dd9e820c4f22e5d9a68d763942
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.12

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Apr 19, 2026.

Transparency log

Release history Release notifications | RSS feed

This release

1.1.0 This release

2 release files

1.0.0

2 release files

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