Skip to main content

Viatoris LangChain Adapter

A drop-in LangChain callback handler that emits a cryptographically signed Viatoris receipt for every tool call your agent makes.

No rewrite. No latency. Receipt submission is fire-and-forget on a background thread and never raises — Viatoris is designed to never crash your agent.

Install

pip install viatoris-langchain

This pulls in viatorisai (the core SDK) and works with any langchain-core>=0.1.0 agent.

Usage

Get an API key and create an agent passport at dashboard.viatoris.ai, then save the returned private_key_jwk somewhere your agent can read it. After that, one line of integration:

from viatoris_langchain import ViatorisCallbackHandler

handler = ViatorisCallbackHandler(
    org_api_key="at_live_...",
    agent_did="did:web:example.com:agents:scout",
    private_key_jwk=saved_key,
    key_id="did:web:example.com:agents:scout#key-1",
)

# Add to any LangChain agent — every tool call gets a signed receipt
agent = AgentExecutor(agent=..., tools=..., callbacks=[handler])

That's it. Run your agent normally. Every on_tool_end produces a signed ActionReceipt with the tool name, inputs, outputs, and a success/failure status. Browse them at dashboard.viatoris.ai/audit or query them through the Viatoris API.

Tracking LLM and chain calls too

By default the handler only emits receipts for tool calls — that's almost always what you want for an audit trail. If you also want to receipt every raw LLM call or every chain step, opt in:

handler = ViatorisCallbackHandler(
    org_api_key="at_live_...",
    agent_did="did:web:example.com:agents:scout",
    private_key_jwk=saved_key,
    key_id="did:web:example.com:agents:scout#key-1",
    track_llm=True,
    verbose=True,
)
Option Default What it tracks
track_llm False Every on_llm_start/on_llm_end pair (one receipt per LLM call)
track_chains False Every on_chain_start/on_chain_end pair (one receipt per chain step)
capability "langchain" The capability field on every receipt — useful for filtering in the dashboard
verbose False Print a one-liner each time a receipt is queued

Both track_llm and track_chains produce a lot of receipts on a busy agent. Tools-only is the recommended default for production.

How it works

LangChain emits callbacks at every stage of agent execution. This handler:

  1. Stores tool inputs by run_id on on_tool_start.
  2. On on_tool_end, looks up the stored input, builds an ActionReceipt, signs it with your agent's Ed25519 key, and submits it to the Viatoris receipt service on a background thread.
  3. On on_tool_error, does the same but with result="failure" and the error in the outputs.

Every method body is wrapped in a try/except — if the SDK, the network, or anything else throws, your agent keeps running.

Documentation

Full Viatoris guide at viatoris.ai/quickstart.

Questions? Email jared@viatoris.ai.

License

MIT

Metadata

Release files for viatoris-langchain 0.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 viatoris-langchain 0.1.0
File Size Uploaded
viatoris_langchain-0.1.0.tar.gz 5.3 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for viatoris-langchain 0.1.0
File Interpreter ABI Platform
viatoris_langchain-0.1.0-py3-none-any.whl Python 3 none any Details

Total release size: 10.0 kB

Release files / viatoris_langchain-0.1.0.tar.gz

Download URL viatoris_langchain-0.1.0.tar.gz
Size 5.3 kB
Tags Source
SHA-256 checksum
How to use checksums
497664b4f00d40c417d20bb122412f62e464aa7bf9f770cc4e5563999e014175
BLAKE2b-256 checksum
How to use checksums
5433fa940b4c13cdbafefd221f31a63aa322637ca0830bf1bb062be2bd72da20
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.14.2

Release files / viatoris_langchain-0.1.0-py3-none-any.whl

Download URL viatoris_langchain-0.1.0-py3-none-any.whl
Size 4.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
d512138d2cf279d04d847f802d5b30eb5fa080d6ec397f2b37da1b62ee893800
BLAKE2b-256 checksum
How to use checksums
4be1130226366e551659d2286578121050169489d513128aa5051a329880b36c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.14.2

Release history Release notifications | RSS feed

This release

0.1.0 This release

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