Skip to main content

EN | ES | RU

Holonode SDK

License: MPL 2.0 PyPI Version Python 3.11+

Holonode SDK is the official high-performance Python SDK for building distributed execution nodes (Workers / Holons) compatible with the Holarchy orchestrator. It serves as an execution node (Shell) in a Holarchical Logic Network (HLN), coordinating with the orchestrator (Ghost) via the RXON (Reverse Axon Protocol).

The SDK automates all low-level communication concerns: task polling, dynamic registration, heartbeats, S3 payload management, Zero Trust authentication, and graceful shutdown.

🚀 Key Features

  • Language: Python 3.11+
  • Protocol: Native support for RXON (Reverse Axon Protocol) for HLN (Holarchical Logic Network).
  • Communication Model:
    • PULL: Workers poll tasks from orchestrators (operates securely behind NAT/Firewall without public incoming ports).
    • WebSocket: Optional real-time bidirectional command channel (task cancellation, custom runtime commands).
  • Zero Trust Security & Policy Enforcement:
    • Mandatory HMAC-SHA256 signing for all worker messages using WORKER_TOKEN.
    • Cryptographic verification of orchestrator_signature (sig) on incoming tasks via ORCHESTRATOR_SECRET_KEY.
    • Strict enforcement of allowed_skills task execution policies.
    • Automatic collection and reporting of task execution cost metrics (costs).
    • Identity Chain and Origin Worker ID support for provenance tracking across infinite holarchy layers.
    • Replay protection with timestamp validation.
    • Supply Chain Security & Attestation Verification (holonode.attestation): Configurable verification of OCI 1.1 Referrers metadata (REQUIRE_ATTESTATION, MIN_SLSA_LEVEL, TRUSTED_ATTESTATION_KEYS), validating SBOM/provenance artifact types, SLSA levels, and Ed25519 signatures before mounting skills.
  • Dynamic Skill Mounting (SkillMounter):
    • Mounts and unmounts versioned namespace/name skills at startup (INITIAL_SKILL_MANIFESTS), programmatically, or via orchestrator heartbeat sync (mounted_manifests, mount_digests, desired_skills, unmount_digests).
    • Fetches deterministic .tar.zst CAS bundles and manifests from HoloReg (HOLOREG_URL) with local SHA-256 caching (LocalBlobCache), asset symlinking, and isolated venv environments (env_digest).
  • Traffic & Performance Optimization:
    • Telemetry Throttling (Heartbeat Deadband): Hardware telemetry (CPU/RAM/GPU) is only sent when a value changes by >5% or after a 60s forced interval, drastically saving network bandwidth.
    • ETag-Based Blob Caching: Heavy assets (e.g. AI model weights) are downloaded only once from S3, cached locally with ETag validation, and symlinked to task workspaces.
    • Async Results Uploader: Task results are queued via non-blocking asyncio.Queue with automatic retries and exponential backoff, instantly freeing the worker for the next task.
    • 3-Tier Skill Lifecycle: Supported (catalog), Available (dynamic limits), and Hot (cached in memory/VRAM).
    • Stable Hashing: Sends full skill catalog only when changed, using skills_hash for ultra-light heartbeats.
  • S3 Streaming: High-performance payload streaming using obstore. Zero OOM on large files.
  • AI-Agent Support: Supports Chain of Thought and Tool Use via OrchestratorClient dependency injection for subtask delegation.
  • Hardware Awareness: Built-in monitoring for CPU, RAM, and NVIDIA GPUs (via psutil and GPUtil).
  • Modern Observability:
    • Native distributed tracing and metrics with OpenTelemetry.
    • Automatic Trace Context Propagation: Extracts trace_id from tasks and propagates it to all events and child spans.
    • OTLP metrics push export via OTEL_EXPORTER_OTLP_ENDPOINT.

Table of Contents

Core Architecture: Orchestrators and Workers

