Repository navigation
feat(proxy): start a proxy a task image bakes in, and fetch less per install - #578
Merged
Merged
Conversation
…install An episode installed AgentEnv's proxy into its task container from scratch: uv fetched from GitHub on the host, a managed Python and the proxy's requirements downloaded into the container, and a throwaway docker run of the proxy image just to read its card. At 128 concurrent episodes that was most of an episode's start. - bake.sh installs the proxy into an image as it's built, with a marker naming the requirements it holds; install.sh's container install only starts a baked proxy that holds this proxy's requirements, else installs as before. - The full install keeps uv on the host, checked against its checksum, so it isn't fetched from GitHub per episode. - install_agent reads an agent image's install extension once per process, by the image's name and digest, and polls for the agent card every 0.5 s. - The bundle task image test removes the image it builds. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Key the install extension cache by the image artifact's id and version: an image loaded from a tarball has no digest, so two versions under one name would have shared a card. Installs at once share one in-flight read, and a failed read, or one made on another event loop, is made again. Test the full install's host copy of uv: a good one is used, a corrupt or missing one is fetched. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The full install checks uv against its published checksum; the bake recipe took ghcr.io/astral-sh/uv:0.13.1 by tag. Pin it to the image index's digest, which covers linux/amd64 and linux/arm64, and test that the README and bake.sh name the same pinned reference for the uv version install.sh brings. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The Ctrl-C and SIGTERM cases signalled as soon as the nap step's line printed, sometimes before its command had written nap.pid, so the check for the stopped nap found no file. Wait for the pid first, as the killed-outright case does. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
uv's version, its checksums and its image digest, the Python version and the bake root were spread over install.sh, bake.sh and the tests, and bake.sh read the Python version out of install.sh's text. Both scripts now source versions.sh, and the tests render the bake recipe from it and check the README and bake.sh give that recipe. Drop a local import of a name the module already imports. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
install.sh sources versions.sh beside it, and the container install test copied only install.sh and a2a_server.py into its folder. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
When an episode plays an agent installed into a task container (
install_agentwithcontainer_name), it installs AgentEnv's proxy there from scratch, every episode:docker runof the proxy image reads its card;At 128 concurrent episodes, that was most of an episode's start.
agents/agents/proxy/bake.shinstalls the proxy into an image as it's built, into/opt/agentenv-proxy. It also writes a marker naming therequirements.txtthe proxy was built from. A task image ends its Dockerfile with three lines (in the README).install.sh's container install checks the marker: a baked proxy that holds this proxy's requirements is only started, with one file copied in. Any other container gets the full install, as before.bake.shis plainsh, for images with no bash, and uv picks the image's own glibc or musl Python as it builds.install_agentreads an agent image's install/v1 extension once per process, keyed by the image's name and digest, which name its content.Measured
128 concurrent episodes, as 4 processes × 32, of tasks whose agent is installed into a task container on the local sandbox (16 task images, each episode's first turn ended at once). Run on a c6i.12xlarge, after a warm-up round of one episode per task. Means over the 4 processes; no episode failed in any arm.
run_docker_containerinstall_agentFROMa prebuilt base, full proxy installimage_artifact_id, #574), full proxy installimage_artifact_id+ baked proxy, card read once, 0.5 s pollWithout the card cache and the faster poll, the baked arm was 28 s to first turn with 16 s of install.
The remaining 9 s of install is mostly the proxy's own start under that load: the card wait still averages about 4.5 s at a 0.5 s poll.
Tests
tst/unit/agents/proxy/test_proxy_agent.py:install.sh's container install against a fake docker: a container whose image baked this proxy only getsa2a_server.pycopied and the baked venv's Python started, with no curl; one with none baked, or with other requirements baked, goes to the full install.bake.shparses assh.bake.sh's uv image name the uv versioninstall.shbrings.tst/unit/task_step/install_agent_test.py: an image's install extension is read once, and read again for another digest.tst/integration/agent/proxy_local_container_test.py(slow tier): an episode on the local sandbox whose agent is installed into a task container, from an image with the proxy baked in and from one without. Both play the turn through the proxy and pass the task's tests; only the second gets uv.make unit-testpasses apart from two MCP CLI codegen tests that also fail onmainon that box: 14,168 passed, 9 skipped.ruff checkis clean.🤖 Generated with Claude Code


Confidence Score: 5/5
The PR appears safe to merge; the previous test failure is fixed and no new issues were found.Summary
This PR reduces proxy startup work:
The latest change fixes the previous finding by copying
versions.shinto the integration test’s temporary folder. No new issues were found.Diagram
%%{init: {'theme': 'neutral'}}%% flowchart TD A[Install proxy in task container] --> B{Baked requirements match?} B -->|Yes| C[Use baked Python environment] B -->|No| D[Reuse checked uv archive or download it] D --> E[Install Python and proxy requirements] C --> F[Copy current proxy server] E --> F F --> G[Start proxy and wait for its card]Reviews (6) · Last reviewed commit: "test(proxy): copy versions.sh with the i..." · Reviewed by Greptile