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.0.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.0-py3-none-any.whl (290.7 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: keyhole_sdk-0.4.0.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.0.tar.gz
Algorithm Hash digest
SHA256 7038739b6820f826c0498dcb62ed289e4062e0abdb90ad17c503733708561fbd
MD5 f9dce8e797b9ae9d06e103aaacb97236
BLAKE2b-256 2531712d3253cbb499cf4678924726b01e9f391e2a866329fb76982f9cb7ce76

See more details on using hashes here.

File details

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

File metadata

  • Download URL: keyhole_sdk-0.4.0-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.0-py3-none-any.whl
Algorithm Hash digest
SHA256 14023244b08ec688ba66804de1944deea08eb5363a3ede4b5810fce6e164c668
MD5 265a6bc20cf976823164bf390068e4ab
BLAKE2b-256 e98a3d529d305ce16761e5b0b5b1d789710e96f5b49e5de912c6f1ffadf4254f

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