Skip to main content

LangChain Python tool wrapping SBO3L — gate every agent payment intent through SBO3L's policy boundary.

Project description

sbo3l-langchain

LangChain Python tool wrapping SBO3L. Mirror of @sbo3l/langchain (TypeScript).

DRAFT (T-1-2): depends on F-10 (sbo3l-sdk) merging + publishing to PyPI.

Install

pip install sbo3l-langchain sbo3l-sdk langchain-core

Quick start

from langchain_core.tools import StructuredTool
from sbo3l_sdk import SBO3LClientSync, bearer
from sbo3l_langchain import sbo3l_tool

client = SBO3LClientSync(
    "http://localhost:8730",
    auth=bearer("my-bearer-token"),
)
descriptor = sbo3l_tool(client=client)
tool = StructuredTool.from_function(
    func=descriptor.func,
    name=descriptor.name,
    description=descriptor.description,
)
# Pass `tool` into your LangChain agent's tool list.

What it does

The agent emits a tool call with a JSON-stringified APRP. The tool forwards to client.submit() and returns a JSON envelope:

{
  "decision": "allow",
  "deny_code": null,
  "matched_rule_id": "allow-low-risk-x402",
  "execution_ref": "kh-...",
  "audit_event_id": "evt-...",
  "request_hash": "...",
  "policy_hash": "..."
}

On deny, the LLM sees deny_code (policy.budget_exceeded, policy.token_unsupported, etc.) and can self-correct or escalate.

Idempotency

descriptor = sbo3l_tool(
    client=client,
    idempotency_key=lambda body: f"{body['task_id']}-{body['nonce']}",
)

Async clients

This factory returns a sync callback. Use SBO3LClientSync (httpx.Client under the hood — safe inside any event loop). If you must use the async client, create your own async tool that awaits client.submit(...).

Errors

Transport / auth failures surface as a JSON envelope with error (RFC 7807 domain code, e.g. auth.required) and status.

License

MIT

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

sbo3l_langchain-1.2.0.tar.gz (6.1 kB view details)

Uploaded Source

Built Distribution

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

sbo3l_langchain-1.2.0-py3-none-any.whl (5.9 kB view details)

Uploaded Python 3

File details

Details for the file sbo3l_langchain-1.2.0.tar.gz.

File metadata

  • Download URL: sbo3l_langchain-1.2.0.tar.gz
  • Upload date:
  • Size: 6.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for sbo3l_langchain-1.2.0.tar.gz
Algorithm Hash digest
SHA256 a4cd414be3f650d080b30807ca87ddea219407a45a72a0215d57b6be8be90a96
MD5 3a6de46fb17b133a33fd726b758e1e12
BLAKE2b-256 4ba754e17104802f37d5b27dc75714c75813166e233fb4800abb472cee3bd826

See more details on using hashes here.

Provenance

The following attestation bundles were made for sbo3l_langchain-1.2.0.tar.gz:

Publisher: integrations-publish.yml on B2JK-Industry/SBO3L-ethglobal-openagents-2026

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file sbo3l_langchain-1.2.0-py3-none-any.whl.

File metadata

File hashes

Hashes for sbo3l_langchain-1.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 2a11f2f6179c6bf95b4eccb28e4e836a00c6819baee167be00e54d849d3edfa9
MD5 a425e697a98f419e96adaa121e911ea8
BLAKE2b-256 cde416623d33694fad58ec54d4ba90d74f9f175b2d2ff3aeebffaa8670fb4a7a

See more details on using hashes here.

Provenance

The following attestation bundles were made for sbo3l_langchain-1.2.0-py3-none-any.whl:

Publisher: integrations-publish.yml on B2JK-Industry/SBO3L-ethglobal-openagents-2026

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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