# The agent's image: the shared runtime image for its framework (built and # published by the platform's runtime CI) with this agent's files on top. The # runtime image holds Python, the agent runtime and the framework's libraries, # runs as a non-root user and serves the agent (its CMD); this image adds only # the agent's own files. There is no app/agent.py: the runtime builds the agent # from agent.yaml. # # Moving to a new runtime is a change of RUNTIME_IMAGE and a new agent version # (agent.yaml, and an entry in RELEASE_NOTES.md). # # docker build -t : . # docker build --build-arg RUNTIME_IMAGE= -t ... . # # Extra Python packages: list them in requirements.txt (stage 1 below). ARG RUNTIME_IMAGE=kyndryl.jfrog.io/kc-ai-agent-factory-docker-local/agent-runtime-adk:0.35.7 # Stage 1: the agent's extra Python packages, if requirements.txt lists any. # Installed on the runtime image itself, so they match its Python and Linux; # a package that would change one the runtime already has stops the build, # so an agent cannot break the runtime under it. Only the packages added go # on to /agent/vendor (on the import path). With an empty requirements.txt # this stage does nothing. The runtime itself never comes from here. FROM ${RUNTIME_IMAGE} AS vendor USER root COPY requirements.txt /tmp/requirements.txt RUN pip freeze --all | sort > /tmp/before \ && pip install --no-cache-dir -r /tmp/requirements.txt \ && pip freeze --all | sort > /tmp/after \ && comm -13 /tmp/before /tmp/after > /tmp/added \ && for name in $(cut -d= -f1 /tmp/added); do \ if grep -qi "^${name}==" /tmp/before; then \ echo "requirements.txt changes ${name}, which the runtime image already has" >&2; exit 1; \ fi; \ done \ && mkdir -p /vendor \ && if [ -s /tmp/added ]; then \ pip install --no-cache-dir --no-deps --target /vendor -r /tmp/added; \ fi # Stage 2: the agent: the runtime image, its extra packages and its files. FROM ${RUNTIME_IMAGE} COPY --from=vendor /vendor /agent/vendor/ # shared_skills.loc[k]: the shared skills' lock file, copied only when the # agent pins shared skills (the pattern matches nothing otherwise). COPY agent.yaml prompt.md shared_skills.loc[k] /agent/ COPY schemas/ /agent/schemas/ COPY app/ /agent/app/ # The agent's skills: one folder per skill (skills//SKILL.md), listed in # agent.yaml. An agent whose agent.yaml names a skill folder that is not in the # image refuses to start, so this line is not optional once you add one. COPY skills/ /agent/skills/ # The agent's own eval suite, so the platform can fetch it from the running # container at /.well-known/eval-suite.yaml and run it from the portal. COPY eval/ /agent/eval/ # Add any data your agent reads at runtime, e.g.: # COPY reference/ /agent/reference/ # It works locally without this because ./run-local.sh bind-mounts the project # into the container. Kubernetes has no such mount, so an uncopied file is # simply absent there — the most common local-passes-deploy-fails bug.