Skip to main content

Carry an AlgoVoi keystone decision into a LangChain run trace: a recomputable execution_ref under algovoi.keystone.*, verifiable offline

Project description

algovoi-keystone-langchain

Carry an AlgoVoi keystone decision into a LangChain run trace. The decision's content-addressed execution_ref rides along as run metadata and a tag, under the vendor namespace algovoi.keystone.* (never inside a LangChain reserved field). Anyone reading the trace recomputes execution_ref from the run metadata alone with only JCS (RFC 8785) and SHA-256, and confirms the agent's recorded action is consistent with the decision that authorized it. The reference is bound to the decision, not merely correlated with a run.

from algovoi_keystone_langchain import keystone_config, verify_trace_execution_ref

# attach the keystone reference to a LangChain run
result = chain.invoke(
    user_input,
    config=keystone_config(
        decision_ref="sha256:2a444c62...",   # the pre-payment decision (from the keystone)
        action_type="payment", scope="bilateral",
        outcome="COMMITTED", executed_at_ms=1716460800000,
    ),
)

The run's metadata now carries algovoi.keystone.execution_ref and the keystone preimage fields, so LangSmith (or any tracer) shows a recomputable reference. Verify it offline from the metadata:

verify_trace_execution_ref(run.metadata)   # True iff execution_ref recomputes

keystone_trace_metadata(...) returns the framework-neutral attribute dict if you want to attach it yourself; make_callback_handler(...) builds a LangChain callback handler (needs the langchain extra) carrying the same metadata. Python and TypeScript (@algovoi/keystone-langchain) produce the same execution_ref byte for byte. Apache-2.0.

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

algovoi_keystone_langchain-0.1.0.tar.gz (3.8 kB view details)

Uploaded Source

Built Distribution

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

algovoi_keystone_langchain-0.1.0-py3-none-any.whl (4.2 kB view details)

Uploaded Python 3

File details

Details for the file algovoi_keystone_langchain-0.1.0.tar.gz.

File metadata

File hashes

Hashes for algovoi_keystone_langchain-0.1.0.tar.gz
Algorithm Hash digest
SHA256 653ded7481018ad1772f7c09d19029c9b7e3699e0c7a842864b613fcb0f7104a
MD5 69644358f1c2ace6e50e0bc5487578c5
BLAKE2b-256 94b7ffb7be4c54e63a71ea10f57eec45cc723ebbcf9300dbca3612b5172d1303

See more details on using hashes here.

File details

Details for the file algovoi_keystone_langchain-0.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for algovoi_keystone_langchain-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 01e10e2851349528c79e2335bd4ee09d6e34b54c8c48d5f61b214919fe782dff
MD5 e3a5fd91e292e8a0066a41b3ed70ee69
BLAKE2b-256 66381f2736ae9ac5a777d9c4610843498418b9571d1f542f1aaee63c32c8c9d1

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