@@ -115,6 +115,8 @@ def init_project(
115115 description : Optional [str ] = None ,
116116 system_prompt : Optional [str ] = None ,
117117 model_name : Optional [str ] = None ,
118+ model_api_base : Optional [str ] = None ,
119+ model_api_key : Optional [str ] = None ,
118120 tools : Optional [str ] = None ,
119121 ) -> InitResult :
120122 """
@@ -193,7 +195,11 @@ def init_project(
193195 )
194196
195197 render_context = self ._build_render_context (
196- agent_name , description , system_prompt , model_name , tools
198+ agent_name ,
199+ description ,
200+ system_prompt ,
201+ model_name ,
202+ tools ,
197203 )
198204
199205 if source_path .is_dir ():
@@ -222,6 +228,14 @@ def init_project(
222228 else :
223229 entry_point_name = file_name
224230
231+ runtime_envs = None
232+ if model_api_base or model_api_key :
233+ runtime_envs = {}
234+ if model_api_base :
235+ runtime_envs ["MODEL_AGENT_API_BASE" ] = model_api_base
236+ if model_api_key :
237+ runtime_envs ["MODEL_AGENT_API_KEY" ] = model_api_key
238+
225239 if not config_file_path .exists ():
226240 self ._create_config_file (
227241 config_file_path = config_file_path ,
@@ -232,6 +246,7 @@ def init_project(
232246 description = f"AgentKit project { project_name } - { template_info .get ('name' , '' )} " ,
233247 entry_point_name = entry_point_name ,
234248 dependencies_file_name = dependencies_file_path .name ,
249+ runtime_envs = runtime_envs ,
235250 )
236251 self .created_files .append ("agentkit.yaml" )
237252 else :
@@ -544,6 +559,7 @@ def _create_config_file(
544559 description : str ,
545560 entry_point_name : str ,
546561 dependencies_file_name : str ,
562+ runtime_envs : Optional [dict ] = None ,
547563 ):
548564 """
549565 Create agentkit.yaml configuration file.
@@ -569,6 +585,8 @@ def _create_config_file(
569585 common_config .description = description
570586 common_config .entry_point = entry_point_name
571587 common_config .dependencies_file = dependencies_file_name
588+ if runtime_envs :
589+ common_config .runtime_envs .update (runtime_envs )
572590 config_manager .update_common_config (common_config )
573591
574592 self ._setup_config_launch_type (config_manager , common_config )
0 commit comments