Published `molecule-ai-workspace-runtime==0.1.0` to PyPI: https://pypi.org/project/molecule-ai-workspace-runtime/0.1.0/ Source repo: https://github.com/Molecule-AI/molecule-ai-workspace-runtime Each adapter's Dockerfile and requirements.txt have moved to the corresponding standalone template repo (molecule-ai-workspace-template-<runtime>). The adapter Python code (.py files) stays in the monorepo for local dev and testing. Changes: - workspace-template/pyproject.toml — new, packages the shared runtime as a PyPI package - workspace-template/adapters/*/Dockerfile — removed (now in template repos) - workspace-template/adapters/*/requirements.txt — removed (now in template repos) - workspace-template/Dockerfile — drop COPY adapters/ (still copies .py files via *.py glob) - workspace-template/build-all.sh — simplified to base-image-only build - workspace-template/entrypoint.sh — remove adapter requirements.txt install step - workspace-template/tests/test_hermes_adapter.py — skip Dockerfile/requirements.txt checks - CLAUDE.md — update architecture description + workspace image table - docs/workspace-runtime-package.md — new, explains the package + adapter repo layout Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
3.3 KiB
3.3 KiB
Workspace Runtime PyPI Package
Overview
The shared workspace runtime infrastructure lives in two places:
- Source of truth (monorepo):
workspace-template/— this is where all development happens - Published package:
molecule-ai-workspace-runtimeon PyPI
What's in the package
Everything in workspace-template/ except adapter-specific code:
molecule_runtime/— all shared.pyfiles (main.py, config.py, heartbeat.py, etc.)molecule_runtime/adapters/—BaseAdapter,AdapterConfig,SetupResult,shared_runtimemolecule_runtime/builtin_tools/— delegation, memory, approvals, sandbox, telemetrymolecule_runtime/skill_loader/— skill loading + hot-reloadmolecule_runtime/plugins_registry/— plugin discovery and install pipelinemolecule_runtime/policies/— namespace routing policies- Console script:
molecule-runtime→molecule_runtime.main:main_sync
Adapter repos
Each of the 8 adapter repos now contains:
adapter.py— runtime-specificAdapterclassrequirements.txt—molecule-ai-workspace-runtime>=0.1.0+ adapter depsDockerfile— standalone image (no longer extends workspace-template:base)
Adapter discovery (ADAPTER_MODULE)
Standalone adapter repos set ENV ADAPTER_MODULE=adapter in their Dockerfile.
The runtime's get_adapter() checks this env var first:
# In molecule_runtime/adapters/__init__.py
def get_adapter(runtime: str) -> type[BaseAdapter]:
adapter_module = os.environ.get("ADAPTER_MODULE")
if adapter_module:
mod = importlib.import_module(adapter_module)
return getattr(mod, "Adapter")
# Fall back to built-in subdirectory scan (monorepo local dev)
...
Publishing a new version
cd workspace-template
# 1. Bump version in pyproject.toml
# 2. Sync to molecule-ai-workspace-runtime repo
# 3. Tag and push — CI publishes to PyPI via PYPI_TOKEN secret
Or manually:
cd workspace-template
python -m build
python -m twine upload dist/*
Writing a new adapter
- Create a new standalone repo
molecule-ai-workspace-template-<runtime> - Copy
adapter.pypattern from any existing adapter repo - Change imports:
from molecule_runtime.adapters.base import BaseAdapter, AdapterConfig - Create
requirements.txtwithmolecule-ai-workspace-runtime>=0.1.0+ your deps - Create
DockerfilewithENV ADAPTER_MODULE=adapterandENTRYPOINT ["molecule-runtime"] - Register the runtime name in the platform's known runtimes list