AgentLedger Adapters
One-liner audit trails and policy enforcement for the most popular Python agent frameworks.
from agent_ledger_adapters import build_ledger
from agent_ledger_adapters.langchain import AgentLedgerCallbackHandler
ledger = build_ledger("agent_ledger.db", policy_path="policy.json")
chain.run(question, callbacks=[AgentLedgerCallbackHandler(ledger, agent_id="my-agent", enforce=True)])
Built on AgentLedger (vendored, zero dependencies). Every agent action lands in a tamper-proof SHA-256 chain; with enforce=True, policy violations raise and stop the offending action.
Supported frameworks
| Framework | Adapter | How to attach |
|---|---|---|
| LangChain / LangGraph | agent_ledger_adapters.langchain.AgentLedgerCallbackHandler |
callbacks=[handler] |
| LlamaIndex | agent_ledger_adapters.llamaindex.AgentLedgerCallbackHandler |
CallbackManager([handler]) |
| OpenAI Agents SDK | agent_ledger_adapters.openai_agents.AgentLedgerRunHooks |
Runner.run(agent, input, hooks=hooks) |
No framework is required to install this package — imports are lazy, so only the adapter you use pulls in its framework.
What gets logged
chain_start/end, agent_action, tool_call, tool_result, tool_error, llm_start/end/error, agent_start/end, run_start/end, handoff — with run IDs, inputs, outputs, and error messages (truncated).
Policy enforcement
{
"version": 1,
"default": "deny",
"policies": [
{"agent": "my-agent", "action": "delete_*", "target": "*", "decision": "deny"},
{"agent": "my-agent", "action": "deploy", "target": "production", "decision": "require_approval"}
]
}
deny→PolicyViolationraised (witherrors="raise"), violation loggedrequire_approval→ logged withpolicy_status: pending_approvalerrors="ignore"(default) → auditing never breaks your agent
Run the tests
cd tests && python3 test_adapters.py # mock framework objects, no frameworks needed
MIT
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 agent_ledger_adapters-0.1.0.tar.gz.
File metadata
- Download URL: agent_ledger_adapters-0.1.0.tar.gz
- Upload date:
- Size: 6.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.8.10
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
8825ad5b289d7dda3296f7ee8817339ec932ca75376639d285f92ac1b3f95223
|
|
| MD5 |
e0987626db65487428343a6f0ecf3cfd
|
|
| BLAKE2b-256 |
64856cef45bd90b7a104778be83e5224b75d1e2693579a516622d1440df67cae
|
File details
Details for the file agent_ledger_adapters-0.1.0-py3-none-any.whl.
File metadata
- Download URL: agent_ledger_adapters-0.1.0-py3-none-any.whl
- Upload date:
- Size: 7.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.8.10
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
2a6529353424ade3340ffb1264b1c7d47bdcf5fbc99c77e53bd5363530e895e7
|
|
| MD5 |
9b61dd366141c860754a81a627506bf9
|
|
| BLAKE2b-256 |
afda95b2fdccdd24d085efd9ea0d932220d82c82ce9ca32fc307fb1c1a0de2e0
|