feat(docker): a control-plane image for agent_sys, carrying no engine - #149
feat(docker): a control-plane image for agent_sys, carrying no engine#149ChengYao-amd wants to merge 1 commit into
Conversation
4ec17ab to
94b88cf
Compare
| _start(registry, stream) | ||
| _settle(registry, stream, timeout=getattr(args, "timeout", None) or _SETTLE_TIMEOUT) | ||
| try: | ||
| if args.resume: |
There was a problem hiding this comment.
cli is entry, also provide cmd option to run agent_sys in docker container, but how to implement it should all live in env_mgr
and it should be a system/user layer to obey the whole env_mgr layers rules (as the very first layer): for example: dockerfile pre-install claude code sdk、senera、LSP, then, a agent env should use it according the env mgr rely system
There was a problem hiding this comment.
everything about how deploy docker container, mount what, expose what port to ensure every feature right. should be handle with env_mgr
| echo "[build] using the running ssh agent ($(ssh-add -l | wc -l) identity/identities)" | ||
| else | ||
| if [ -z "$SSH_KEY" ]; then | ||
| for candidate in "$HOME/.ssh/id_ed25519" "$HOME/.ssh/id_rsa" "$HOME/.ssh/id_ecdsa"; do |
There was a problem hiding this comment.
what is id_ed25519? some thing local? the ssh config should be detected by env_mgr and automatically copied into docker container while runtime. packaging key in dockerfile is dangerous
| [ -n "$TAG" ] || TAG="infera/agent-sys:latest" | ||
|
|
||
| # ---- BuildKit --------------------------------------------------------------- | ||
| if ! docker buildx version >/dev/null 2>&1; then |
There was a problem hiding this comment.
I think this file should be extremely thin(like the only reason it exists is there is too many options just using docker build xxx). but is not.
| fi | ||
| fi | ||
|
|
||
| # ----------------------------------------------------------------------- Magpie |
There was a problem hiding this comment.
no magpie please, it should run in the experiment env, not with agent_sys. even though sometimes the two use the same
|
|
||
| python3 - <<'PY' | ||
| import importlib.metadata as md | ||
| import pathlib |
There was a problem hiding this comment.
make it a demo, call it in one line
actually add a e2e_tests folder under tests, and run it in one line
There was a problem hiding this comment.
also, as default ai agent backend, it should be checked with agent_sys togather.
actually all simple test should use a e2e_test/xxx_task_package.
| # builds no engine. | ||
| deploy/docker/third_party | ||
|
|
||
| # Editors / OS |
There was a problem hiding this comment.
why this file even exist? build process should happens in a pure folder in which all materials are copied by build.sh into it.
| ca-certificates curl gnupg \ | ||
| git openssh-client rsync \ | ||
| bash coreutils findutils gzip tar xz-utils jq less procps tini \ | ||
| && update-ca-certificates |
There was a problem hiding this comment.
let add some debug friendly tools like zsh、oh-my-zsh、autosuggestion、tmux、https://github.com/gpakosz/.tmux
| && apt-get update \ | ||
| && apt-get install -y --no-install-recommends \ | ||
| ca-certificates curl gnupg \ | ||
| git openssh-client rsync \ |
There was a problem hiding this comment.
an sshd server is needed, and export sshd port to host, defult 18887, can be configed by cli opt or global config
| && /opt/venv/agent/bin/pip install -e "/opt/Magpie" | ||
|
|
||
| # ============================================================ stage: runtime == | ||
| FROM base AS runtime |
There was a problem hiding this comment.
the build process should be very fast so that agent_sys can be "build and run" every time on flight.
so this docker file can be optimized? also agent_sys should automatically build docker image if it's not exist and run in docker is required
| RUN --mount=type=cache,target=/var/cache/apt,sharing=locked \ | ||
| --mount=type=cache,target=/var/lib/apt/lists,sharing=locked \ | ||
| apt-get update \ | ||
| && apt-get install -y --no-install-recommends g++ |
There was a problem hiding this comment.
by bring task specific stuff to here, delete it all
There was a problem hiding this comment.
it's really a container for agent sys only
| && chmod 0755 /usr/local/bin/git | ||
|
|
||
| # The agent environment is the interpreter `python3` resolves to, because the | ||
| # task package bodies call `python3` by that name and `megapie.sh` calls |
There was a problem hiding this comment.
no task package relative things here
There was a problem hiding this comment.
and only one system python here, which is defined by base
| @@ -0,0 +1,376 @@ | |||
| # syntax=docker/dockerfile:1.7 | |||
There was a problem hiding this comment.
generally the agent_sys run root should default in a host viable mount, not overlay and not tmp. better nfs,implemented by env_mgr. configurable
825f102 to
33e7ab8
Compare
Add a lightweight Docker image that carries agent_sys, Claude Code CLI,
and standard tools (git, ssh, rsync, uv) but no inference engines or
task-specific dependencies. Those are installed by env_mgr at runtime
per each task package's environment recipe.
Key changes:
Docker image (deploy/docker/)
- Multi-stage Dockerfile: base → toolchain → venv-agent → runtime.
Magpie, compilers, and model weights are excluded by design.
- build.sh: thin wrapper around docker build with --tag support.
- README.md: build, usage (manual and --docker), and exit codes.
Container lifecycle (agent_sys/env_mgr/container.py)
- ContainerManager: build, start, exec, stop.
- Auto-detects and bind-mounts host ~/.ssh (ro) and ~/.claude.
- Generates /etc/passwd and /etc/group for arbitrary UID/GID.
CLI --docker mode (agent_sys/cli/main.py)
- --docker, --docker-image, --detect-and-copy-host-{ssh,claude}-config.
- Delegates the run into the container, stripping docker-specific flags.
Work root (agent_sys/cli/environment.py)
- INFERA_AGENT_SYSTEM_WORKROOT env var: names the run root directly.
- Falls back to $XDG_STATE_HOME/agent-sys-demo when unset.
- Empty or relative values are treated as unset.
Executor shutdown (agent_sys/agent/)
- claude_sdk.py: deterministic teardown -- disconnect, cancel pending
tasks, close the private event loop. Idempotent.
- runner.py: Runner.shutdown() releases all surviving attempts.
- cli/main.py: outer try/finally calls runner.shutdown() after the
run report, preventing leaked SDK reader tasks at process exit.
Tests
- test_claude_sdk.py: stop disconnects, cancels, and closes the loop.
- test_runner.py: shutdown stops and forgets every surviving attempt.
- test_shutdown.py: CLI-level shutdown is called on both success and
error paths.
- test_build.py: INFERA_AGENT_SYSTEM_WORKROOT precedence, relative
and empty values fall back correctly.
Co-authored-by: Cursor <cursoragent@cursor.com>
33e7ab8 to
12942d0
Compare
No description provided.