Skip to main content

Harnest Docker Extension

The official Docker sandbox provider for Harnest, built and maintained by Fused. It lets a Harnest application run framework-neutral Python sandbox workloads in Docker while keeping the Docker implementation outside Harnest core.

This is a Harnest Extension, loaded into an agent process from its extensions/ directory. It is not an Agent Plugin: Agent Plugins contribute client-facing MCP tools, skills, and UI metadata, while this package extends Harnest's same-process runtime and declares the privileged sandbox.provider capability.

Table of contents

Read the detailed public guide at usefused.com/docs/harnest/build/extensions/official/docker.

Install

Install the published package by short slug or full PyPI project name, then refresh the agent's locked environment:

harnest extensions install docker --project ./my-agent
# Equivalent: harnest extensions install harnest-extension-docker --project ./my-agent
harnest env sync ./my-agent

To review and install a local checkout instead:

harnest extensions install ./official-extensions/docker --project ./my-agent
harnest env sync ./my-agent

Harnest validates and copies the package without importing its code. Create sandbox/python.py and import the installed extension through its application namespace. The exported variable must match the filename:

from harnest.extensions.docker import docker, DockerScope
from harnest.sandbox import SandboxNetworkPolicy


python = docker.sandbox(
    image="python:3.12-slim@sha256:<approved-digest>",
    network_policy=SandboxNetworkPolicy.none(),
    scope=DockerScope.EXECUTION,
)

Add "python" to the consuming agent's sandboxes=[...] grant, then invoke it from an authored tool through context.sandboxes["python"]. Exactly one of image or docker_path is required. A pinned image digest is recommended for reproducible deployments.

Compatibility and capabilities

Current source requires Python 3.11 or newer, Harnest >=1.0.0,<2, and the Docker Python SDK >=7.1,<8. The host must provide a reachable Docker daemon; installing this wheel does not install or start Docker.

The extension provides lazy container startup, fresh execution-scoped containers, identity-bound invocation or session reuse, resource budgets, deadlines, bounded output, cleanup, and supported ADK parsing/retry options. It supports no-network and unrestricted Docker network modes. SDK transport timeouts for image and container startup are constrained by the remaining deadline. A host watchdog and control checks enforce the execution deadline. Cleanup receives a separate bounded five-second window. Daemon errors and startup timeouts identify the failed phase without exposing Docker SDK details, image-defined health checks are disabled, and managed containers carry dev.harnest.* labels for operator inventory.

Multi-container topologies

Declare bounded services when submitted Python must reach another container:

from harnest.extensions.docker import docker, DockerScope
from harnest.sandbox import SandboxBudget, SandboxNetworkPolicy


queue = docker.service(
    name="queue",
    image="redis:7-alpine@sha256:<approved-digest>",
    command=["redis-server", "--save", ""],
    ports=[6379],
    readiness=docker.readiness(command=["redis-cli", "ping"]),
    budget=SandboxBudget(memory_bytes=128 * 1024 * 1024),
)

python = docker.sandbox(
    image="python:3.12-slim@sha256:<approved-digest>",
    services=[queue],
    network=docker.network(internal=True),
    network_policy=SandboxNetworkPolicy.none(),
    scope=DockerScope.SESSION,
)

The extension creates one uniquely named bridge for the primary container and up to eight services. Service names and aliases resolve through internal Docker DNS. Declared ports are container-to-container documentation; the extension never publishes them on the host. An internal network permits only topology traffic even when the portable policy denies external egress. Set internal=False only with SandboxNetworkPolicy.unrestricted().

Services start in declaration order and must become healthy before submitted Python runs. Each service receives its own SandboxBudget. Retained invocation or session scopes keep their services running while the primary execution container is quiescent. A stopped or unhealthy service poisons the topology. Cleanup removes the primary container, services in reverse creation order, and then the owned network; uncertain cleanup blocks replacement for a later retry.

Startup, service, execution, and cleanup lifecycle events emit correlated logs and traces through Harnest observability. Every signal carries harnest.extension.name=docker; topology IDs and service names support resource correlation without recording image references, commands, environment values, user/session identities, or Docker error messages.

Security and limitations

Docker daemon access is highly privileged. Protect its socket or remote API, restrict who can configure the extension, and use trusted, digest-pinned images. The extension rejects network-policy substitution and fails closed for exact host/port allowlists and unrestricted mode with private-network blocking because those controls are not yet enforced by this provider. It is a Python execution sandbox, not a browser tool, model provider, or general container orchestrator.

Source and issue tracking live in the Harnest repository.

Metadata

Release files for harnest-extension-docker 0.4.3

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

Built distribution (wheel)

Table of built distributions (wheels) for harnest-extension-docker 0.4.3
File Interpreter ABI Platform Actions
harnest_extension_docker-0.4.3-py3-none-any.whl Python 3 none any Details for harnest_extension_docker-0.4.3-py3-none-any.whl

Release files / harnest_extension_docker-0.4.3-py3-none-any.whl

Download URL harnest_extension_docker-0.4.3-py3-none-any.whl
Size 27.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
f338cebbaec71aa0edbe70c8040c4276129f29cccb8a4a23a3d06c93271ccb0d
BLAKE2b-256 checksum
How to use checksums
caa5b9a55ecf31a05f9d41f67698f5d063f3a2b525a79b4d059bdd6c0c899d1f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 16, 2026.

Transparency log

Security for harnest-extension-docker 0.4.3

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.

Full provenance

1 file in this release has been uploaded with provenance metadata.

Attestation for harnest_extension_docker-0.4.3-py3-none-any.whl

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 16, 2026.

Transparency log

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