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

pip install langchain-rvn
# or, for development against a checkout of this repo:
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.1

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.1
File Size Uploaded Provenance Actions
langchain_rvn-0.16.1.tar.gz 7.6 kB Without provenance Details for langchain_rvn-0.16.1.tar.gz

Built distribution (wheel)

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

Total release size: 16.2 kB

Release files / langchain_rvn-0.16.1.tar.gz

Download URL langchain_rvn-0.16.1.tar.gz
Size 7.6 kB
Tags Source
SHA-256 checksum
How to use checksums
05092be83e8bb198470fc3a0f5846909b1355cf1721a17a2dedd87e432d01a59
BLAKE2b-256 checksum
How to use checksums
e56bead0d1acafed3c123a16ac0cfa83e25aba80db78eb4d759b640c8cd168ee
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.1-py3-none-any.whl

Download URL langchain_rvn-0.16.1-py3-none-any.whl
Size 8.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
b24aba1203013a39c3508dbdc5c79b53755d0a76602f2d51b3c025511a4c9ad2
BLAKE2b-256 checksum
How to use checksums
98bc37fe3f871226f7e040ae7e9e77ceb1456e9dab530e8fa6596801ce574547
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.1

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.1 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