AEnvironment CLI User Guide#
This guide provides comprehensive documentation for all AEnvironment CLI commands and features, helping you efficiently manage AEnvironment projects and environments.
π Command Overview#
Usage: aenv [OPTIONS] COMMAND [ARGS]...
Aenv CLI helps build your custom aenv
Options:
--debug
-v, --verbose Enable verbose output
--help Show this message and exit.
Commands:
build Build Docker images with real-time progress display.
config Manage CLI configuration.
get Get specified environment details
init Initialize aenv project using environmental scaffolding tools
instance Manage environment instances (create, list, get, delete)
instances List running environment instances (legacy command)
list List all environments with pagination
push Push current aenv project to remote backend aenv hub
release Release current aenv project
service Manage environment services (create, list, get, delete, update)
test Test current aenv project by running local directly
version Display version number and corresponding build/commit information
Command Category |
Command |
Description |
|---|---|---|
Project Lifecycle |
|
Initialize new project |
|
Build container images |
|
|
Validate environment configuration |
|
|
Push environment to repository |
|
Environment Management |
|
List all environments |
|
Get environment details |
|
Instance Management |
|
Manage environment instances |
|
List running instances (legacy) |
|
Service Management |
|
Manage environment services |
Configuration Management |
|
Manage CLI configuration |
System Information |
|
Display version information |
π Quick Start#
Typical Workflow#
# 1. Create new project
aenv init my-search-env --template default
# 2. Validate configuration
aenv run --work-dir ./my-search-env
# 3. Build image
aenv build --work-dir ./my-search-env --image-tag v1.0.0
# 4. Push to repository
aenv push --work-dir ./my-search-env --version 1.0.0
# 5. Release environment
aenv release --work-dir ./my-search-env
π οΈ Project Lifecycle Commands#
aenv init - Initialize Project#
Create a new AEnvironment project with support for multiple templates.
Basic Usage#
Usage: aenv init [OPTIONS] NAME
Initialize aenv project using scaffolding tools
NAME: aenv name
Examples:
aenv init myproject --version 1.0.0
aenv init myproject --template default --work-dir ./myproject --force
aenv init myproject --version 1.0.0 --config-only
Options:
-v, --version TEXT Specify aenv version number
-t, --template [default] Scaffolding template selection
-w, --work-dir TEXT Working directory for initialization
--force Force overwrite existing directory
--config-only Only create config.json file, skip other files and directories
--help Show this message and exit.
Available Templates#
Template Name |
Description |
Use Cases |
|---|---|---|
|
Basic template |
General environments |
Project Structure#
my-project/
βββ config.json # Environment configuration
βββ Dockerfile # Container definition
βββ requirements.txt # Python dependencies
βββ src/ # Source code
β βββ __init__.py
β βββ custom_env.py
βββ test/ # Test files
βββ README.md # Project documentation
config.json: Defines environment metadata including build configuration, test scripts, deployment resource requirements, and version information
Configuration Example
{
"name": "aenv",
"version": "1.0.0",
"tags": ["linux"],
"status": "Ready",
"codeUrl": "",
"artifacts": [],
"buildConfig": {
"dockerfile": "./Dockerfile"
},
"testConfig": {
"script": ""
},
"deployConfig": {
"cpu": "1",
"memory": "2Gi",
"os": "linux",
"ephemeralStorage": "5Gi",
"environmentVariables": {},
"service": {
"replicas": 1,
"port": 8081,
"enableStorage": false,
"storageName": "aenv",
"storageSize": "10Gi",
"mountPath": "/home/admin/data"
}
}
}
Note: This is the default template structure. Additional fields like
imagePrefixandpodTemplatecan be added as needed for specific deployment scenarios.
Dockerfile
The final deliverable is primarily a container image, with the Dockerfile defining base configuration, dependency installation, and environment variable setup.
src
Environment business logic code is placed in the src directory. Use @register decorators to register code as corresponding tools, functions, and rewards.
Config-Only Mode#
Use --config-only flag to create only the config.json file without generating other project files and directories. This is useful when you already have a project structure and only need the configuration file.
# Create only config.json in current directory
aenv init myproject --version 1.0.0 --config-only
# Create config.json in specified directory
aenv init myproject --version 1.0.0 --config-only --work-dir ./myproject
# Force overwrite existing config.json
aenv init myproject --version 1.0.0 --config-only --force
Note: When using
--config-only, theconfig.jsoncontent is loaded from the template file, ensuring consistency with the full initialization process.
aenv run - Validate Environment#
After code development, use the run command for local validation.
Run Basic Usage#
Usage Details
Usage: aenv run [OPTIONS]
Test current aenv project by running local directly
Examples:
aenv run --work-dir /tmp/aenv/search
Options:
--work-dir TEXT Specify aenv development root directory
--inspector-port INTEGER MCP Inspector port
--help Show this message and exit.
# Validate current directory
aenv run
# Specify working directory
aenv run --work-dir ./my-project
Output Example
βΉοΈ π Starting aenv project validation...
Working Directory: /AEnvironment/aenv/hello
Inspector Port: 6274
βΉοΈ π Validating working environment...
β
β
Working environment validation passed
βΉοΈ π§ Checking dependencies...
β
β
Dependency check passed
βΉοΈ π¦ Installing MCP Inspector...
MCP Inspector Is Installed...!
β
β
MCP Inspector installation completed
βΉοΈ π Starting MCP server and Inspector...
Press Ctrl+C to stop services
2025-12-09 17:18:21,875 - mcp_manager - INFO - π Starting MCP server and Inspector...
2025-12-09 17:18:21,875 - mcp_manager - INFO - Starting task: mcp_server - python -m aenv.
Validation Checks#
β Configuration file format validation
β Code correctness verification
β Dependency completeness check
β MCP service functionality verification
aenv build - Build Images#
Build Docker container images with real-time progress display.
Build Basic Usage#
Usage Details
Usage: aenv build [OPTIONS]
Build Docker images with real-time progress display.
This command builds Docker images from your project and provides real-time
progress updates with beautiful UI components.
Examples:
aenv build
aenv build --image-name myapp --image-tag v1.0
aenv build --work-dir ./myproject --registry myregistry.com
aenv build --work-dir ./build --dockerfile ./Dockerfile.prod
Options:
-w, --work-dir DIRECTORY Docker build context directory (defaults to current directory)
-n, --image-name TEXT Name for the Docker image
-t, --image-tag TEXT Tags for the Docker image (can be used multiple
times)
-r, --registry TEXT Docker registry URL
-s, --namespace TEXT Namespace for the Docker image
--push / --no-push Push image to registry after build
-p, --platform TEXT Platform for the Docker image
-f, --dockerfile TEXT Path to the Dockerfile (relative to work-dir, defaults to Dockerfile)
--help Show this message and exit.
# Basic build
aenv build
# Specify working directory
aenv build --work-dir ./my-project
# Custom image name
aenv build --image-name my-custom-env
# Multiple tags
aenv build --image-tag v1.0.0 --image-tag latest
# Specify platform
aenv build --platform linux/amd64,linux/arm64
# Specify custom Dockerfile
aenv build --work-dir ./build --dockerfile ./Dockerfile.prod
Advanced Options#
Option |
Short |
Description |
Example |
|---|---|---|---|
|
|
Docker build context directory |
|
|
|
Image name |
|
|
|
Image tags |
|
|
|
Registry URL |
|
|
|
Namespace |
|
|
|
Target platform |
|
|
Push after build |
|
|
|
|
Path to Dockerfile (relative to work-dir) |
|
Important Notes#
config.json location: The
config.jsonfile must be in the current working directory (where you run the command), not in the--work-dirdirectory.work-dir purpose: The
--work-diroption specifies the Docker build context directory, which is used as the base path for Dockerfile and all files referenced in it (COPY, ADD, etc.).Dockerfile path: The
--dockerfilepath is relative to--work-dir. If not specified, defaults toDockerfilein the--work-dirdirectory.
Build Output Example#

