HTBP (HTTP Tool Bridge Protocol) server SDK: expose functions as self-describing HTTP tool endpoints, FastAPI-style.
Project description
htbp-sdk
HTBP (HTTP Tool Bridge Protocol) server SDK for Python. Expose functions as self-describing HTTP tool endpoints, FastAPI-style. Pure ASGI — runs under uvicorn/hypercorn and mounts inside FastAPI or Starlette.
Install
pip install htbp-sdk # import name: htbp
pip install 'htbp-sdk[remote]' # + httpx, needed only for app.remote()
Quickstart
from htbp import Htbp
app = Htbp(title="Math tools")
@app.tool(effect="read")
def add(a: int, b: int = 0) -> int:
"""Add two integers."""
return a + b
uvicorn main:app
Input schemas are derived from type hints via pydantic (FastAPI-style); a
single parameter annotated with a BaseModel subclass uses that model as the
body schema directly. Async functions are awaited; sync functions run in a
thread. A ToolContext-annotated parameter receives request context.
Every node answers GET {path}/~help (JSON by default, RFC-0001 text DSL with
Accept: text/plain); tools are invoked with POST {path} and respond with
{"resource", "result"}.
Cascading
docs = Htbp(title="Docs tools")
@docs.tool()
def search(q: str) -> dict:
return {"hits": [q]}
app.mount("/docs", docs) # local nesting
app.remote("/ext", "https://other.example.com/~help") # federate a remote HTBP server
Remote nodes pass through ~help for any sub-path and proxy calls; the inbound
Authorization header is never forwarded upstream.
Mount inside FastAPI:
fastapi_app.mount("/tools", app)
Options
Htbp(
title="My tools",
description="...",
auth={"bearer_token": "..."}, # 401 + WWW-Authenticate without it
skill="# Markdown served at /~skill",
base_path="/htbp", # serve under a path prefix
cors=False, # CORS is on by default
)
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file htbp_sdk-0.1.0.tar.gz.
File metadata
- Download URL: htbp_sdk-0.1.0.tar.gz
- Upload date:
- Size: 17.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.11.2 {"installer":{"name":"uv","version":"0.11.2","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
33cde36f69a83eb6c28b4b2b3343e11a74adfa169544671b89c69f5f391ce77a
|
|
| MD5 |
f793c1729b4f8799ee55ae56fb77d404
|
|
| BLAKE2b-256 |
9b0fb473faaab40da76127ae4039f5c1243ad8deacbc94b4633026f8f5542de1
|
File details
Details for the file htbp_sdk-0.1.0-py3-none-any.whl.
File metadata
- Download URL: htbp_sdk-0.1.0-py3-none-any.whl
- Upload date:
- Size: 16.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.11.2 {"installer":{"name":"uv","version":"0.11.2","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
787d00f816b9b51af96dfffc1c395904a1d4419e18995dbb082ee473625d7e31
|
|
| MD5 |
e9652370e0b8f510400dd2fba4319a5f
|
|
| BLAKE2b-256 |
4e6b9408770bb7d19e50b24da3eb9f5f23ee6e35140a7efa4549c8aa5bbe8b66
|