Mixed Runtimes with Docker#

A Node app can invoke a Python Tool, and a Python app can invoke a Node Tool. The image needs the app SDK, AgentPM CLI 0.1.43+, and the interpreters required by its Tools. SDK 0.1.17+ delegates every Tool call to the CLI.

Build a supported runtime image#

Use a glibc Linux x86-64 image for AgentPM's Linux CLI. CLI 0.1.43 requires glibc 2.39 or newer; the examples use matching Debian Trixie bases. Linux arm64 and musl/Alpine are not supported CLI targets. Select Node/Python releases compatible with your app and the locked dependency wheels; installing a newer Python may require wheel versions that older Tool locks do not provide.

The following is an outline for a Python app that also invokes Node Tools. Before building, place a checksum-verified Linux x86-64 AgentPM release binary named agentpm in the build context. Include the app's real requirements, agent.json and portable agent.lock in that context.

FROM node:22-trixie-slim AS node_runtime
FROM python:3.13-slim-trixie AS runtime
 
COPY --from=node_runtime /usr/local/bin/node /usr/local/bin/node
COPY --chmod=755 agentpm /usr/local/bin/agentpm
ENV AGENTPM_PYTHON=/usr/local/bin/python3.13
WORKDIR /app
 
COPY requirements.txt ./
RUN pip install --no-cache-dir -r requirements.txt
COPY . .
RUN agentpm --version && agentpm install --frozen
CMD ["python", "run.py"]

The app requirements must include agentpm>=0.1.17. A Node app instead installs @agentpm/sdk@^0.1.17 with its normal package manager. Use a secret mount for a private Registry token during image builds; do not store tokens in a Dockerfile, build argument or image layer. For public packages, an install can run without login. Add --require-signature --require-attestation where your provenance policy requires both.

Exclude .agentpm/, language environments and real env files from the Docker build context. Run install inside the image so its target, interpreter and managed runtime match the deployment. A workstation's .agentpm/ environment is not portable container state; the source-controlled lock is. If the app loads an installed Agent without a local manifest, use its exact package reference in the image install command, for example agentpm install @your-namespace/your-agent@1.0.0. CLI 0.1.43 cannot replay a direct non-Tool package reference with --frozen; use the exact Agent version and review the resulting lock rather than rewriting its package kinds.

Build and run this Linux x86-64 image explicitly:

docker build --platform linux/amd64 -t agent-app .
docker run --rm --platform linux/amd64 -e OPENAI_API_KEY agent-app

On a different host, this requires Docker's own emulation support; it is not a native Linux arm64 AgentPM release or a CLI compatibility fallback. The official Node and Python image catalogues list the matching Trixie tags. Pin the chosen image digests for your deployment when you need immutable base-image selection.

Apple Silicon and amd64 emulation#

The Python and Node SDK container workflows were verified on native Linux x86-64 using CLI 0.1.43 and SDK 0.1.17. Running those amd64 images on Apple Silicon introduces an additional emulation dependency. In an Apple Silicon check, Rosetta encountered a TLS DecryptError, while QEMU crashed the verified uv 0.13.5 binary at startup. The exact cause of the Rosetta TLS failure remains unconfirmed. Related upstream reports cover Rosetta cryptography behavior and uv execution under QEMU.

The CLI's resolver version-mismatch message can also appear when uv --version exits unsuccessfully. Inspect the resolver's exit status and stderr before assuming that its version differs. Keep AgentPM's required resolver version and use a native Linux x86-64 build runner when emulation blocks installation. Use the native macOS CLI for host development on Apple Silicon.

First-use networking and execution#

Install may download the pinned dependency engine from AgentPM storage and hash-verified wheels from the index. Configure required proxy/allowlist access as described in Python dependencies. Do not install dependencies by invoking a Tool: install provisions the runtime, while SDK calls and agentpm run validate it and fail with repair guidance if it is missing or stale.

Pass model/service credentials at runtime through environment variables or a secret manager. Keep AGENTPM_PYTHON consistent between install and execution. Use AGENTPM_TELEMETRY=0 for opt-out; runtime resource limits belong to Docker or your orchestrator. Interpreter flags belong to the Tool's entrypoint rather than old SDK-specific resource/JIT environment variables.

Troubleshooting#

  • CLI missing/outdated: install a compatible AgentPM binary on PATH or set AGENTPM.
  • Tool missing: run agentpm install inside the intended container workspace.
  • No compatible wheel: choose a supported interpreter/Tool version; install never compiles from source.
  • Environment stale: reinstall using the deployment interpreter; use --refresh for damaged packages.
  • Unexpected imports: managed execution clears PYTHONPATH and PYTHONHOME; keep application and Tool dependencies separate.
  • Resource exhaustion: size container memory/disk/concurrency for your workload and set platform limits.