Skip to main content

langchain-rvn

LangChain tools wrapping the rvn-agent-api REST API — the policy-gated Ravencoin asset API. An agent never touches the node directly: it submits an intent, the policy engine decides ALLOW / REQUIRE_APPROVAL / DENY, and every step lands in a hash-chained audit log. These tools proxy to the REST API exactly like the MCP server does, so the policy engine stays the single enforcement point.

Install

From a checkout of this repo (the package is not on PyPI yet — publishing is one twine upload away once a PyPI account is set up):

pip install ./langchain_rvn
# or, for development against the checkout:
pip install -e ./langchain_rvn

This installs langchain-core as well. The stdlib-only client (langchain_rvn.client.RvnApiClient) works without it; only get_tools() needs it.

Usage

from langchain_rvn import RvnApiClient, get_tools

client = RvnApiClient("http://127.0.0.1:3001", agent_id="agent-1")
tools = get_tools(client)  # 17 StructuredTools, one per API route
# hand `tools` to any LangChain agent executor

Tool results are JSON strings: a decision payload (ALLOW / REQUIRE_APPROVAL / DENY with reason codes, plus txid when executed), a held intent id (never an error — approve it only after a human approves), or {"error", "status"} when the API rejects the call. Always simulate_intent before acting when unsure — a simulation has zero side effects (no persisted intent, no spend recorded, no audit entry).

Worked example

examples/agent_executor.py runs a complete tool-calling agent loop against a local API on the mock node — no LLM key, no network beyond localhost, no real funds. It uses langchain-core's deterministic GenericFakeChatModel in place of a real chat model, so the conversation is scripted and repeatable; swapping in a real model (e.g. ChatOpenAI with .bind_tools(tools)) turns the same loop into a live agent. Run it with the API already up (pnpm dev from the repo root, MOCK_RVN=true by default):

python3 langchain_rvn/examples/agent_executor.py
# RVN_API_URL=http://127.0.0.1:3001 RVN_AGENT_ID=agent-1 python3 langchain_rvn/examples/agent_executor.py

The adapter test suite (pnpm test:langchain from the repo root) boots its own API and exercises the client and every tool against it.

License

GNU Affero General Public License v3.0 — see LICENSE.

Metadata

Release files for langchain-rvn 0.16.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 langchain-rvn 0.16.0
File Size Uploaded Provenance Actions
langchain_rvn-0.16.0.tar.gz 7.7 kB Without provenance Details for langchain_rvn-0.16.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for langchain-rvn 0.16.0
File Interpreter ABI Platform Actions
langchain_rvn-0.16.0-py3-none-any.whl Python 3 none any Details for langchain_rvn-0.16.0-py3-none-any.whl

Total release size: 16.3 kB

Release files / langchain_rvn-0.16.0.tar.gz

Download URL langchain_rvn-0.16.0.tar.gz
Size 7.7 kB
Tags Source
SHA-256 checksum
How to use checksums
918a674bb3c40aeb2ee46b4e88f088a035a77c094b564d02e8dd1c43ec755a56
BLAKE2b-256 checksum
How to use checksums
9e9bc27066143faba4e227488a87ae80a0ed2b093368f3fc6f78a639713a136b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.12.3

Release files / langchain_rvn-0.16.0-py3-none-any.whl

Download URL langchain_rvn-0.16.0-py3-none-any.whl
Size 8.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
02032d9152b98bb71f240fafcd6c8186b85262d20445cb80c844b44dc6aaad83
BLAKE2b-256 checksum
How to use checksums
4a0d870429d77ce26e91f92d223b81f5feae34664d31e9ef4536faae9893a1ce
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.12.3

Security for langchain-rvn 0.16.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.

Release history Release notifications | RSS feed

This release

0.16.0 This release

2 release files No provenance

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