Environment Variables#

Python and Node SDK 0.1.17+ invoke Tools through AgentPM CLI 0.1.43+. The CLI owns Tool subprocesses, interpreter selection and managed dependency environments. Install the CLI on developer machines, CI runners and containers.

Tool environment precedence#

The CLI starts with its inherited process environment, applies declared environment.vars defaults for missing variables, then merges entrypoint.env and SDK caller env overrides. Later values win. Required variables must be satisfied by those sources. Keep credentials in runtime environment values; do not put secrets into a published manifest or commit an env file.

For a managed Python Tool, the CLI clears PYTHONHOME and PYTHONPATH after merging all sources, including caller overrides. This prevents app/global Python packages from replacing the locked dependencies. Legacy Tools retain their existing environment semantics. The SDK does not create a separate temporary HOME or an independent dependency environment.

Pass caller overrides#

import { load } from '@agentpm/sdk';
 
const summarize = await load('@zack/summarize-text@0.1.10', {
  env: { OPENAI_API_KEY: process.env.OPENAI_API_KEY! },
  timeoutMs: 30_000,
});
const result = await summarize({ text: 'A short example.', max_words: 50 });
import os
from agentpm import load
 
summarize = load(
    "@zack/summarize-text@0.1.10",
    env={"OPENAI_API_KEY": os.environ["OPENAI_API_KEY"]},
    timeout=30.0,
)
result = summarize({"text": "A short example.", "max_words": 50})

These examples make a model request. The maintained examples also provide no-model SDK smoke commands.

Host settings#

Set these on the app/CLI process rather than using Tool input JSON:

SettingPurpose
AGENTPMCLI executable used by the SDK; otherwise agentpm on PATH
AGENTPM_PYTHONPython executable selected by the CLI; use the same value during install and run
AGENTPM_NODENode executable selected by the CLI
AGENTPM_UV_PATHOperator-provided dependency engine matching AgentPM's exact pin
AGENTPM_TOOL_DIRSDK Tool discovery override for custom installed layouts
AGENTPM_DEBUG=1SDK project/discovery diagnostics; credentials are not logged
AGENTPM_TELEMETRY=0CLI/Harness telemetry opt-out
export AGENTPM=/usr/local/bin/agentpm
export AGENTPM_PYTHON=/usr/local/bin/python3.13
$env:AGENTPM = "C:\Tools\agentpm.exe"
$env:AGENTPM_PYTHON = "C:\Python313\python.exe"

A changed Python executable/ABI or stale managed environment requires explicit agentpm install repair; SDK calls do not provision dependencies or fall back to global Python. Use agentpm install --refresh for damaged installed packages.

Migrating older SDK configuration#

The current SDK runner does not inject the old Node JIT/heap flags, Python -I -B flags or POSIX resource limits. AGENTPM_NODE_JITLESS, AGENTPM_NODE_OLD_SPACE_MB and AGENTPM_RLIMIT_AS_MB are not current SDK controls. Put deliberate interpreter flags in the Tool's entrypoint.args, publish a new Tool version, and configure container resource limits through the host platform. See managed Python dependencies and mixed runtime containers.