Skip to main content

Bolyra LangChain Integration

LangChain tools for Bolyra mutual ZKP authentication and SD-JWT delegation.

Status: Alpha / Developer preview. Three tools as proper BaseTool subclasses.

Install

pip install bolyra-langchain

For ZKP-based auth (BolyraAuthTool, BolyraDelegateTool), also install:

npm install @bolyra/sdk && npx bolyra setup  # circuit artifacts

SD-JWT auth (BolyraSDJWTTool) requires no Node.js.

Quick Start

SD-JWT Delegation (No ZKP, No Node.js)

from bolyra_langchain import BolyraSDJWTTool
from langchain.agents import create_react_agent, AgentExecutor

# Dev mode -- auto-generates test credentials
sd_jwt_tool = BolyraSDJWTTool()

# Use in a LangChain agent
tools = [sd_jwt_tool]
agent = create_react_agent(llm, tools, prompt)
executor = AgentExecutor(agent=agent, tools=tools)

result = executor.invoke({"input": "Authorize a $50 purchase at shop.example.com"})

ZKP Mutual Authentication

from bolyra_langchain import BolyraAuthTool

# Dev mode (fixed-seed dev identities -- never for production)
auth_tool = BolyraAuthTool()

# Production mode
auth_tool = BolyraAuthTool(
    agent_model_hash="gpt-4o",
    operator_key="0xdeadbeef...",
    permissions=["read_data", "write_data"],
    human_secret=12345,
)

result = auth_tool.invoke({
    "scope": "my-app",
    "required_permissions": ["read_data"],
})

ZKP Delegation

from bolyra_langchain import BolyraDelegateTool

delegate = BolyraDelegateTool(
    agent_permissions=["read_data", "write_data", "financial_small"],
)

result = delegate.invoke({
    "delegatee_id": "0xabc123...",
    "permissions": ["read_data"],
    "session_nonce": "nonce-from-handshake",
    "scope_commitment": "commitment-from-handshake",
})

Session-Managed Chain

from bolyra_langchain import BolyraAuthTool, BolyraDelegateTool, BolyraSession

auth = BolyraAuthTool(permissions=["read_data", "write_data"])
delegate = BolyraDelegateTool(agent_permissions=["read_data", "write_data"])
session = BolyraSession(auth_tool=auth, delegate_tool=delegate)

# Authenticate first
auth_result = session.authenticate(scope="my-app")

# Delegate -- session_nonce and scope_commitment auto-injected
del_result = session.delegate(
    delegatee_id="0xabc...",
    permissions=["read_data"],
)

Tools

Tool Path Requires Node.js Description
BolyraAuthTool ZKP Yes Mutual ZKP handshake authentication
BolyraDelegateTool ZKP Yes Scoped ZKP permission delegation
BolyraSDJWTTool SD-JWT No Lightweight SD-JWT delegation

All tools subclass langchain_core.tools.BaseTool and work with create_react_agent, AgentExecutor, LCEL chains, and LangGraph.

Dev Mode

When no keys are provided, tools auto-generate test credentials:

  • BolyraAuthTool: uses fixed-seed dev identities (deterministic)
  • BolyraSDJWTTool: generates fresh Ed25519 keypairs per instance

Dev mode is never for production. In production, provide explicit operator keys, human secrets, or issuer keys.

Non-Monorepo Setup

If using bolyra from PyPI (not the monorepo), set the Node.js SDK path:

export BOLYRA_NODE_SDK_PATH=/path/to/node_modules/@bolyra/sdk

Or via config:

from bolyra.types import BolyraConfig
config = BolyraConfig(node_sdk_path="/path/to/node_modules/@bolyra/sdk")

Architecture

integrations/langchain/
  pyproject.toml              # bolyra-langchain package
  README.md
  bolyra_langchain/
    __init__.py               # Public API
    auth_tool.py              # BolyraAuthTool(BaseTool)
    delegate_tool.py          # BolyraDelegateTool(BaseTool)
    sd_jwt_tool.py            # BolyraSDJWTTool(BaseTool)
    session.py                # BolyraSession
    types.py                  # AuthResult, DelegationResult, SDJWTResult
    _compat.py                # LangChain version shims
  tests/
    test_auth_tool.py
    test_delegate_tool.py
    test_sd_jwt_tool.py
    test_session.py

The SD-JWT module lives in the core bolyra SDK at sdk-python/bolyra/sd_jwt.py and is re-used by both the LangChain and CrewAI integrations.

Metadata

Release files for bolyra-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 bolyra-langchain 0.1.0
File Size Uploaded Provenance
bolyra_langchain-0.1.0.tar.gz 19.3 kB With provenance Details

Built distribution (wheel)

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

Total release size: 33.5 kB

Release files / bolyra_langchain-0.1.0.tar.gz

Download URL bolyra_langchain-0.1.0.tar.gz
Size 19.3 kB
Tags Source
SHA-256 checksum
How to use checksums
67dad7a17387ca2caf8c84a3e083a34b9cca4396dda5f9f0c9d8323edd69eb34
BLAKE2b-256 checksum
How to use checksums
0a5f7e3aab4fe6162f4fe2fff173369bf8f292e565bf802e3d13babfe00cec18
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.12

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Jun 19, 2026.

Transparency log

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

Download URL bolyra_langchain-0.1.0-py3-none-any.whl
Size 14.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
9596f5efe024e06a4cba94d02105d29f7b7c23d5b1364c0b9ad2cc92636a17b5
BLAKE2b-256 checksum
How to use checksums
fbc5043d1e3acec965a09937a181bba8ac3c4b485abc5059f9a900e89ec0a0ea
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.12

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Jun 19, 2026.

Transparency log

Security for bolyra-langchain 0.1.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.

Full provenance

All 2 files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for bolyra_langchain-0.1.0.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Jun 19, 2026.

Transparency log

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.1.0 This release

2 release files Full 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