MCPcopy Create free account
hub / github.com/FareedKhan-dev/ai-long-task / parse_args

Function parse_args

cli.py:21–72  ·  view source on GitHub ↗

Parse command-line arguments

()

Source from the content-addressed store, hash-verified

19
20
21def parse_args() -> argparse.Namespace:
22 """Parse command-line arguments"""
23 # Create an ArgumentParser object to handle command-line arguments
24 parser = argparse.ArgumentParser(description="LongHorizon - Evolutionary coding agent")
25
26 # Define a required positional argument for the initial program file
27 parser.add_argument("initial_program", help="Path to the initial program file")
28
29 # Define a required positional argument for the evaluation script
30 parser.add_argument(
31 "evaluation_file", help="Path to the evaluation file containing an 'evaluate' function"
32 )
33
34 # Define an optional argument for the configuration file path
35 parser.add_argument("--config", "-c", help="Path to configuration file (YAML)", default=None)
36
37 # Define an optional argument for the output directory
38 parser.add_argument("--output", "-o", help="Output directory for results", default=None)
39
40 # Define an optional argument to override the number of iterations
41 parser.add_argument(
42 "--iterations", "-i", help="Maximum number of iterations", type=int, default=None
43 )
44
45 # Define an optional argument to set a target score for early stopping
46 parser.add_argument(
47 "--target-score", "-t", help="Target score to reach", type=float, default=None
48 )
49
50 # Define an optional argument to override the logging level
51 parser.add_argument(
52 "--log-level",
53 "-l",
54 help="Logging level",
55 choices=["DEBUG", "INFO", "WARNING", "ERROR", "CRITICAL"],
56 default=None,
57 )
58
59 # Define an optional argument to specify a checkpoint to resume from
60 parser.add_argument(
61 "--checkpoint",
62 help="Path to checkpoint directory to resume from (e.g., longhorizon_output/checkpoints/checkpoint_50)",
63 default=None,
64 )
65
66 # Define optional arguments to override LLM settings directly from the command line
67 parser.add_argument("--api-base", help="Base URL for the LLM API", default=None)
68 parser.add_argument("--primary-model", help="Primary LLM model name", default=None)
69 parser.add_argument("--secondary-model", help="Secondary LLM model name", default=None)
70
71 # Parse the arguments and return the resulting namespace object
72 return parser.parse_args()
73
74
75async def main_async() -> int:

Callers 1

main_asyncFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected