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
Metadata
Release files for sbo3l-langchain 1.2.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| sbo3l_langchain-1.2.0.tar.gz | 6.1 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| sbo3l_langchain-1.2.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 12.0 kB
Release files / sbo3l_langchain-1.2.0.tar.gz
| Download URL | sbo3l_langchain-1.2.0.tar.gz |
|---|---|
| Size | 6.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
a4cd414be3f650d080b30807ca87ddea219407a45a72a0215d57b6be8be90a96
|
|
BLAKE2b-256 checksum How to use checksums |
4ba754e17104802f37d5b27dc75714c75813166e233fb4800abb472cee3bd826
|
| 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 May 2, 2026.
Transparency logRelease files / sbo3l_langchain-1.2.0-py3-none-any.whl
| Download URL | sbo3l_langchain-1.2.0-py3-none-any.whl |
|---|---|
| Size | 5.9 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
2a11f2f6179c6bf95b4eccb28e4e836a00c6819baee167be00e54d849d3edfa9
|
|
BLAKE2b-256 checksum How to use checksums |
cde416623d33694fad58ec54d4ba90d74f9f175b2d2ff3aeebffaa8670fb4a7a
|
| 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 May 2, 2026.
Transparency log