aenv push - Push Environment#
Push the built environment to a remote repository.
Push Basic Usage#
# Push current environment
aenv push
# Specify version
aenv push --version 1.0.0
# Specify working directory
aenv push --work-dir ./my-project
# Push to specific registry
aenv push --registry registry.company.com
Push Options#
Option |
Description |
Example |
|---|---|---|
|
Specify version number |
|
|
Target registry |
|
|
Namespace |
|
|
Force overwrite |
|
π Environment Management Commands#
aenv list - List Environments#
Display all available AEnvironment environments.
List Basic Usage#
# List all environments
aenv list
# Table format display
aenv list --format table
# JSON format output
aenv list --format json
# Pagination display
aenv list --limit 20 --offset 0
# Filter by name
aenv list --name search
# Filter by tags
aenv list --tags python,search
Output Format#
$ aenv list --format table
+---------------------------+------------+---------------+-------------------------------------+
| Name | Version | Description | Created At |
+===========================+============+===============+=====================================+
| swebench-env | 1.0.2 | | 2025-12-08T14:21:04.143332845+08:00 |
+---------------------------+------------+---------------+-------------------------------------+
| test-search-env | 1.0.0 | | 2025-11-27T11:41:42.212945201+08:00 |
+---------------------------+------------+---------------+-------------------------------------+
| mini-swe-agent-env | 1.1.1 | | 2025-11-24T23:21:35.882220449+08:00 |
+---------------------------+------------+---------------+-------------------------------------+
aenv instances - List Running Instances#
List running environment instances with detailed information.
Instances Basic Usage#
# List all running instances
aenv instances
# List instances for a specific environment
aenv instances --name my-env
# List instances for a specific environment and version
aenv instances --name my-env --version 1.0.0
# Output as JSON
aenv instances --format json
# Use custom system URL
aenv instances --system-url http://api.example.com:8080
Instances Options#
Option |
Short |
Description |
Example |
|---|---|---|---|
|
|
Filter by environment name |
|
|
|
Filter by environment version (requires βname) |
|
|
|
Output format (table or json) |
|
|
AEnv system URL (defaults to AENV_SYSTEM_URL env var) |
|
Instances Output Format#
$ aenv instances
+---------------+---------------+-----------+----------+------+----------------------+
| Instance ID | Environment | Version | Status | IP | Created At |
+===============+===============+===========+==========+======+======================+
| test01-tb9gp8 | test01 | 1.0.0 | Running | - | 2026-01-12T03:25:46Z |
+---------------+---------------+-----------+----------+------+======================+
| test01-ccp5v4 | test01 | 1.0.0 | Running | - | 2026-01-12T03:25:50Z |
+---------------+---------------+-----------+----------+------+----------------------+
Environment Variables#
You can configure the API URL using environment variables:
# Set API URL (must include port 8080)
export AENV_SYSTEM_URL=http://api-service:8080
# Set API key (if authentication is enabled)
export AENV_API_KEY=your-token-here
# Then run the command
aenv instances
Instances Notes#
API URL: The CLI automatically uses port 8080 for the system URL. If you provide a URL with a different port, it will be adjusted.
Authentication: If token authentication is enabled, set the
AENV_API_KEYenvironment variableInstance ID Format: Instance IDs typically follow the pattern
environment-name-randomid(e.g.,test01-tb9gp8)Filtering: Use
--nameto filter by environment name, optionally combined with--versionfor more specific filtering
aenv instance - Manage Environment Instances#
Unified interface for managing environment instances with full lifecycle control.
Note:
aenv instanceis the new command group that replaces and extends the legacyaenv instancescommand with additional capabilities like creating and deleting instances.
Instance Subcommands#
Subcommand |
Description |
|---|---|
|
Create new environment instance |
|
List running instances |
|
Get instance details by ID |
|
Delete an instance |
|
Get instance information (requires active instance) |
instance create - Create Instance#
Create and deploy a new environment instance.
Basic Usage:
# Create using config.json in current directory
aenv instance create
# Create with explicit environment name
aenv instance create flowise-xxx@1.0.2
# Create with custom TTL and environment variables
aenv instance create flowise-xxx@1.0.2 --ttl 1h -e DB_HOST=localhost -e DB_PORT=5432
# Create with arguments and skip health check
aenv instance create flowise-xxx@1.0.2 --arg --debug --arg --verbose --skip-health
# Create and keep alive (doesn't auto-release)
aenv instance create flowise-xxx@1.0.2 --keep-alive
Options:
Option |
Short |
Description |
Default |
|---|---|---|---|
|
|
Data source for mounting |
- |
|
|
Time to live (e.g., 30m, 1h) |
30m |
|
|
Environment variables (KEY=VALUE) |
- |
|
|
Command line arguments |
- |
|
AEnv system URL |
from env/config |
|
|
Request timeout in seconds |
60.0 |
|
|
Startup timeout in seconds |
500.0 |
|
|
Maximum retry attempts |
10 |
|
|
API key for authentication |
from env |
|
|
Skip health check |
false |
|
|
|
Output format (table/json) |
table |
|
Keep instance running |
false |
|
|
Owner of the instance |
from config |
Important Notes:
By default, instances are automatically released when the command exits
Use
--keep-aliveto keep the instance running after deploymentWithout
--keep-alive, the instance lifecycle is tied to the command execution
instance list - List Instances#
List running environment instances with filtering options.
# List all running instances
aenv instance list
# List instances for a specific environment
aenv instance list --name my-env
# List instances for a specific environment and version
aenv instance list --name my-env --version 1.0.0
# Output as JSON
aenv instance list --output json
instance get - Get Instance Details#
Retrieve detailed information about a specific instance by its ID.
# Get instance information
aenv instance get flowise-xxx-abc123
# Get in JSON format
aenv instance get flowise-xxx-abc123 --output json
instance delete - Delete Instance#
Delete a running environment instance.
# Delete an instance (with confirmation)
aenv instance delete flowise-xxx-abc123
# Delete without confirmation
aenv instance delete flowise-xxx-abc123 --yes
aenv service - Manage Environment Services#
Manage long-running environment services with persistent deployments, multiple replicas, and storage support.
Service vs Instance: Services are persistent deployments without TTL, supporting multiple replicas, persistent storage, and cluster DNS service URLs. Instances are temporary with TTL and auto-cleanup.
Service Subcommands#
Subcommand |
Description |
|---|---|
|
Create new service deployment |
|
List running services |
|
Get service details by ID |
|
Delete a service |
|
Update service configuration |
service create - Create Service#
Create a long-running service with Deployment, Service, and optionally persistent storage.
Basic Usage:
# Create using config.json in current directory
aenv service create
# Create with explicit environment name
aenv service create myapp@1.0.0
# Create with custom service name
aenv service create myapp@1.0.0 --service-name my-custom-service
# Create with 3 replicas and custom port (no storage)
aenv service create myapp@1.0.0 --replicas 3 --port 8000
# Create with storage enabled (storageSize must be in config.json)
aenv service create myapp@1.0.0 --enable-storage
# Create with environment variables
aenv service create myapp@1.0.0 -e DB_HOST=postgres -e CACHE_SIZE=1024
Options:
Option |
Short |
Description |
Default |
|---|---|---|---|
|
|
Custom service name (must follow Kubernetes DNS naming conventions) |
auto-generated as |
|
|
Number of replicas |
1 or from config |
|
|
Service port |
8080 or from config |
|
|
Environment variables (KEY=VALUE) |
- |
|
Enable persistent storage |
false |
|
|
|
Output format (table/json) |
table |
Configuration Priority:
CLI parameters (
--replicas,--port,--enable-storage)config.jsonβsdeployConfig.service(new structure)config.jsonβsdeployConfig(legacy flat structure)System defaults
Storage Configuration:
Storage settings are read from config.jsonβs deployConfig.service:
storageSize: Storage size like β10Giβ, β20Giβ (required when--enable-storageis used)storageName: Storage name (default: environment name)mountPath: Mount path (default: /home/admin/data)
Important Notes:
When storage is enabled, replicas must be 1 (enforced by backend)
Services run indefinitely without TTL
Services get cluster DNS service URLs for internal access
Service Name: Custom service names must follow Kubernetes DNS naming conventions:
Use only lowercase letters, numbers, hyphens, and dots
Start and end with an alphanumeric character
Be no longer than 253 characters
Example:
my-service,app-v1,web-frontend-prodIf not specified, auto-generated as
{envName}-svc-{random}(e.g.,myapp-svc-abc123)
The service name becomes:
Kubernetes Deployment name
Kubernetes Service name
Service URL prefix:
{serviceName}.{namespace}.{domain}:{port}Unique identifier for all operations (get, update, delete)
service list - List Services#
List running environment services.
# List all services
aenv service list
# List services for specific environment
aenv service list --name myapp
# Output as JSON
aenv service list --output json
Output Example:
$ aenv service list
+------------------+-------------+---------+--------+----------+----------+--------------+----------------------+
| Service ID | Environment | Owner | Status | Replicas | Storage | Service URL | Created At |
+==================+=============+=========+========+==========+==========+==============+======================+
| myapp-svc-abc123 | myapp@1.0.0 | user1 | Ready | 3/3 | myapp-pvc| myapp-svc... | 2026-01-19T10:30:00Z |
+------------------+-------------+---------+--------+----------+----------+--------------+----------------------+
service get - Get Service Details#
Retrieve detailed information about a specific service.
# Get service information
aenv service get myapp-svc-abc123
# Get in JSON format
aenv service get myapp-svc-abc123 --output json
service delete - Delete Service#
Delete a running service. By default, keeps storage for reuse.
# Delete a service (with confirmation), keep storage
aenv service delete myapp-svc-abc123
# Delete without confirmation
aenv service delete myapp-svc-abc123 --yes
# Delete service and storage
aenv service delete myapp-svc-abc123 --delete-storage
Options:
Option |
Description |
|---|---|
|
Skip confirmation prompt |
|
Also delete associated storage (WARNING: permanent data loss) |
Important Notes:
By default, storage is kept for reuse when deleting a service
Use
--delete-storageto permanently delete storage and all data
service update - Update Service#
Update a running serviceβs configuration.
# Scale to 5 replicas
aenv service update myapp-svc-abc123 --replicas 5
# Update image
aenv service update myapp-svc-abc123 --image myapp:2.0.0
# Update environment variables
aenv service update myapp-svc-abc123 -e DB_HOST=newhost -e DB_PORT=3306
# Update multiple things at once
aenv service update myapp-svc-abc123 --replicas 3 --image myapp:2.0.0
Options:
Option |
Short |
Description |
|---|---|---|
|
|
Update number of replicas |
|
Update container image |
|
|
|
Environment variables (KEY=VALUE) |
|
|
Output format (table/json) |
Important Notes:
At least one of
--replicas,--image, or--envmust be providedEnvironment variable updates merge with existing variables
aenv get - Get Environment Details#
Retrieve detailed information about a specific environment.
Get Basic Usage#
# Get environment details
aenv get search-env
# Specify version
aenv get search-env --version 1.0.0
# JSON format output
aenv get search-env --format json
Get Output Example#
{
"id": "search-1.0.0",
"name": "search",
"description": "",
"version": "1.0.0",
"tags": [
"swe",
"python",
"linux"
],
"code_url": "~/.aenv/search-code.tar.gz",
"status": 6,
"artifacts": [
{
"id": "",
"type": "image",
"content": "docker.io/xxxx/image:search-1.0.0-v3"
}
],
"build_config": {
"dockerfile": "./Dockerfile"
},
"test_config": {
"script": "pytest xxx"
},
"deploy_config": {
"cpu": "1C",
"memory": "2G",
"os": "linux"
}
}
Note: Requires non-local mode to use.
βοΈ Configuration Management Commands#
aenv config - Configuration Management#
Manage CLI configuration and settings.
Subcommands#
config show - Display Configuration#
# Show all configurations
aenv config show
# JSON format
aenv config show --format json
config get - Get Configuration#
# Get specific value
aenv config get global_mode
config init - Initialize Configuration#
# Create default configuration
aenv config init
π System Information Commands#
aenv version - Version Information#
Display CLI version and build information.
Version Basic Usage#
# Show version only
aenv version -s
# JSON format
aenv version --format json
Version Output Example#
$ aenv version
AEnv CLI Version: 0.1.0
Build Date: 2024-01-15
Git Commit: abc123def
Go Version: go1.21.0
Platform: linux/amd64
Python Version: 3.12.0
π― Practical Usage Examples#
Scenario 1: Developing New Environment#
# 1. Create search tool environment
aenv init search-tool --template search
# 2. Modify configuration
cd search-tool
# Edit config.json and Dockerfile
# 3. Implement business logic
@register_tool
@register_function
@register_reward
Scenario 2: CI/CD Integration#
# Use in CI scripts
#!/bin/bash
set -e
# Validate environment
aenv run --work-dir ./project
# Build and push
aenv build --work-dir ./project \
--image-tag ${BUILD_NUMBER} \
--registry registry.company.com \
--push
# Publish
aenv push
π Quick Reference#
Common Command Combinations#
# Complete workflow
aenv init β aenv run β aenv build β aenv push
# Environment management
aenv list β aenv get β aenv push
# Instance management
aenv instances β aenv instances --name <env> β aenv instances --format json
# Configuration management
aenv config path β aenv config set β aenv config show
Debug Commands#
# Verbose output
aenv --verbose <command>