Skip to main content

Portable, offline-first container sandboxes for LLM agents and dev workflows

Project description

pocketdock

CI Coverage: 100% Docs License: BSD-2-Clause

Portable, offline-first container sandboxes for LLM agents and dev workflows.

One Container class. Podman-first, Docker-compatible. Python SDK + CLI. Zero cloud. Zero API keys.

Why pocketdock?

Managed sandbox platforms require API keys, cloud accounts, and an internet connection. Rolling your own container glue means rewriting hundreds of lines of boilerplate every time. pocketdock sits in between: a clean Python SDK that talks directly to your container engine over its Unix socket, works entirely offline, and has zero external dependencies for the core SDK.

Features

  • Three execution modes — blocking, streaming, and detached (background) with ring buffer
  • File operations — read, write, list, push, and pull files between host and container
  • Persistent sessions — long-lived shell sessions with state (cwd, env vars, history)
  • Resource limits — memory caps, CPU throttling, per-container isolation
  • Container persistence — stop/resume, snapshot to image, volume mounts
  • Project management.pocketdock/ project directories with config, logging, and health checks
  • Image profiles — four pre-baked Dockerfiles: minimal, dev, agent, embedded
  • Full CLI — 21 commands for container lifecycle, file ops, and project management
  • Async-first — sync facade over async core; use either API style
  • Callbacks — register handlers for stdout, stderr, and exit events

Quick Example

from pocketdock import create_new_container

with create_new_container() as c:
    result = c.run("echo hello")
    print(result.stdout)  # "hello\n"
    print(result.ok)      # True

Install

pip install pocketdock          # SDK only (zero dependencies)
pip install pocketdock[cli]     # SDK + CLI (click, rich)

Requires Podman (recommended) or Docker.

# Build the minimal image (~25MB, <500ms startup)
pocketdock build minimal

Documentation

Full documentation is available at deftio.github.io/pocketdock.

Architecture

User Code / LLM Agent / CLI
        |
        v
  pocketdock SDK
  +--------------------------------------+
  | Container (sync)  -> AsyncContainer  |  facade pattern
  |   +- _socket_client (raw HTTP/Unix)  |
  +- ProjectManager (.pocketdock/)      |
  +- Persistence (resume, snapshot)      |
  +- Sessions (persistent shells)        |
  +--------------------------------------+
        |  raw HTTP over Unix socket
        |  (one connection per operation)
        v
  Podman (rootless) / Docker Engine

Design principles:

  • Connection-per-operation — each API call opens its own Unix socket. No pooling.
  • Async core, sync facadeAsyncContainer does all real work. Container is a sync wrapper.
  • No cached state — always polls live from the engine.
  • Minimal dependencies — stdlib-only for the core SDK.

Development

uv sync --dev                    # Install dependencies
uv run pytest                    # Run tests (100% coverage enforced)
uv run ruff check .              # Lint (zero warnings)
uv run mypy --strict python/     # Type checking (strict mode)
uv run mkdocs serve              # Local docs site

License

BSD-2-Clause. Copyright (c) deftio llc.

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

pocketdock-1.1.0.tar.gz (161.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

pocketdock-1.1.0-py3-none-any.whl (52.9 kB view details)

Uploaded Python 3

File details

Details for the file pocketdock-1.1.0.tar.gz.

File metadata

  • Download URL: pocketdock-1.1.0.tar.gz
  • Upload date:
  • Size: 161.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for pocketdock-1.1.0.tar.gz
Algorithm Hash digest
SHA256 8892c118bd1f5d915751acceb68b1f813ee192824b13ed70ad55176408a4dde9
MD5 4266b5ef20a7a3dd4f3f649a4cd18c96
BLAKE2b-256 05a3018b7036e418480e9a0069e4b5dc813e00e62f27571d46308556e98e171f

See more details on using hashes here.

Provenance

The following attestation bundles were made for pocketdock-1.1.0.tar.gz:

Publisher: publish.yml on deftio/pocketdock

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file pocketdock-1.1.0-py3-none-any.whl.

File metadata

  • Download URL: pocketdock-1.1.0-py3-none-any.whl
  • Upload date:
  • Size: 52.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for pocketdock-1.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 d1d505e280713dac7986175c9b281005cb7b580b2d2b57c884ea432bcf01e9ba
MD5 c9d8e6575f170100941bfa2164e75949
BLAKE2b-256 5a803381d3e579ab512f9c24186fe21f88476c05454192655286562d073d3878

See more details on using hashes here.

Provenance

The following attestation bundles were made for pocketdock-1.1.0-py3-none-any.whl:

Publisher: publish.yml on deftio/pocketdock

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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