Klent SDK for Python — control layer for AI agents
Project description
klent-sdk
The Python SDK for Klent — the control + observability layer for AI agents in production. Wraps every tool call your agent makes through Klent's policy engine: allow, deny, modify, steer to a different tool, or pause for approve (human-in-the-loop, synchronous wait via dashboard or email).
Install
pip install klent-sdk
Or with Anthropic agent helpers:
pip install 'klent-sdk[anthropic]'
Quick start
import os
from klent_sdk import KlentClient, run_tool
klent = KlentClient(api_key=os.environ["KLENT_API_KEY"])
execution = klent.start_execution(agent_id="my-agent")
result = run_tool(
klent,
execution_id=execution["id"],
tool="transfer_funds",
input={"amount": 50_000, "currency": "USD"},
execute=lambda inp: transfer_funds(**inp),
approval={"wait": {"timeout_ms": 30 * 60_000}},
)
if result["status"] == "allowed":
print("output:", result["output"])
elif result["status"] == "denied":
print("blocked:", result["reason"])
The approval.wait kwarg makes run_tool block synchronously until a human resolves the action on the dashboard (or via the email Resend sends with Approve / Reject buttons), then runs the tool and returns its output.
Full docs at klent.dev/docs.
Anthropic agent helper
A higher-level orchestrator runs an Anthropic agent loop with every tool call gated through Klent:
from anthropic import Anthropic
from klent_sdk import KlentClient
from klent_sdk.anthropic import run_anthropic_agent
result = run_anthropic_agent(
anthropic=Anthropic(),
klent=KlentClient(api_key=...),
agent_id="research-agent",
system="You are a helpful research assistant...",
tools=[...],
user_message="Find the top 3 things...",
)
See klent_sdk/anthropic.py for the full surface.
Develop
git clone https://github.com/klentlabs/klent-sdk-python.git
cd klent-sdk-python
python -m venv .venv && source .venv/bin/activate
pip install -e '.[dev]'
pytest
Publishing
Tag sdk-py-vX.Y.Z → .github/workflows/publish-sdk-python.yml builds wheel + sdist and publishes to PyPI via OIDC trusted publisher. No tokens stored — auth is the GitHub Actions OIDC id-token verified against PyPI's trusted-publisher config for this repo.
Project
- Product, docs, dashboard: klent.dev
- Issues for this SDK: this repo
- Issues for the API, dashboard, or product: hello@klent.dev
- TypeScript SDK, MCP server, starter policies, examples: klentlabs/klent-sdk-ts
License
Apache-2.0. See LICENSE.
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 klent_sdk-0.0.2a1.tar.gz.
File metadata
- Download URL: klent_sdk-0.0.2a1.tar.gz
- Upload date:
- Size: 18.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b990abd94f8fd0767e3706cc898a5a28f71cc16127213ad4a0e507dae16844c1
|
|
| MD5 |
c6f2916ee850e54858a30845278f2eaa
|
|
| BLAKE2b-256 |
aefdc04912281a731b8cf5686aa1525bb5f42ebe4845a2c042b4f3c6ad5d96e9
|
Provenance
The following attestation bundles were made for klent_sdk-0.0.2a1.tar.gz:
Publisher:
publish-sdk-python.yml on klentlabs/klent-sdk-python
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
klent_sdk-0.0.2a1.tar.gz -
Subject digest:
b990abd94f8fd0767e3706cc898a5a28f71cc16127213ad4a0e507dae16844c1 - Sigstore transparency entry: 1519638085
- Sigstore integration time:
-
Permalink:
klentlabs/klent-sdk-python@b5bb6558ff6c5ecb6df3ddcc0694496bf90389d0 -
Branch / Tag:
refs/tags/sdk-py-v0.0.2a1 - Owner: https://github.com/klentlabs
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish-sdk-python.yml@b5bb6558ff6c5ecb6df3ddcc0694496bf90389d0 -
Trigger Event:
push
-
Statement type:
File details
Details for the file klent_sdk-0.0.2a1-py3-none-any.whl.
File metadata
- Download URL: klent_sdk-0.0.2a1-py3-none-any.whl
- Upload date:
- Size: 15.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
3c3bbd210c7baa23bbaac233056e7ec3030ca06bba7c4992d1ec4d8a15f4ca73
|
|
| MD5 |
c39ecaa527f40ef55ff8bc4c41c702c8
|
|
| BLAKE2b-256 |
9496802e9409c92137bde711b378144936c6c26959ccb1027125ee186f14cb89
|
Provenance
The following attestation bundles were made for klent_sdk-0.0.2a1-py3-none-any.whl:
Publisher:
publish-sdk-python.yml on klentlabs/klent-sdk-python
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
klent_sdk-0.0.2a1-py3-none-any.whl -
Subject digest:
3c3bbd210c7baa23bbaac233056e7ec3030ca06bba7c4992d1ec4d8a15f4ca73 - Sigstore transparency entry: 1519638092
- Sigstore integration time:
-
Permalink:
klentlabs/klent-sdk-python@b5bb6558ff6c5ecb6df3ddcc0694496bf90389d0 -
Branch / Tag:
refs/tags/sdk-py-v0.0.2a1 - Owner: https://github.com/klentlabs
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish-sdk-python.yml@b5bb6558ff6c5ecb6df3ddcc0694496bf90389d0 -
Trigger Event:
push
-
Statement type: