Portable, offline-first container sandboxes for LLM agents and dev workflows
Project description
pocketdock
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
- Port mapping — expose container ports on the host (e.g.,
ports={8080: 80}) - Container persistence — stop/resume, snapshot to image, volume mounts
- Project management —
.pocketdock/project directories with config, logging, and health checks - Image profiles — six pre-baked Dockerfiles: minimal-python, minimal-node, minimal-bun, dev, agent, embedded
- Full CLI — 22 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 + CLI (includes click, rich)
pip install pocketdock[agent] # + LLM agent (litellm, python-dotenv)
Single-file downloads (no pip required) are available from GitHub Releases.
Requires Podman (recommended) or Docker.
# Build the minimal-python image (~25MB, <500ms startup)
pocketdock build minimal-python
Documentation
Full documentation is available at deftio.github.io/pocketdock.
- Quickstart — install, build, run your first container
- User Guide — containers, commands, files, sessions, persistence, profiles
- CLI Reference — all 22 commands with examples
- API Reference — full SDK reference
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 facade —
AsyncContainerdoes all real work.Containeris 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
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 pocketdock-1.2.5.tar.gz.
File metadata
- Download URL: pocketdock-1.2.5.tar.gz
- Upload date:
- Size: 172.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
15e3009cc662c3d2c36e93ead2da87f5da9498a9657d92bc18abc37ffd6a0e5c
|
|
| MD5 |
0450ffc863937e00f6a95b533e49640c
|
|
| BLAKE2b-256 |
46d889c14f5c6b4454605634b4708cfd242490d98a9d2f8f62186c254d3678c6
|
Provenance
The following attestation bundles were made for pocketdock-1.2.5.tar.gz:
Publisher:
publish.yml on deftio/pocketdock
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
pocketdock-1.2.5.tar.gz -
Subject digest:
15e3009cc662c3d2c36e93ead2da87f5da9498a9657d92bc18abc37ffd6a0e5c - Sigstore transparency entry: 962814747
- Sigstore integration time:
-
Permalink:
deftio/pocketdock@c64d3536ea078a9535992413c60d27fa3db2fc53 -
Branch / Tag:
refs/tags/v1.2.5 - Owner: https://github.com/deftio
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@c64d3536ea078a9535992413c60d27fa3db2fc53 -
Trigger Event:
release
-
Statement type:
File details
Details for the file pocketdock-1.2.5-py3-none-any.whl.
File metadata
- Download URL: pocketdock-1.2.5-py3-none-any.whl
- Upload date:
- Size: 59.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ab2945a83936595363a1f0a479fe49f061a9afe1eed888276801197a914315b2
|
|
| MD5 |
b2d69517964725953ccf855b3233c117
|
|
| BLAKE2b-256 |
6eaca33db203e0dc2f97cbd147ea4f0b36ebb7483f76b8b9dc08e9712b3c3378
|
Provenance
The following attestation bundles were made for pocketdock-1.2.5-py3-none-any.whl:
Publisher:
publish.yml on deftio/pocketdock
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
pocketdock-1.2.5-py3-none-any.whl -
Subject digest:
ab2945a83936595363a1f0a479fe49f061a9afe1eed888276801197a914315b2 - Sigstore transparency entry: 962814772
- Sigstore integration time:
-
Permalink:
deftio/pocketdock@c64d3536ea078a9535992413c60d27fa3db2fc53 -
Branch / Tag:
refs/tags/v1.2.5 - Owner: https://github.com/deftio
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@c64d3536ea078a9535992413c60d27fa3db2fc53 -
Trigger Event:
release
-
Statement type: