Skip to content

Accept trial parameters

HyperOptimizer passes trial parameters to your program as command-line arguments. These workload flags are separate from the hpo CLI installed on your computer. No SDK is needed to receive them.

Every optimized parameter is passed with the --hpo- prefix unless you change flag mode in the experiment workbench.

--hpo-lookback-window=50
--hpo-risk-multiplier=1.4
--hpo-timeframe=5m

Most Python CLI parsers expose these as underscore names, such as args.hpo_lookback_window.

In the command workbench you can switch managed parameters to plain flags:

--lookback-window=50
--risk-multiplier=1.4

Use this when your entrypoint already expects unprefixed names. Keep dashboard slugs aligned with the flags your parser declares.

A custom command template replaces the full container argument list. It substitutes {{slug}} placeholders; parameters omitted from the template are not appended automatically. Include every input your program needs.

--config prod.yaml --hpo-lookback-window {{lookback-window}}

This example assumes the image entrypoint runs your program. For a CMD-only image, include the executable and script too; see ENTRYPOINT and CMD. Templates are parsed as arguments, not executed as shell scripts: do not rely on pipes, redirects, or shell variable expansion. Full-line # comments are removed. Prefer the default --hpo-* contract unless you have a reason to customize.

import argparse
def parse_args():
parser = argparse.ArgumentParser()
parser.add_argument("--hpo-lookback-window", type=int, required=True)
parser.add_argument("--hpo-risk-multiplier", type=float, required=True)
parser.add_argument("--hpo-timeframe", type=str, default="5m")
return parser.parse_args()
args = parse_args()

Keep the HPO boundary small. Parse the CLI arguments near your entrypoint, then pass clean domain values into your model, backtest, or simulation.

config = StrategyConfig(
lookback_window=args.hpo_lookback_window,
risk_multiplier=args.hpo_risk_multiplier,
timeframe=args.hpo_timeframe,
)
result = run_backtest(config)

True/false values arrive as strings. In Python, avoid type=bool: even bool("false") is true. Parse explicit choices instead:

parser.add_argument("--hpo-use-filter", choices=["true", "false"], required=True)
# After parse_args():
use_filter = args.hpo_use_filter == "true"

Next: report metrics and check the argument reference.