Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion src/agent_env/agents/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,12 @@ the folder changes. A run that deploys the agent registers that image when it's
pulls it by its digest and builds it from this folder only when it can't, and a provider that runs images by name can
run it. The CLI's version is the Dockerfile's
`CLAUDE_CODE_VERSION`. The image gives the scripts the model runs
`node`, without npm or npx, and the Python packages `model-requirements.txt` pins. A `deploy_agent` `builtin_tools`
`node`, without npm or npx, and the Python packages `model-requirements.txt` pins: boto3, and openpyxl, pypdf,
python-docx and python-pptx, which read the .xlsx, .pdf, .docx and .pptx files tasks often give the model. Without them
a script that opens such a file stops at `ModuleNotFoundError`, and the model spends turns working around it or fails
the task for a reason that isn't the model's; a sandbox with no network can't install them either. They add about 50 MB,
mostly the lxml and Pillow they depend on, and their pins match the Codex and Gemini images' and Harbor bundles', so a
task's documents read the same way in each. A `deploy_agent` `builtin_tools`
selection picks the CLI's own tools: `{"disable": "*"}` and `{"only": [...]}` become its `--tools` list, a list to
turn off becomes `--disallowedTools`, which keeps the CLI's defaults for the rest, and any selection adds
`--strict-mcp-config`, so its MCP servers are only the task env's. Tool search is off unless the agent's environment sets
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
# What the image gives the Python the model runs, beside the agent's own requirements; an installed agent's model
# uses the task container's Python instead.
boto3==1.43.115
# The readers for the .xlsx, .pdf, .docx and .pptx files a task gives the model, at the versions Harbor bundles pin.
openpyxl==3.1.5
pypdf==6.21.3
python-docx==1.2.0
python-pptx==1.0.2
4 changes: 2 additions & 2 deletions src/agent_env/agents/agents/codex/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ COPY package.json package-lock.json ./
RUN npm ci --ignore-scripts --omit=dev --no-audit --no-fund --loglevel=error && npm cache clean --force \
&& ln -s /opt/agent/node_modules/.bin/codex /usr/local/bin/codex \
&& ln -s /opt/agent/node_modules/.bin/mcp-remote /usr/local/bin/mcp-remote
COPY requirements.txt ./
RUN pip install --no-cache-dir -r requirements.txt
COPY requirements.txt model-requirements.txt ./
RUN pip install --no-cache-dir -r requirements.txt -r model-requirements.txt
# install.sh and run.sh are install/v1's: in the image, so they stay in its build context.
COPY a2a_server.py codex_bridge.py codex_config.py codex_kit.py entrypoint.sh install.sh run.sh ./
# The CLI's cwd, /app, and its state, fixed so neither follows the uid: Modal runs the image as root.
Expand Down
3 changes: 2 additions & 1 deletion src/agent_env/agents/agents/codex/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,8 @@ Codex reads its settings from `$CODEX_HOME/config.toml`, which the agent writes:
| `install/v1` | `install.sh`, into a task container (as root, the CLI working in `/app`) or onto a `vm` sandbox's Linux host: Node and uv checked against their checksums, the CLIs from `package-lock.json` and the agent's requirements in a Python of its own, which the target's own Node and Python are never replaced by; the model's commands get the agent's where the target has none. Node's builds need glibc |
| `triggers/v1` | SDK default |

The image is `python:3.11-slim` with Node, the CLIs and the agent, running as the `agent` user; Codex's state is in
The image is `python:3.11-slim` with Node, the CLIs, the agent and the Python packages `model-requirements.txt` pins for
the model's scripts, running as the `agent` user; Codex's state is in
`/home/agent/.codex` whatever the uid.

