Skip to main content

Python SDK for HELM — fail-closed tool calling for AI agents

Project description

HELM SDK — Python

Typed Python client for the HELM kernel API. One dependency: httpx.

Install

pip install helm

Quick Example

from helm_sdk import HelmClient, HelmApiError, ChatCompletionRequest, ChatMessage

helm = HelmClient(base_url="http://localhost:8080")

# OpenAI-compatible chat (tool calls governed by HELM)
try:
    res = helm.chat_completions(ChatCompletionRequest(
        model="gpt-4",
        messages=[ChatMessage(role="user", content="List files in /tmp")],
    ))
    print(res.choices[0].message.content)
except HelmApiError as e:
    print(f"Denied: {e.reason_code}")  # e.g. DENY_TOOL_NOT_FOUND

# Export + verify evidence pack
pack = helm.export_evidence()
result = helm.verify_evidence(pack)
print(result.verdict)  # PASS

# Conformance
from helm_sdk import ConformanceRequest
conf = helm.conformance_run(ConformanceRequest(level="L2"))
print(conf.verdict, conf.gates, "gates")

API

Method Endpoint
chat_completions(req) POST /v1/chat/completions
approve_intent(req) POST /api/v1/kernel/approve
list_sessions() GET /api/v1/proofgraph/sessions
get_receipts(session_id) GET /api/v1/proofgraph/sessions/{id}/receipts
export_evidence(session_id?) POST /api/v1/evidence/export
verify_evidence(bundle) POST /api/v1/evidence/verify
replay_verify(bundle) POST /api/v1/replay/verify
conformance_run(req) POST /api/v1/conformance/run
health() GET /healthz
version() GET /version

Error Handling

All errors raise HelmApiError with a typed reason_code:

try: helm.chat_completions(req)
except HelmApiError as e: print(e.reason_code)

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

helm_sdk-0.3.0.tar.gz (32.9 kB view details)

Uploaded Source

Built Distribution

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

helm_sdk-0.3.0-py3-none-any.whl (40.3 kB view details)

Uploaded Python 3

File details

Details for the file helm_sdk-0.3.0.tar.gz.

File metadata

  • Download URL: helm_sdk-0.3.0.tar.gz
  • Upload date:
  • Size: 32.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.11

File hashes

Hashes for helm_sdk-0.3.0.tar.gz
Algorithm Hash digest
SHA256 38c2aa32080b2ba6fb0965368f17da25ed8ce97d79f20697ebf9ed526bcfc795
MD5 c679319c02365efd4718debdd0324bf9
BLAKE2b-256 d48c31c267142f61639446f1e2145688d274f43249c67df731747a97e6b2d8a5

See more details on using hashes here.

File details

Details for the file helm_sdk-0.3.0-py3-none-any.whl.

File metadata

  • Download URL: helm_sdk-0.3.0-py3-none-any.whl
  • Upload date:
  • Size: 40.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.11

File hashes

Hashes for helm_sdk-0.3.0-py3-none-any.whl
Algorithm Hash digest
SHA256 c3c1eb8f23808119d7e5d6dcb028dbe45abec9db4c5499fcd48b4dace066bbc5
MD5 2b22b4144e3ac83b7d80b55e57a17998
BLAKE2b-256 865fdbaf3514f4d50284a87bf139a569b887b08e4a33cf611d34fb67fb72cf94

See more details on using hashes here.

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