First public release of an agentic runtime for M2M coordination. Machines coordinate, verify, and settle value autonomously.
Project description
Kernell OS SDK
Policy-driven execution infrastructure for agent systems
Kernell OS SDK is not a simple LLM wrapper.
It is an execution control plane that optimizes inference cost, quality, and latency while collecting feedback to improve routing decisions over time.
What This SDK Is
- Policy-driven inference engine
- Multi-tier execution router (local, cheap API, premium API)
- Quality-aware runtime with verification and safe fallback
- Telemetry + labeling + training pipeline for continuous improvement
- Agent runtime foundation (security, sandboxing, economics, marketplace, governance)
What This SDK Is Not
- Prompt utility library
- Single-model client wrapper
- Static rule router without learning loop
Core Value Proposition
Traditional flow:
input -> one LLM
Kernell OS flow:
input -> policy decision -> multi-layer execution -> verification -> telemetry -> retraining
Why this matters
- Optimize costs without blindly degrading quality
- Route dynamically per task/hardware/risk
- Learn from production behavior (data flywheel)
- Keep fallback safety under uncertainty
Architecture Overview
Task Input
-> Policy Model (Lite/Pro)
-> (Optional) Task Decomposition
-> Execution Layers:
[Semantic Cache] -> [Local] -> [Cheap API] -> [Premium]
-> Self Verification
-> Re-route / Fallback (if needed)
-> Telemetry
-> Offline Labeling
-> Dataset / Fine-tuning Pipeline
Routing Strategy
The router is policy-driven, not difficulty-only:
route:local | cheap | premium | hybridconfidenceriskexpected_cost_usdexpected_latency_sneeds_decomposition
When confidence/risk/economic uncertainty is unsafe, it forces hybrid fallback path.
Main Components (Real Modules)
Router and Policy
kernell_os_sdk/router/intelligent_router.py
Orchestrates execution across cache/local/cheap/premium, verification, telemetry.kernell_os_sdk/router/policy_lite.py
Local policy model client with safety overrides.kernell_os_sdk/router/classifier_pro.py
Cloud escalation client for higher-precision routing.kernell_os_sdk/router/types.py
Canonical contracts (PolicyDecision, tiers, results).kernell_os_sdk/router/entrypoint.py
Shadow/canary/full rollout entrypoint with safe fallback.
Quality, Cost, and Context
kernell_os_sdk/router/verifier.py(SelfVerifier)kernell_os_sdk/router/estimator.py(CostEstimator)kernell_os_sdk/router/summarizer.py(RollingSummarizer)kernell_os_sdk/router/decomposer.py(TaskDecomposer)kernell_os_sdk/router/model_registry.py(ModelRegistry)
Telemetry and Learning Loop
kernell_os_sdk/router/telemetry_collector.py
Collects anonymized route/outcome/quality signals.kernell_os_sdk/router/offline_labeler.py
Produces optimal-route labels from real outcomes (cost + quality aware).
Data Pipeline Scripts
scripts/policy_build_dataset.py-> telemetry to labeled datasetscripts/policy_make_sft_jsonl.py-> labeled dataset to SFT JSONLscripts/policy_train_lora.py-> LoRA training scaffoldscripts/policy_audit_dataset.py-> distribution and sampling audit
Runtime, Security, and Infra Domains
kernell_os_sdk/runtime/
Firecracker/Docker/Subprocess/hybrid runtime primitiveskernell_os_sdk/security/
policy, verifier, SSRF and capability controlskernell_os_sdk/cognitive/
memory graph, execution graph, semantic moduleskernell_os_sdk/marketplace/,governance/,cluster/,delegation/,escrow/
economic coordination and distributed agent primitives
Data Flywheel
Kernell OS improves routing through a closed learning loop:
- Runtime emits telemetry from real executions
- Offline labeler computes optimal route targets
- Dataset is generated and audited
- Model fine-tuning is prepared/executed
- Updated policy models are deployed
This converts routing mistakes into training signal (underestimation, overestimation, misroute) and enables continuous optimization.
Safety and Production Hardening
- Verification-aware routing to reduce low-quality escalations
- Risk-aware and budget-aware fallback to
hybrid - Optional Prometheus dependency (non-blocking no-op fallback in runtime metrics)
- Shadow/canary rollout strategy before full traffic cutover
- Rate limiting, sandbox controls, and capability policy modules available in SDK
Installation
pip install kernell-os
Optional observability dependency:
pip install prometheus_client
Minimal Example
from kernell_os_sdk.router import PolicyLiteClient, PolicyLiteConfig
# Integrate PolicyLiteClient into your IntelligentRouter wiring
# based on your local model backend and runtime configuration.
See kernell_os_sdk/router/ modules and tests for concrete integration patterns.
Testing
Router and flywheel suites:
python -m pytest tests/test_router.py tests/test_data_flywheel.py tests/test_policy_lite.py -q
Containerized "real client" validation
Use this when you want to verify the same path as an external developer:
installing the SDK with pip in a clean environment, not from local source.
cd kernell-os-sdk
docker compose -f deploy/docker-compose.sdk-client.yml up --build --abort-on-container-exit
What this stack validates:
- Clean installation from package index (
SDK_PIP_SPEC, defaultkernell-os-sdk) - SDK import sanity from installed distribution
- CLI availability (
kernell --help) - Minimal router execution path (
IntelligentRouter.execute(...)) with deterministic mock backend - Telemetry capture signal (
TelemetryCollector) to protect the data-flywheel contract - Policy signal presence in telemetry (
policy_route_predicted) to catch policy integration regressions - Graceful failure-mode path (no local models configured) without process crash
- Baseline service dependencies (
redis+qdrant) reachable in compose network - Structured CI-friendly report (JSON line with
install/import/cli/router/telemetry/policy/failure_mode)
Useful overrides:
# Test a pinned prerelease/build
SDK_PIP_SPEC='kernell-os-sdk==2.2.0b1' \
docker compose -f deploy/docker-compose.sdk-client.yml up --build --abort-on-container-exit
# If distribution name differs on your package index:
SDK_DISTRIBUTION_NAME='kernell-os-sdk' \
docker compose -f deploy/docker-compose.sdk-client.yml up --build --abort-on-container-exit
# Disable failure-mode probe when needed:
SDK_SMOKE_FAILURE_MODE=0 \
docker compose -f deploy/docker-compose.sdk-client.yml up --build --abort-on-container-exit
# Optional: check expected telemetry artifact path too
KERNELL_TELEMETRY_PATH=/tmp/kernell_telemetry/telemetry_buffer_latest.jsonl \
docker compose -f deploy/docker-compose.sdk-client.yml up --build --abort-on-container-exit
Cleanup:
docker compose -f deploy/docker-compose.sdk-client.yml down -v
Chaos profile (optional, antifragility checks)
Run the dedicated chaos profile without blocking regular PR validation:
docker compose -f deploy/docker-compose.sdk-client.yml --profile chaos up --build --abort-on-container-exit sdk-client-chaos
Chaos profile expectations:
install/import/cli/telemetry/policy/failure_modestayokdegradedistrue(degradation is detected and reported, not hidden)- controlled degradation is acceptable; process crash is not
Current Status
Implemented now
- Policy-driven router integration
- Telemetry v2 with policy signals
- Offline labeling pipeline with quality-aware guards
- Dataset audit tooling and sampling workflow
- Regression-tested router/flywheel suites
Planned / in progress
- Persistent semantic cache backend integration (distributed)
- Full training automation and model promotion gates
- Expanded online feedback correction and deploy gating benchmarks
Open-Core Positioning
- SDK core: open source runtime and routing foundations
- Advanced policy intelligence and cloud services: source-available/commercial layers
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file kernell_os_sdk-2.3.0.tar.gz.
File metadata
- Download URL: kernell_os_sdk-2.3.0.tar.gz
- Upload date:
- Size: 4.5 MB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ce5c492f257789b694706c06c5cd69e6093b69792f49544e0c68edc8b68d0e5c
|
|
| MD5 |
1cb58e5c13e81f4be2e93916636a4f2b
|
|
| BLAKE2b-256 |
598e9548c5b0646c6a560fb4cb0e42e94becb012409ad4b01169a292be98b486
|
File details
Details for the file kernell_os_sdk-2.3.0-py3-none-any.whl.
File metadata
- Download URL: kernell_os_sdk-2.3.0-py3-none-any.whl
- Upload date:
- Size: 3.7 MB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d728dbf387bc534c7bc8cce4a1e78db72408647f1db445a242da38086e6526d1
|
|
| MD5 |
cfc5cd419ef8a397f9530b8805c2b3e0
|
|
| BLAKE2b-256 |
1ab72dad37b055fed92071ca47732a1e8f11580f523428c9c1489137883de57e
|