Decision: template deploy one-shot deployment command
Status: implemented Implemented: 2026-09-09
Problem
The full template release flow involves several steps: (1) build the Docker
image; (2) push it to ACR (Alibaba Cloud Container Registry); (3) call the
CreateTemplate API to create/update the template. Users had to run
abx template build, abx template push, and abx template create in
sequence, which is tedious and easy to skip steps in. A one-shot command that
merges these three steps is needed.
Decision
Add the abx template deploy command, which encapsulates the full pipeline
build → push → create.
Core design
abx template deployis a superset ofabx template build: it runs the full image build, ACR push, and CreateTemplate API call.- Parameter reuse: the
deploycommand's parameter set is identical tobuild's (viaparams=list(build.params)on theclick.command), so users don't need to learn new parameters. - Implementation: internally
deploycallsctx.invoke(build, **kwargs)and runs thebuildcommand as a subprocess (thebuildcommand already contains the push + create logic).
The coexisting abx deploy
abx deploy(top-level shortcut) has a different meaning fromtemplate deploy.abx deployis a project-deployment command (NL mode or traditional mode) that deploys a user project into a sandbox to run.abx template deployis a template-release command that publishes a template image to the platform.
| Command | Meaning | Source |
|---|---|---|
abx deploy ./project |
Project deployment (into a sandbox) | cli/commands/deploy.py |
abx template deploy |
Template release (to the platform) | cli/commands/template.py |
API Design
# one-shot template release (build + push + create)
abx template deploy ./examples/templates/python-hello \
--alias python-hello \
--timeout 300
# equivalent to running in sequence:
# abx template build → abx template push → abx template create
# project deployment (different command)
abx deploy ./my-project "deploy this FastAPI project"
Alternatives considered
- Keep only
build, without addingdeploy— users would need to know thatbuildalready includes push + create; the naming is not intuitive. Rejected. - Implement
deployindependently instead of reusingbuild— causes code duplication, andbuild's parameter set is already comprehensive. Rejected. - Merge
abx deployandabx template deploy— their semantics are entirely different (project deployment vs template release); merging would cause confusion. Rejected.
Dependencies
cli/commands/template.py(thebuildsubcommand's parameter definitions)api/docker_builder.py(Docker image build)api/deploy.py(ACR push)api/fc_template.py(CreateTemplate API)
Test Strategy
abx template deploy --helpoutput matchesbuild's parameters.- End-to-end: the
deploycommand runs build, push, and create in sequence. - Error propagation: when the build step fails,
deployreports the error correctly and exits.
Acceptance criteria
- ✅ The
abx template deploycommand is available and completes build → push → create in one command. - ✅ Its parameter set is identical to
build's, requiring no new parameter learning. - ✅
abx deploy(project deployment) andabx template deploy(template release) have clear, non-conflicting semantics.
Implementation
- template deploy: the
deployfunction insrc/agent_sandbox/cli/commands/template.py - Top-level deploy: the
deploy_shortcutfunction insrc/agent_sandbox/cli/commands/deploy.py - Docker build:
src/agent_sandbox/api/docker_builder.py - ACR push:
src/agent_sandbox/api/deploy.py - FC CreateTemplate:
src/agent_sandbox/api/fc_template.py - Tests:
tests/test_cli/test_template*.py