Agent Sandbox Registry

agent-sandbox

Decision: Add guided configuration wizard (abx config init) to the abx CLI

无中文版

.agents/notes/implemented/feature/2026-09-29-config-init-wizard.md

Decision: Add guided configuration wizard (abx config init) to the abx CLI

Status: implemented Proposed: 2026-09-29 Implemented: 2026-09-29

Problem

New users had to manually discover and set multiple configuration values (api_key, region, LLM/Qwen Code credentials) through individual abx config set calls. There was no guided onboarding flow, which led to:

Decision

Add abx config init as an interactive configuration wizard covering the three values a new user needs most: platform API key, default region, and Qwen Code (AI) credentials.

Interactive behaviour (TTY only):

  1. Platform API key — hidden input, stored as E2B_API_KEY in ~/.abx/.env via the existing write_env_var helper. Empty input skips.
  2. Default region — prefilled with the currently stored region (or cn-hangzhou), persisted through _save_config_dict into ~/.abx/config.toml. Empty input keeps the current value.
  3. Qwen Code API key — hidden input, stored as ABX_QWEN_CODE_API_KEY in ~/.abx/.env; this is the credential read first by the AI create path.

Non-interactive safety (never blocks):

New configuration keys introduced alongside the wizard:

Key Storage Purpose
qwen_code_api_key ~/.abx/.env (ABX_QWEN_CODE_API_KEY) AI template generation credentials
qwen_code_base_url ~/.abx/config.toml OpenAI-compatible base URL (default DashScope compatible-mode)
qwen_code_model ~/.abx/config.toml Model name (default qwen3-coder-plus)

API Design

# CLI command (src/agent_sandbox/cli/commands/config_cmd.py)
@click.option("--yes", "-y", is_flag=True,
              help="Non-interactive: print the equivalent commands instead of prompting")
@click.pass_context
@handle_errors
def init(ctx: click.Context, yes: bool) -> None:
    """Guided setup: platform credentials, region, and Qwen Code (AI)."""

def _print_noninteractive_setup() -> None:
    """Print the non-interactive commands equivalent to the guided wizard."""

The wizard reuses the existing config infrastructure only: load_config_dict / _save_config_dict for config.toml, and write_env_var / read_env_var for ~/.abx/.env (with the same masking applied by abx config list / abx config get).

Alternatives considered

Dependencies

Test Strategy

tests/test_cli/test_config_init.py (7 tests, fully offline — all storage paths patched to tmp_path):

Acceptance criteria

Implementation

Evidence

Files changed