Implementation:AMAP ML SkillClaw EvolveServer CLI
| Knowledge Sources | |
|---|---|
| Domains | Skill_Evolution, CLI, Configuration |
| Last Updated | 2026-10-22 00:00 GMT |
Overview
Concrete CLI entry point for launching the SkillClaw evolve server (`python -m evolve_server` / `skillclaw-evolve-server`), merging CLI arguments, environment variables, and optionally skillclaw client config into an `EvolveServerConfig` before dispatching to the workflow or agent engine.
Description
The evolve_server.__main__ module provides the command-line interface for the evolve server. The `build_parser()` function defines 30+ CLI flags covering engine selection (`--engine workflow|agent`), storage backend configuration (`--storage-backend`, `--local-root`, `--mock`), LLM settings (`--model`, `--llm-api-type`), validation thresholds (`--validation-required-results`, `--validation-min-mean-score`), and publishing modes (`--publish-mode`, `--nacos-publish-mode`). The `_build_config_from_args()` function merges these flags with environment variables and optionally the skillclaw config store (`--use-skillclaw-config`) into an `EvolveServerConfig`. The `main()` function validates storage backend requirements, then runs the server in one of three modes: once (`--once`/`--mock`), periodic (`--interval`), or HTTP-trigger (`--port`).
Usage
Import or invoke this module when you need to:
- Launch the evolve server from the command line: `python -m evolve_server` or `skillclaw-evolve-server`
- Understand CLI flag to `EvolveServerConfig` field mapping
- Run a single evolution cycle in mock mode: `python -m evolve_server --mock --once`
- Start an HTTP-triggered evolve server alongside a dashboard: `python -m evolve_server --port 8080`
- Configure validation thresholds via CLI for the workflow engine
Code Reference
Source Location
- Repository: SkillClaw
- File: `evolve_server/__main__.py:L1-303`
Signature
def build_parser() -> argparse.ArgumentParser:
"""Build the CLI argument parser with 30+ flags for engine, storage,
LLM, validation, and publishing configuration."""
def _build_config_from_args(args: argparse.Namespace) -> EvolveServerConfig:
"""Merge CLI args, environment variables, and optionally skillclaw
config into an EvolveServerConfig."""
def _build_server(
config: EvolveServerConfig,
*,
mock: bool = False,
mock_root: str | None = None,
) -> EvolveServer | AgentEvolveServer:
"""Instantiate the correct engine based on config.engine."""
def main() -> None:
"""Parse args, build config, validate storage, and run the server
in once/periodic/HTTP mode."""
Import
from evolve_server.__main__ import build_parser, main
I/O Contract
Inputs
| Name | Type | Required | Description |
|---|---|---|---|
| args | argparse.Namespace | Yes | Parsed CLI arguments |
| EvolveServerConfig.from_env() | EvolveServerConfig | Yes | Base config from environment variables |
| ConfigStore().to_skillclaw_config() | SkillClawConfig | No | Optional skillclaw client config (when `--use-skillclaw-config`) |
| --engine | str | No | Engine type: "workflow" or "agent" |
| --mock | bool | No | Use local mock directory instead of remote storage |
| --port | int | No | HTTP trigger port (enables HTTP server mode) |
| --once | bool | No | Run one cycle and exit |
| --interval | int | No | Periodic interval in seconds |
| --storage-backend | str | No | Storage backend: local, s3, or oss |
| --local-root | str | No | Local directory as evolve backend root |
| --publish-mode | str | No | "direct" or "validated" |
| --validation-required-results | int | No | Min client validation results before publish |
| --validation-min-mean-score | float | No | Min mean client validation score [0,1] |
| --use-skillclaw-config | bool | No | Load shared storage and LLM settings from skillclaw config |
| --model | str | No | LLM model name |
| --llm-api-type | str | No | LLM provider API type |
| --openclaw-bin | str | No | Path to openclaw executable (agent engine) |
| --agent-timeout | int | No | Agent execution timeout in seconds |
| --fresh | bool | No | Wipe agent state each cycle (agent engine only) |
Outputs
| Name | Type | Description |
|---|---|---|
| stdout (once mode) | JSON string | JSON summary of the evolution cycle |
| HTTP server (port mode) | uvicorn.Server | Serves HTTP trigger endpoint alongside periodic evolution |
| side effect | EvolveServerConfig | Configured EvolveServerConfig passed to engine |
| exit code | int | SystemExit(1) on configuration errors |
Usage Examples
Mock Mode Single Run
# Run one evolution cycle using local mock storage
# python -m evolve_server --mock --once
import asyncio
from evolve_server.__main__ import build_parser, _build_config_from_args, _build_server
parser = build_parser()
args = parser.parse_args(["--mock", "--once"])
config = _build_config_from_args(args)
server = _build_server(config, mock=True)
summary = asyncio.run(server.run_once())
print(json.dumps(summary, indent=2, ensure_ascii=False))
HTTP-Triggered Workflow Engine
# Start evolve server with HTTP trigger on port 8080
# python -m evolve_server --engine workflow --port 8080 --storage-backend s3 \
# --storage-bucket my-bucket --use-skillclaw-config
from evolve_server.__main__ import build_parser, _build_config_from_args, _build_server
parser = build_parser()
args = parser.parse_args([
"--engine", "workflow",
"--port", "8080",
"--storage-backend", "s3",
"--storage-bucket", "my-bucket",
"--use-skillclaw-config",
])
config = _build_config_from_args(args)
server = _build_server(config)
# server.create_http_app() returns a FastAPI app for uvicorn
Agent Engine with Validation
# Run agent engine with validation gating
# python -m evolve_server --engine agent --openclaw-bin /usr/bin/openclaw \
# --validation-required-results 3 --validation-min-mean-score 0.75
from evolve_server.__main__ import build_parser, _build_config_from_args, _build_server
parser = build_parser()
args = parser.parse_args([
"--engine", "agent",
"--openclaw-bin", "/usr/bin/openclaw",
"--validation-required-results", "3",
"--validation-min-mean-score", "0.75",
])
config = _build_config_from_args(args)
server = _build_server(config)
# Agent engine runs with validated publish mode