Skip to main content

Read-only Inspector and evidence viewer package for AgentLedger

Project description

agentledger-inspector

Read-only Inspector and evidence viewer package for AgentLedger.

This package is language-neutral. It is implemented once as a companion evidence consumer and can inspect evidence/runtime metadata produced by Python, Go, TypeScript, or Rust implementations when they follow the AgentLedger contract.

pip install agentledger-inspector
pip install "agentledger-runtime[inspector]"

Inspect a local runtime database:

agentledger inspector run <run_id> --root .agentledger --html ./inspector.html

Inspect an exported evidence bundle:

agentledger inspector evidence ./evidence/<run_id> --html ./inspector.html

Redact sensitive keys before writing JSON or HTML:

agentledger inspector evidence ./evidence/<run_id> \
  --include-payloads \
  --redact-key password \
  --redact-key api_token \
  --html ./inspector.html

Reusable redaction policy:

{
  "keys": ["password", "api_token", "authorization"],
  "replacement": "[redacted]"
}
agentledger inspector run <run_id> --root .agentledger --redaction-policy ./inspector-redaction.json --out ./inspector.json

For Postgres or MySQL, use a read-only database credential and pass the local blob root that contains the referenced payload blobs. Inspector uses read-only store wrappers and does not run migrations or create tables:

agentledger inspector run <run_id> --backend postgres --dsn "$AGENTLEDGER_POSTGRES_DSN" --blob-root .agentledger/blobs --html ./inspector.html
agentledger inspector run <run_id> --backend mysql --dsn "$AGENTLEDGER_MYSQL_DSN" --blob-root .agentledger/blobs --html ./inspector.html

The Inspector does not start a server, mutate runtime state, call tools, approve requests, or contact model providers. It builds a language-neutral read model from AgentLedger runtime metadata or exported evidence bundles. AgentLedger does not add a separate permission layer for Inspector; use database grants, filesystem ACLs, and deployment policy.

Static HTML reports include local section navigation and internal cross-links between related timeline events, steps, Tool Ledger rows, approvals, policy decisions, and artifacts. Custom viewers can reuse the same anchor, related_refs, and related_links fields from InspectorReport.to_dict().

Extension API:

from agentledger_inspector import EvidenceBlobStoreProtocol, EvidenceStateStoreProtocol, InspectorDataSource, InspectorRedactionPolicy, InspectorReportBuilder

policy = InspectorRedactionPolicy(keys=("password", "api_token"))
report = InspectorDataSource().from_evidence_path("./evidence/run-1", redaction_policy=policy)
data = report.to_dict()
html = report.to_html()

builder = InspectorReportBuilder()
custom_report = builder.from_evidence_path("./evidence/run-1", redaction_policy=policy)

custom_source_report = InspectorDataSource().from_runtime_store(
    store=my_read_only_state_store,
    blobs=my_read_only_blob_store,
    run_id="run_123",
)

The default HTML renderer is a reference renderer. Users can build their own UI by consuming InspectorReport.to_dict() and preserving schema_version == agentledger.inspector.v1.

EvidenceStateStoreProtocol and EvidenceBlobStoreProtocol describe the minimal read API for custom database/blob backends.

Custom viewers should depend on the read model and protocols instead of undocumented SQL tables. Keep write/control actions outside Inspector surfaces; use runtime APIs for approve, deny, cancel, or recover operations.

Runnable custom-viewer example:

git clone https://github.com/yaogdu/AgentLedger.git
cd AgentLedger
PYTHONPATH=src python3 examples/inspector/custom_viewer.py

That example creates a temporary runtime, reads SQLite metadata, exports an evidence bundle, writes JSON/HTML reports, and builds a compact custom UI/API payload from InspectorReport.to_dict().

Security note: Inspector output may include tool arguments, model metadata, artifact references, approval reasons, and failure details. Treat exported JSON/HTML as sensitive operational evidence.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

agentledger_inspector-1.3.3.tar.gz (3.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

agentledger_inspector-1.3.3-py3-none-any.whl (3.1 kB view details)

Uploaded Python 3

File details

Details for the file agentledger_inspector-1.3.3.tar.gz.

File metadata

  • Download URL: agentledger_inspector-1.3.3.tar.gz
  • Upload date:
  • Size: 3.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.13

File hashes

Hashes for agentledger_inspector-1.3.3.tar.gz
Algorithm Hash digest
SHA256 000c90c426c4633ddf1500afbd9bb0d5fc851141a1ca6a180d26dc53f032186a
MD5 39d46af79c99b5c5a603df09543be791
BLAKE2b-256 d4f2938d1d758dde687a3c13c9bbb0d83f0ef711213d8d5c707096c936695bff

See more details on using hashes here.

File details

Details for the file agentledger_inspector-1.3.3-py3-none-any.whl.

File metadata

File hashes

Hashes for agentledger_inspector-1.3.3-py3-none-any.whl
Algorithm Hash digest
SHA256 1f05b95f5eb9e7abc3225d05ebe92e2bd9b741bf062d78a14244d6454bbd401e
MD5 60bbcbddee235ad96a735987b875bbd0
BLAKE2b-256 a86a1cba8ef99b2a5c95c06406e777095531118eafb1ed08a212ea4abb58b475

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page