Holonode SDK implements the execution tier of a Holarchical Logic Network (HLN):

  • Orchestrator: Manages workflow state machines (Blueprints), tracks job lifecycles, and coordinates tasks. The orchestrator acts as a passive HTTP server and never initiates outbound connections to workers.
  • Worker: An autonomous execution node. It establishes reverse HTTP polling connections to the orchestrator, registers supported skills and hardware capabilities, pulls assigned tasks into isolated workspaces, and posts results asynchronously.
  • Hierarchical Composition: Standardized contracts allow an entire orchestrator instance to be wrapped inside a worker interface, enabling recursive multi-level task delegation across distributed clusters.

Ecosystem

Holonode SDK is an integral part of the Holarchy distributed ecosystem:

  • Holarchy Orchestrator: High-performance state-machine workflow engine coordinating tasks and distributed blueprints.
  • RXON Protocol: Shared lightweight reverse-connection protocol powering inter-node communication across the HLN ecosystem.
  • HLN (Holarchical Logic Network): Architectural pattern, manifesto, and design specification for self-similar holarchies.
  • Holonode SDK: The official Python SDK for building execution workers (this repository).
  • Full Example: Reference project demonstrating the orchestrator and workers in action.

Installation

  • Install the core SDK only:

    pip install holonode
    
  • Install with S3 payload offloading support:

    pip install "holonode[s3]"
    
  • Install with Pydantic v2 schema inference support:

    pip install "holonode[pydantic]"
    
  • Install with OpenTelemetry metrics and tracing:

    pip install "holonode[metrics]"
    
  • Install all production features (Recommended):

    pip install "holonode[s3,pydantic,metrics]"
    
  • Install for development:

    pip install -e ".[dev]"
    

Quick Start

Usage as a Library

from pydantic import BaseModel, Field
from holonode import OrchestratorClient, TaskFiles, Worker


class GreetingParams(BaseModel):
    name: str = Field(default="World", description="Name to greet")


worker = Worker(worker_type="greeter-service")


@worker.skill("hello_world", risk="low", permissions=["greetings:write"])
async def my_skill(params: GreetingParams, files: TaskFiles):
    """The SDK validates incoming task data directly into GreetingParams."""
    return {"message": f"Hello, {params.name}!"}


@worker.skill("ai_agent_reasoning", risk="medium", permissions=["ai:reason"])
async def agent_skill(params: dict, orchestrator_client: OrchestratorClient):
    """AI agent skill delegating a subtask (tool use) via OrchestratorClient."""
    search_result = await orchestrator_client.call_skill("web_search", {"query": params["search_query"]})
    return {"result": f"Based on web search: {search_result['data']}"}


@worker.on_command("reboot")
async def handle_reboot(command: dict):
    """Custom command received over the real-time WebSocket channel."""
    print("Rebooting worker...")


if __name__ == "__main__":
    worker.run()

For step-by-step guidance, see the Local Worker Development Cookbook.

CLI Usage

The SDK includes a built-in CLI for running workers, inspecting skills, and local debugging:

# Run the worker with health-check server (port 8083 by default)
worker run --app my_worker:worker

# Run with terminal statusline HUD
worker run --app my_worker:worker --hud

# Run on a custom port without health check
worker run --app my_worker:worker --port 9000 --no-health-check

# Run with auto-reload on code changes
worker run --app my_worker:worker --reload

# Execute a single skill locally in an isolated sandbox (no orchestrator required)
worker exec --app my_worker:worker --skill hello_world --params '{"name": "Alice"}'
worker exec --app my_worker:worker --skill hello_world --params @params.json

# Inspect registered skills, risk levels, and permissions
worker inspect --app my_worker:worker
worker inspect --app my_worker:worker --json
worker inspect --app my_worker:worker --skill hello_world

# Start local web testbench for manual skill testing
worker dev --app my_worker:worker --port 8088

Dynamic Skill Mounting

