attestify-langchain
Official LangChain toolkit for Attestify — governed AI loop execution with signed receipts, audit trails, governance-docs semantic search, x402-native payments on Base, and Attestify Trust (no-wallet agent identity + signed evidence).
Install
pip install attestify-langchain
Requires Python ≥ 3.9 and langchain-core ≥ 0.1. Trust tools additionally need cryptography — install with pip install attestify-langchain[trust]; everything else works without it.
Quick Start
import os
from attestify_langchain import AttestifyToolkit
from langchain_openai import ChatOpenAI
from langchain.agents import create_tool_calling_agent, AgentExecutor
from langchain_core.prompts import ChatPromptTemplate
# 1. Create the toolkit with your API key
toolkit = AttestifyToolkit(api_key=os.environ["ATTESTIFY_API_KEY"])
tools = toolkit.get_tools()
# 2. Build the agent
llm = ChatOpenAI(model="gpt-4o", temperature=0)
prompt = ChatPromptTemplate.from_messages([
["system", "You are an assistant with access to Attestify tools for governed execution and receipts."],
["placeholder", "{chat_history}"],
["human", "{input}"],
["placeholder", "{agent_scratchpad}"],
])
agent = create_tool_calling_agent(llm, tools, prompt)
executor = AgentExecutor(agent=agent, tools=tools, verbose=True)
# 3. Run it
result = executor.invoke({"input": "How many runs have I used this month?"})
print(result["output"])
Available Tools
| Tool | Description | Plan |
|---|---|---|
attestify_run_loop |
Submit a governed task to the loop router | All |
attestify_get_dashboard |
Run count, quota, plan tier, recent receipts | Builder+ |
attestify_get_recent_loops |
List recent loop receipts | All |
attestify_get_receipt |
Fetch a single receipt by loop_id |
All |
attestify_query_governance_docs |
Semantic search over Attestify's governance docs | All |
attestify_get_control_tower |
Live governance data (Enterprise only) | Enterprise |
attestify_trust_submit_evidence |
Sign and submit evidence of real work — free, no wallet | All (Trust configured) |
attestify_trust_verify |
Independently verify any Trust receipt by ID | Public, no key |
Getting Your API Key
- Subscribe at attestifyos.com/pricing — or register free for Trust-only use at attestifyos.com/trust
- Your
att_live_...key arrives by email immediately after payment (or instantly for Trust's free tier) - Set it as an environment variable:
export ATTESTIFY_API_KEY=att_live_...
Toolkit Options
toolkit = AttestifyToolkit(
api_key="att_live_...",
base_url="https://attestifyos.com", # default
timeout_s=60, # default
max_retries=2, # default
include_control_tower=False, # set False for Builder-plan agents
include_rag=False, # set False to omit the governance-docs search tool
trust_agent_id="agt_...", # or set TRUST_AGENT_ID
trust_private_key="...", # or set TRUST_PRIVATE_KEY
include_trust=False, # set False to omit the Trust tools entirely
)
Attestify Trust — no-wallet agent identity + signed evidence
A separate concern from Router execution above: no x402, no lanes, no spend. Register once, then every agent run can sign proof of what it actually did.
from attestify_langchain import provision_trust_agent, AttestifyToolkit
import os
# ONE TIME, outside any agent run — never call this per-invocation, and
# never let the agent call it itself. A fresh identity per run breaks the
# agent's own verified-active streak and adds noise to Attestify's public
# census instead of a real, citable number.
creds = provision_trust_agent(
api_key=os.environ["ATTESTIFY_API_KEY"],
display_name="Research Agent",
framework="langchain",
)
print(f"Store these — TRUST_AGENT_ID={creds['agent_id']} TRUST_PRIVATE_KEY={creds['private_key']}")
# From then on, with those two env vars set:
toolkit = AttestifyToolkit(api_key=os.environ["ATTESTIFY_API_KEY"])
tools = toolkit.get_tools() # includes attestify_trust_submit_evidence and
# attestify_trust_verify automatically
The private key is bound once at AttestifyToolkit construction — it's never a tool parameter, so it never enters the LLM's own context or a transcript.
Callback Handler
Log loop completions (loop_id, cost, verified) automatically:
from attestify_langchain import AttestifyCallbackHandler
handler = AttestifyCallbackHandler(
on_run_complete=lambda loop_id, cost, verified:
print(f"Loop {loop_id} cost {cost} USDC verified={verified}")
)
executor = AgentExecutor(agent=agent, tools=tools, callbacks=[handler])
LangGraph Example
from langgraph.prebuilt import create_react_agent
from langchain_openai import ChatOpenAI
from attestify_langchain import AttestifyToolkit
import os
toolkit = AttestifyToolkit(api_key=os.environ["ATTESTIFY_API_KEY"])
agent = create_react_agent(
ChatOpenAI(model="gpt-4o"),
toolkit.get_tools(),
)
for chunk in agent.stream({"messages": [("human", "Submit a task: summarise Q2 revenue")]}):
print(chunk)
(For a dedicated LangGraph package with its own state-graph node, see attestify-langgraph instead.)
Plan Gating
All plan enforcement is server-side. If an agent calls attestify_get_control_tower on a Builder plan, it receives:
{"error": "Enterprise plan required to access Control Tower.", "status": 403}
The agent can relay this directly to the user without any client-side logic.
Links
Metadata
Release files for attestify-langchain 0.2.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| attestify_langchain-0.2.0.tar.gz | 13.9 kB | Without provenance | Details for attestify_langchain-0.2.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| attestify_langchain-0.2.0-py3-none-any.whl | Python 3 | none | any | Details for attestify_langchain-0.2.0-py3-none-any.whl |
Total release size: 31.2 kB
Release files / attestify_langchain-0.2.0.tar.gz
| Download URL | attestify_langchain-0.2.0.tar.gz |
|---|---|
| Size | 13.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
3e00a59d9892c6a3e1c2e9f0178a2c02fc7cb7231477b35f1be0340fe680fdca
|
|
BLAKE2b-256 checksum How to use checksums |
9b52dbcb605fd57ebbb59157994b977a4a2680d336ba458f703374a9c0b48494
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Release files / attestify_langchain-0.2.0-py3-none-any.whl
| Download URL | attestify_langchain-0.2.0-py3-none-any.whl |
|---|---|
| Size | 17.2 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
bb511d0ed28a6290eef896b8d81df5e455776fbb0da902a82e623805706fe01b
|
|
BLAKE2b-256 checksum How to use checksums |
d89e66dbc7ba3ee75b940082188cbbff75a2806636dd33196d57a275b068180b
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Security for attestify-langchain 0.2.0
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.