Skip to main content

Official public Python SDK for interacting with Keyhole governance runtimes

Project description

keyhole-sdk

Python SDK for interacting with Keyhole-compatible runtimes.

Install

pip install keyhole-sdk

Quickstart

from keyhole_sdk import KeyholeClient

client = KeyholeClient(base_url="http://localhost:8080")

# Health check
print(client.health())

# Runtime identity and capabilities
identity = client.identity()
print(identity)

# Current runtime state
print(client.state())

# Submit a realization request
receipt = client.realize(
    candidate_digest="sha256:abc123",
    payload={},
)
print(receipt)

# Replay the same digest safely
replay = client.realize(
    candidate_digest="sha256:abc123",
    payload={},
)
print(replay)

client.close()

Note: By default the test runtime runs in local-only mode — realization is not gated through MCP governance. Set KEYHOLE_MCP_URL and KEYHOLE_MCP_TOKEN on the runtime to enable governed mode.

API

Method Description
health() GET /healthz — runtime liveness
identity() GET /identity — runtime identity and capabilities
state() GET /state — current runtime-local state
realize(candidate_digest, payload) POST /realize — bounded realization request
close() Close the underlying HTTP session

Models

Pydantic models are available in keyhole_sdk.models:

  • RuntimeIdentity
  • RuntimeState
  • RealizationRequest
  • RealizationReceipt

Configuration

client = KeyholeClient(
    base_url="http://localhost:8080",
    timeout=10.0,  # default
)

You can also pass a custom requests.Session for advanced use cases.

Compatibility

RuntimeBridgeClient is available as a backward-compatible alias for KeyholeClient.

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

keyhole_sdk-0.4.1.tar.gz (209.6 kB view details)

Uploaded Source

Built Distribution

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

keyhole_sdk-0.4.1-py3-none-any.whl (290.7 kB view details)

Uploaded Python 3

File details

Details for the file keyhole_sdk-0.4.1.tar.gz.

File metadata

  • Download URL: keyhole_sdk-0.4.1.tar.gz
  • Upload date:
  • Size: 209.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.3

File hashes

Hashes for keyhole_sdk-0.4.1.tar.gz
Algorithm Hash digest
SHA256 c23c280ffe8cbd94bf1db25a4a3e9e5f3ac65b4a931e5787556d0e5c892d2ecb
MD5 bd4f2645ef7f925437c48152155008bd
BLAKE2b-256 5b772c17b16a5ef51feb2e272f156dbec20d80e2400a5d51cc2fb3a43608612e

See more details on using hashes here.

File details

Details for the file keyhole_sdk-0.4.1-py3-none-any.whl.

File metadata

  • Download URL: keyhole_sdk-0.4.1-py3-none-any.whl
  • Upload date:
  • Size: 290.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.3

File hashes

Hashes for keyhole_sdk-0.4.1-py3-none-any.whl
Algorithm Hash digest
SHA256 e06bbb305057dfc3797960923ef39217ce9bb337433076c897f29138c4c0de0f
MD5 eec82098ea069572e67cade25e335832
BLAKE2b-256 b51d50b0a94399f33f90225d3b5ae0e0e47e96a7e1845ce03ae86eb35232f3b0

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