Kybernis Python SDK
Project description
Kybernis Python SDK (beta)
This SDK lets multi-agent builders (LangGraph, CrewAI, LangChain) route tool calls through the Kybernis execution gate, emit execution spans, and report tool health/cost.
Install (local dev)
- Add sdk/python to your PYTHONPATH or vendor the package into your app.
- Or set
KYB_SDK_PATHto the absolute path of sdk/python.
Minimal usage
- Set env:
KYB_API_BASE,KYB_API_KEY,KYB_TENANT_ID,KYB_RUN_ID - Enable SDK:
KYB_SDK_ON=1
Audit CLI
- Install the package and run
kybernis-audit templates - Quickstart a local manual audit recipe with
kybernis-audit quickstart --recipe mutation - Create a run with
kybernis-audit run --template-id DARE --source-run-id <run_id> - Replay a run with
kybernis-audit replay --audit-run-id <audit_run_id>
The SDK provides:
KybernisClientfor tool registry, health, events, cost, and gate requests.kyb_tooldecorator to gate tool calls before framework-level HITL.install()auto-patches requests/httpx to inject Kybernis headers.derive_idempotency_key()to match proxy idempotency hashing.span()helpers for non-HTTP execution spans.- Side-effect helpers:
webhook(),email(),charge().
SDK modes (A2A + proxy and A2A + MCP)
You can choose how the SDK routes governance and enforcement:
- Proxy-first: auto install HTTP patches + A2A lifecycle only.
- MCP-first: A2A lifecycle + MCP tools for governance.
- Hybrid: both proxy patches and MCP tools.
Python:
from kybernis import KybernisSDK
sdk = KybernisSDK(agent, mode="hybrid", tool_map={"chat": "kyb.decide"})
Env:
KYB_SDK_MODE=hybrid
KYB_SDK_METHOD_TOOL_MAP={"chat":"kyb.decide"}
Method interception controls
KYB_SDK_AUTO_INTERCEPT=1wrap all public methods on the framework instance.KYB_SDK_PROXY_MODE=1return a proxy object that intercepts methods via__getattr__.KYB_SDK_METHOD_ALLOWLIST=chat,runonly wrap these methods.KYB_SDK_METHOD_BLOCKLIST=render,drawskip these methods.
Env flags
KYB_SDK_ON=1enable SDKKYB_API_BASEcontrol plane base URLKYB_API_KEYauth token (preferred)KYB_API_TOKENauth token (legacy)KYB_TENANT_IDtenant scopeKYB_RUN_IDrun scope (set per run)KYB_SDK_MODE=proxy-first|mcp-first|hybridSDK routing modeKYB_SDK_METHOD_TOOL_MAPJSON map of method name -> MCP tool nameKYB_TOOL_REGISTER=1auto-register toolsKYB_GATE_AUTO_APPROVE=1auto-approve gate unless overriddenKYB_TOOL_CALL_LIMIT=0per-tool call limit (0 = unlimited)KYB_ENFORCE_EGRESS=1fail-closed if HTTP(S)_PROXY is not set
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
kybernis-0.1.4.tar.gz
(51.8 kB
view details)
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
kybernis-0.1.4-py3-none-any.whl
(64.3 kB
view details)
File details
Details for the file kybernis-0.1.4.tar.gz.
File metadata
- Download URL: kybernis-0.1.4.tar.gz
- Upload date:
- Size: 51.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
276537f00defdee684daaaf6e5d9a0ab5bb1e773663c793339aaae9227aae5a0
|
|
| MD5 |
3ae3e92e915e2228ed55e69c1e2ae2a2
|
|
| BLAKE2b-256 |
9a55a7903ee93c5d95436a7b46ca45f7230d58425686214ea6838ecac0775d47
|
File details
Details for the file kybernis-0.1.4-py3-none-any.whl.
File metadata
- Download URL: kybernis-0.1.4-py3-none-any.whl
- Upload date:
- Size: 64.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
2632de58929ee15050d7fc36258caed3ef13f097491f77f7c51f9363021ed4a4
|
|
| MD5 |
a3ebefd17a362a826378be5d7a0db333
|
|
| BLAKE2b-256 |
ad7894cb3c373749452daa477e4f607c9249d0cec40df94cc9cb41b6466ce7b2
|