Python wrapper for the public governance surface of AIKernel.Control.
The stable package is published to PyPI:
pip install aikernel-governanceThe distribution name is aikernel-governance. Import the module as
aikernel_governance.
aikernel-governance exposes the public AIKernel.Control contract boundary as a
single Python API:
- execution request, result, and snapshot envelopes
- provider contract metadata
- Bonsai provider, tokenizer, model config, and model-state wrappers
- emulator graph, node, scheduler, policy, and engine wrappers
- CPU kernel wrapper
- diagnostics replay approval wrapper
- GPU delegate contract loader
- managed assembly discovery and pythonnet loading
The package does not provide a separate Python implementation of governance semantics. It does not expose internal engine helpers, transport-specific logic, OS-specific implementations, or private runtime state.
The wheel bundles the public Control and contract assemblies under
aikernel_governance/native:
AIKernel.Abstractions.dllAIKernel.Dtos.dllAIKernel.Enums.dllAIKernel.Control.Core.dllAIKernel.Control.CPU.dllAIKernel.Control.Diagnostics.dllAIKernel.Control.Emulator.dllAIKernel.Control.GPU.dll
governance_assemblies() resolves bundled assemblies first, then paths from
AIKERNEL_GOVERNANCE_ASSEMBLY_PATH, then matching packages from the NuGet
global-packages cache.
load_governance_runtime() loads the resolved assemblies through pythonnet.
from aikernel_governance import (
ExecutionRequest,
ExecutionResult,
Snapshot,
ProviderContract,
GovernanceClient,
)Example:
from aikernel_governance import ExecutionRequest, GovernanceClient
request = ExecutionRequest(
model="bonsai-1.7b",
input="hello",
parameters={"execution_id": "exec-001"},
)
client = GovernanceClient(backend)
result = client.submit(request)
snapshot = client.snapshot("exec-001")backend must provide the governance operations used by the client:
submit(request)snapshot(id)result(id)
When pythonnet is available, wrappers can be converted to public C# DTOs with
to_managed().
cd C:\Users\HP\source\repos\AIKernel-NET\AIKernel.Control
dotnet test AIKernel.Control.slnx -c Release --no-restore
dotnet pack AIKernel.Control.slnx -c Release --no-restore
cd python
py -m pytest
py -m build --wheel
py -m twine check dist\aikernel_governance-0.1.1-py3-none-any.whlFor source-based local validation, use a clean virtual environment:
pip install --force-reinstall \
git+https://github.com/AIKernel-NET/AIKernel.Control.git#subdirectory=python