Skip to main content

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).

PyPI Python License

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/verbosedigital/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

License

Apache-2.0. See LICENSE.

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

klent_sdk-0.0.2a0.tar.gz (18.2 kB view details)

Uploaded Source

Built Distribution

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

klent_sdk-0.0.2a0-py3-none-any.whl (15.9 kB view details)

Uploaded Python 3

File details

Details for the file klent_sdk-0.0.2a0.tar.gz.

File metadata

  • Download URL: klent_sdk-0.0.2a0.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

Hashes for klent_sdk-0.0.2a0.tar.gz
Algorithm Hash digest
SHA256 059a8ec3fb45b1c16228546e9fff2db8ebc99309a84b42ddf34696b079b91e43
MD5 93971315531b44a14540e2cf60a4ceed
BLAKE2b-256 9fea4e11c0392bd2d14ceabced8d47a7d63877849eda42b20df1e8538de458ad

See more details on using hashes here.

Provenance

The following attestation bundles were made for klent_sdk-0.0.2a0.tar.gz:

Publisher: publish-sdk-python.yml on verbosedigital/klent-sdk-python

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

File details

Details for the file klent_sdk-0.0.2a0-py3-none-any.whl.

File metadata

  • Download URL: klent_sdk-0.0.2a0-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

Hashes for klent_sdk-0.0.2a0-py3-none-any.whl
Algorithm Hash digest
SHA256 1877a29dd355d20fc64f6bff06534165b7c0f2bc579b2206cf8ede7044bcdede
MD5 24530ac65b992d1c2c2fd2dac584a024
BLAKE2b-256 147ce3deddd548cfff4af2ecdfd734cd669f4e1deb19258690672cbe23c47995

See more details on using hashes here.

Provenance

The following attestation bundles were made for klent_sdk-0.0.2a0-py3-none-any.whl:

Publisher: publish-sdk-python.yml on verbosedigital/klent-sdk-python

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