Holonode SDK supports hot-mounting and unmounting skills from Content-Addressable Storage (CAS) manifests via SkillMounter without restarting the worker process:

  • Startup: Set INITIAL_SKILL_MANIFESTS='["sha256:..."]' to mount bundles automatically during Worker.load_skills().
  • Heartbeat Sync: Workers report mounted_manifests in heartbeats, and orchestrators can push mount_digests (or desired_skills) and unmount_digests in heartbeat responses.
  • Programmatic API: Call await worker.mount_skills([...]), await worker.unmount_skills([...]), or worker.get_mounted_manifests().
  • CAS Cache & Isolation: Bundles (.tar.zst in portable mode) and assets are cached in ~/.hln/cache/blobs/sha256, unpacked into ~/.hln/mounted/, symlinked for large assets, and isolated per env_digest in ~/.hln/venvs/.
  • Attestation Enforcement: Configure REQUIRE_ATTESTATION, MIN_SLSA_LEVEL, and TRUSTED_ATTESTATION_KEYS to verify OCI 1.1 Referrers before loading skill code.

See Step 12 of the Development Guide for full examples and manifest details.

Configuration Reference

All settings can be configured via environment variables:

Variable Type Default Description
ORCHESTRATOR_URL String http://localhost:8080 Fallback URL when connecting to a single orchestrator
ORCHESTRATORS_CONFIG JSON String None JSON list of orchestrator configs (url, priority, weight)
MULTI_ORCHESTRATOR_MODE String WATERFALL Polling strategy: WATERFALL (priority order) or ROUND_ROBIN
WORKER_ID String Auto-generated Unique identifier for the worker instance
WORKER_TYPE String generic-cpu-worker Type tag for skill matching and targeting
WORKER_PORT Integer 8083 Port for the built-in HTTP health check probe (/health)
WORKER_ENABLE_HUD Boolean False Enable statusline TUI HUD in terminal
WORKER_TOKEN String None Secret token used for HMAC-SHA256 message signing (Zero Trust)
ORCHESTRATOR_SECRET_KEY String None Secret key used to verify incoming task signatures (sig)
REQUIRE_TASK_SIGNATURE Boolean True Enforce signature verification when ORCHESTRATOR_SECRET_KEY is set
COST_PER_SKILL JSON String None JSON mapping of skill execution tariffs (e.g. '{"render": 0.05}')
MAX_CONCURRENT_TASKS Integer 10 Global concurrency limit for parallel task executions
WORKER_ENABLE_WEBSOCKETS Boolean False Enable real-time WebSocket connection for commands and cancellation
WORKER_SKILLS_DIR String skills Directory for auto-discovered SkillBlueprint modules
INITIAL_SKILL_MANIFESTS JSON List [] JSON list of manifest digests to mount via SkillMounter at startup
HOLOREG_URL String http://localhost:8080 HoloReg registry URL for fetching CAS skill bundles and manifests
HOLOREG_TOKEN String None Optional Bearer token for authenticating with HoloReg
REQUIRE_ATTESTATION Boolean False Enforce attestation verification (holonode.attestation) before mounting skills
MIN_SLSA_LEVEL Integer 0 Minimum required SLSA provenance level when mounting skills
TRUSTED_ATTESTATION_KEYS JSON String None JSON list or mapping of trusted Ed25519 PEM public keys for attestation verification
HEARTBEAT_INTERVAL Float 15.0 Interval (seconds) between periodic worker heartbeats
WORKER_HEARTBEAT_COOLDOWN Float 2.0 Minimum cooldown (seconds) between debounced heartbeats
RATE_LIMIT_BACKOFF_FLOOR Float 30.0 Minimum backoff delay (seconds) on HTTP 429 without Retry-After
IDLE_POLL_DELAY Float 0.5 Delay (seconds) between polling cycles when no tasks are available
WORKER_SHUTDOWN_TIMEOUT Float 30.0 Maximum time (seconds) to wait for active tasks during graceful shutdown
WORKER_ENABLE_METRICS Boolean False Enable OpenTelemetry tracing and metrics collection
S3_ENDPOINT_URL String None S3-compatible storage endpoint URL for payload offloading
S3_ACCESS_KEY String None S3 access key ID
S3_SECRET_KEY String None S3 secret access key
S3_DEFAULT_BUCKET String None Default S3 bucket for task file transfers
WORKER_BLOB_CACHE_DIR String /tmp/holarchy_cache Local directory for caching S3 blobs with ETag validation
TASK_FILES_DIR String /tmp/payloads Local base directory for isolated task workspace files
WORKER_TELEMETRY_DEADBAND Float 5.0 Percentage change threshold for emitting hardware telemetry
WORKER_TELEMETRY_FORCE_INTERVAL Float 60.0 Maximum interval (seconds) before telemetry is forcefully emitted
POLL_BACKOFF_INITIAL Float 1.0 Initial delay (seconds) after network error or 429 response
POLL_BACKOFF_MAX Float 60.0 Maximum backoff delay (seconds)
POLL_BACKOFF_FACTOR Float 2.0 Multiplier for exponential backoff calculations
STRICT_EVENT_VALIDATION Boolean True Validate emitted events against protocol schemas before dispatch
LOG_LEVEL String INFO Logging verbosity (DEBUG, INFO, WARNING, ERROR)