A `deploy_agent` `builtin_tools` selection turns the CLI's own tools off with `-c` overrides on the task's CLI alone;
Expand Down
7 changes: 7 additions & 0 deletions src/agent_env/agents/agents/codex/model-requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# What the image gives the Python the model runs, beside the agent's own requirements; an installed agent's model
# uses the task container's Python instead.
# The readers for the .xlsx, .pdf, .docx and .pptx files a task gives the model, at the versions Harbor bundles pin.
openpyxl==3.1.5
pypdf==6.21.3
python-docx==1.2.0
python-pptx==1.0.2
4 changes: 2 additions & 2 deletions src/agent_env/agents/agents/gemini/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ WORKDIR /opt/agent
COPY package.json package-lock.json ./
RUN npm ci --ignore-scripts --omit=dev --no-audit --no-fund --loglevel=error && npm cache clean --force \
&& ln -s /opt/agent/node_modules/.bin/gemini /usr/local/bin/gemini
COPY requirements.txt ./
RUN pip install --no-cache-dir -r requirements.txt
COPY requirements.txt model-requirements.txt ./
RUN pip install --no-cache-dir -r requirements.txt -r model-requirements.txt
# install.sh and run.sh are install/v1's: in the image, so they stay in its build context.
COPY a2a_server.py gemini_bridge.py gemini_changelog.py gemini_config.py gemini_kit.py entrypoint.sh install.sh run.sh ./
# The CLI's cwd and file-tool boundary, /workspace, and its state, fixed so neither follows the uid: Modal runs the
Expand Down
3 changes: 2 additions & 1 deletion src/agent_env/agents/agents/gemini/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,5 +38,6 @@ CLI by its last segment, and the proxy translates its generate calls to `/v1/cha
| `install/v1` | `install.sh`, into a task container (as root, the CLI working in `/workspace`) or onto a `vm` sandbox's Linux host: Node and uv checked against their checksums, the CLI from `package-lock.json` and the agent's requirements in a Python of its own, which the target's own Node and Python are never replaced by; the model's commands get the agent's where the target has none. Node's builds need glibc |
| `triggers/v1` | SDK default |

The image is `python:3.11-slim` with Node, the CLI and the agent, running as the `agent` user; the CLI's state is in
The image is `python:3.11-slim` with Node, the CLI, the agent and the Python packages `model-requirements.txt` pins for
the model's scripts, running as the `agent` user; the CLI's state is in
`/home/agent/.gemini` (`GEMINI_CLI_HOME`) whatever the uid.
7 changes: 7 additions & 0 deletions src/agent_env/agents/agents/gemini/model-requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# What the image gives the Python the model runs, beside the agent's own requirements; an installed agent's model
# uses the task container's Python instead.
# The readers for the .xlsx, .pdf, .docx and .pptx files a task gives the model, at the versions Harbor bundles pin.
openpyxl==3.1.5
pypdf==6.21.3
python-docx==1.2.0
python-pptx==1.0.2
4 changes: 4 additions & 0 deletions tst/unit/agents/claude_code/test_image_contract.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@

DOCKERFILE = (AGENT_DIR / "Dockerfile").read_text()

# Harbor bundles pin the same versions (agentenvhub-sdk's _DOC_TOOL_PACKAGES), so a task's documents read alike in both.
DOC_LIBS = ["openpyxl==3.1.5", "pypdf==6.21.3", "python-docx==1.2.0", "python-pptx==1.0.2"]


def test_every_file_the_image_copies_is_in_the_folder():
copied = [name for line in re.findall(r"^COPY (?!--from=)(.+) \S+$", DOCKERFILE, re.MULTILINE)
Expand Down Expand Up @@ -39,6 +42,7 @@ def test_the_packages_the_image_gives_the_models_python_are_pinned():

assert packages and all(re.fullmatch(r"[A-Za-z0-9_.-]+==[0-9][0-9A-Za-z.]*", line) for line in packages), packages
assert any(line.startswith("boto3==") for line in packages)
assert set(DOC_LIBS) <= set(packages), packages
assert "-r requirements.txt -r model-requirements.txt" in DOCKERFILE


Expand Down
13 changes: 13 additions & 0 deletions tst/unit/agents/codex/test_image_contract.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,10 @@
INSTALL_SH = (AGENT_DIR / "install.sh").read_text()


# Harbor bundles pin the same versions (agentenvhub-sdk's _DOC_TOOL_PACKAGES), so a task's documents read alike in both.
DOC_LIBS = ["openpyxl==3.1.5", "pypdf==6.21.3", "python-docx==1.2.0", "python-pptx==1.0.2"]


def _copied() -> list[str]:
return [name for line in re.findall(r"^COPY (?!--from=)(.+) \S+$", DOCKERFILE, re.MULTILINE)
for name in line.split()]
Expand Down Expand Up @@ -53,6 +57,15 @@ def test_the_requirements_are_the_protocol_floor_the_config_writer_and_the_ca_bu
assert requirements == ["agentenv-framework-protocol[agent]>=0.1.351", "tomli-w==1.2.0", "certifi"]


def test_the_image_gives_the_models_python_the_document_libraries():
packages = [line for line in (AGENT_DIR / "model-requirements.txt").read_text().splitlines()
if line and not line.startswith("#")]

assert packages == DOC_LIBS
assert "COPY requirements.txt model-requirements.txt ./" in DOCKERFILE
assert "RUN pip install --no-cache-dir -r requirements.txt -r model-requirements.txt" in DOCKERFILE


def test_node_is_pinned_by_version_and_checksum_for_the_image_and_an_install():
args = dict(re.findall(r"^ARG (NODE_\w+)=(\S+)$", DOCKERFILE, re.MULTILINE))

Expand Down
13 changes: 13 additions & 0 deletions tst/unit/agents/gemini/test_image_contract.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,10 @@
INSTALL_SH = (AGENT_DIR / "install.sh").read_text()


# Harbor bundles pin the same versions (agentenvhub-sdk's _DOC_TOOL_PACKAGES), so a task's documents read alike in both.
DOC_LIBS = ["openpyxl==3.1.5", "pypdf==6.21.3", "python-docx==1.2.0", "python-pptx==1.0.2"]


def _copied() -> list[str]:
return [name for line in re.findall(r"^COPY (?!--from=)(.+) \S+$", DOCKERFILE, re.MULTILINE)
for name in line.split()]
Expand Down Expand Up @@ -53,6 +57,15 @@ def test_the_image_installs_the_protocol_alone_from_its_requirements():
assert requirements == ["agentenv-framework-protocol[agent]>=0.1.351"]


def test_the_image_gives_the_models_python_the_document_libraries():
packages = [line for line in (AGENT_DIR / "model-requirements.txt").read_text().splitlines()
if line and not line.startswith("#")]

assert packages == DOC_LIBS
assert "COPY requirements.txt model-requirements.txt ./" in DOCKERFILE
assert "RUN pip install --no-cache-dir -r requirements.txt -r model-requirements.txt" in DOCKERFILE


def test_node_is_pinned_by_version_and_checksum_for_the_image_and_an_install():
args = dict(re.findall(r"^ARG (NODE_\w+)=(\S+)$", DOCKERFILE, re.MULTILINE))

Expand Down
Loading