From 591b82d2399ce427bf83c7b35d24f5287d206256 Mon Sep 17 00:00:00 2001 From: t Date: Tue, 17 Nov 2026 17:02:31 -0500 Subject: [PATCH] feat(agents): install jq in the Claude Code image The CLI saves an MCP result over its token cap to a file and tells the model to query it with jq, which the image didn't have. Co-Authored-By: Claude Opus 5.5 --- src/agent_env/agents/README.md | 3 ++- src/agent_env/agents/agents/claude-code/Dockerfile | 3 ++- tst/unit/agents/claude_code/test_image_contract.py | 6 ++++++ 3 files changed, 10 insertions(+), 2 deletions(-) diff --git a/src/agent_env/agents/README.md b/src/agent_env/agents/README.md index f4041d557..814107dad 100644 --- a/src/agent_env/agents/README.md +++ b/src/agent_env/agents/README.md @@ -21,7 +21,8 @@ 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: boto3, and openpyxl, pypdf, +`node`, without npm or npx; `jq`, which the CLI tells the model to query an MCP result with when the result is over its +token cap and saved to a file; 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, diff --git a/src/agent_env/agents/agents/claude-code/Dockerfile b/src/agent_env/agents/agents/claude-code/Dockerfile index cbe95d6e6..65579464d 100644 --- a/src/agent_env/agents/agents/claude-code/Dockerfile +++ b/src/agent_env/agents/agents/claude-code/Dockerfile @@ -3,7 +3,8 @@ FROM public.ecr.aws/docker/library/node:22-slim@sha256:c3de60bf2f9dd0ac6370e6117 FROM public.ecr.aws/docker/library/python:3.11-slim@sha256:c20888b6acdd1e63e1c433a185bf3ad162c0288fe484616ce062e0d28add2900 # poppler-utils: the CLI's Read tool runs pdftoppm for a PDF's pages. -RUN apt-get update && apt-get install -y --no-install-recommends ca-certificates curl poppler-utils \ +# jq: the CLI saves an MCP result over its token cap to a file and tells the model to query it with jq. +RUN apt-get update && apt-get install -y --no-install-recommends ca-certificates curl jq poppler-utils \ && rm -rf /var/lib/apt/lists/* # Claude Code's native build for this machine's platform, checked against its release manifest. ARG CLAUDE_CODE_VERSION=2.1.322 diff --git a/tst/unit/agents/claude_code/test_image_contract.py b/tst/unit/agents/claude_code/test_image_contract.py index c8e528df3..b25bca1d0 100644 --- a/tst/unit/agents/claude_code/test_image_contract.py +++ b/tst/unit/agents/claude_code/test_image_contract.py @@ -46,6 +46,12 @@ def test_the_packages_the_image_gives_the_models_python_are_pinned(): assert "-r requirements.txt -r model-requirements.txt" in DOCKERFILE +def test_the_image_installs_jq_which_the_cli_tells_the_model_to_query_a_saved_mcp_result_with(): + apt = re.search(r"apt-get install -y --no-install-recommends ([^\\&]+)", DOCKERFILE) + + assert apt and {"jq", "poppler-utils"} <= set(apt.group(1).split()), apt + + def test_the_image_pins_its_cli_checks_its_checksum_and_keeps_tls_on(): assert re.search(r"^ARG CLAUDE_CODE_VERSION=\d+\.\d+\.\d+$", DOCKERFILE, re.MULTILINE) assert "sha256sum -c" in DOCKERFILE