Resilience & Connectivity

  • Independent Orchestrator Managers: Each orchestrator connection is handled by an isolated background task. Outages or rate limits on one orchestrator never block others.
  • Smart Backoff & Retry Storm Protection: Unified exponential backoff honors the HTTP Retry-After header (seconds or HTTP date). Errors with status 429 without Retry-After enforce a mandatory 30-second safety floor to prevent retry storms.
  • Heartbeat Debouncing: Throttles heartbeats to a maximum of once every 2 seconds. State updates during the cooldown are coalesced and dispatched cleanly.
  • Graceful Shutdown: Handles SIGINT and SIGTERM cleanly, awaiting active task completion and notifying orchestrators prior to process exit.

Observability

Holonode SDK provides first-class observability using OpenTelemetry:

  • Distributed Tracing: Workers extract trace_id from tasks and create child spans (task.{type}). All emitted events and S3 operations share the same trace.
  • Push Metrics (OTLP): When OTEL_EXPORTER_OTLP_ENDPOINT is configured, metrics are automatically exported via OTLP.
  • ObservabilityManager Injection: Handlers can accept obs: ObservabilityManager to create custom sub-spans and attach diagnostic metadata.

Security

Security is foundational to the Holarchy ecosystem:

Contributing

We welcome contributions! Please review our Contributor Guide and Development Guide for environment setup and testing instructions.

License

This project is licensed under the Mozilla Public License 2.0 (MPL 2.0).

Metadata

Release files for holonode 1.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for holonode 1.1.0
File Size Uploaded Provenance Actions
holonode-1.1.0.tar.gz 118.5 kB Without provenance Details for holonode-1.1.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for holonode 1.1.0
File Interpreter ABI Platform Actions
holonode-1.1.0-py3-none-any.whl Python 3 none any Details for holonode-1.1.0-py3-none-any.whl

Total release size: 185.4 kB

Release files / holonode-1.1.0.tar.gz

Download URL holonode-1.1.0.tar.gz
Size 118.5 kB
Tags Source
SHA-256 checksum
How to use checksums
60e65f208cd363fa205b0fcc7e40eb14c4596eb5bf37f9258a4adf16843440fc
BLAKE2b-256 checksum
How to use checksums
6cb60187cbfad29ecb9b135781ad83e92e39a34d4acb2392fa36224dd9e2913d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.13.4 {"installer":{"name":"uv","version":"0.13.4","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Gentoo","version":"2.18","id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

Release files / holonode-1.1.0-py3-none-any.whl

Download URL holonode-1.1.0-py3-none-any.whl
Size 66.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
c8fa4a54da723ad76e8a0cd8e925bdabfb8158788fe7e2f613b03bc4c34975a9
BLAKE2b-256 checksum
How to use checksums
9cabbbf9ac8d83159d332c554ada1f6eab3fd0bf22be80dcb56a65ed83d0b526
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.13.4 {"installer":{"name":"uv","version":"0.13.4","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Gentoo","version":"2.18","id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

Security for holonode 1.1.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page