Repository navigation
perf(proxy): compile the baked proxy's bytecode as the image is built - #587
Merged
Merged
Conversation
Every fresh task container compiled the proxy's dependencies on first import, so 128 episodes starting at once spent their CPU compiling the same packages. bake.sh now installs the venv with --compile-bytecode. 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
A task image that bakes in AgentEnv's proxy (
agents/agents/proxy/bake.sh, #578) installed its venv without compiled bytecode. So every fresh task container compiled the proxy's whole dependency tree on its first import, and 128 episodes starting at once spent their CPU compiling the same packages.bake.shnow installs the venv withuv pip install --compile-bytecode, once, as the image is built.Images baked before this keep working, since the install's marker check is unchanged; they just start slower.
Measured
128 concurrent episodes, as 4 processes × 32, over 16 task images, on one c6i.12xlarge with agentenv-framework 0.9.1491. Each task:
deploy_sandbox→run_docker_containerfrom an image artifact with the proxy baked in →install_agent→ a turn, ended at once → a container grader. Means over the four processes; one episode in 256 failed, on the local document store's write lock.install_agentThe time from turn end to reward dropped too, because the grader and the turn bookkeeping no longer compete with 128 containers compiling.
Tests
On Linux (Ubuntu 24.04, Python 3.12, Docker 29.9):
tst/integration/agent/proxy_local_container_test.pypasses. Its baked case builds a task image throughbake.shand plays an episode through the baked proxy.tst/integration/agent/proxy_container_install_test.pypasses.tst/unit/agents/proxypasses (13 tests).ruff checkis clean.🤖 Generated with Claude Code


Confidence Score: 5/5
This PR appears safe to merge.Summary
bake.shnow compiles dependency bytecode during image builds instead of leaving that work to each fresh container.Reviews (1) · Last reviewed commit: "perf(proxy): compile the baked proxy's b..." · Reviewed by Greptile