Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions agentkit/toolkit/cli/cli_init.py
Original file line number Diff line number Diff line change
Expand Up @@ -225,6 +225,16 @@ def init_command(
"--model-name",
help="Model name in volcengine ARK platform (default: 'doubao-seed-1-6-250615')",
),
model_api_base: Optional[str] = typer.Option(
None,
"--model-api-base",
help="Base URL for model API requests (e.g., https://ark.cn-beijing.volces.com/api/v3)",
),
model_api_key: Optional[str] = typer.Option(
None,
"--model-api-key",
help="API key for accessing the model",
),
tools: Optional[str] = typer.Option(
None,
"--tools",
Expand Down Expand Up @@ -328,6 +338,8 @@ def init_command(
description=description,
system_prompt=system_prompt,
model_name=model_name,
model_api_base=model_api_base,
model_api_key=model_api_key,
tools=tools,
)

Expand Down
20 changes: 19 additions & 1 deletion agentkit/toolkit/executors/init_executor.py
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,8 @@ def init_project(
description: Optional[str] = None,
system_prompt: Optional[str] = None,
model_name: Optional[str] = None,
model_api_base: Optional[str] = None,
model_api_key: Optional[str] = None,
tools: Optional[str] = None,
) -> InitResult:
"""
Expand Down Expand Up @@ -193,7 +195,11 @@ def init_project(
)

render_context = self._build_render_context(
agent_name, description, system_prompt, model_name, tools
agent_name,
description,
system_prompt,
model_name,
tools,
)

if source_path.is_dir():
Expand Down Expand Up @@ -222,6 +228,14 @@ def init_project(
else:
entry_point_name = file_name

runtime_envs = None
if model_api_base or model_api_key:
runtime_envs = {}
if model_api_base:
runtime_envs["MODEL_AGENT_API_BASE"] = model_api_base
if model_api_key:
runtime_envs["MODEL_AGENT_API_KEY"] = model_api_key

if not config_file_path.exists():
self._create_config_file(
config_file_path=config_file_path,
Expand All @@ -232,6 +246,7 @@ def init_project(
description=f"AgentKit project {project_name} - {template_info.get('name', '')}",
entry_point_name=entry_point_name,
dependencies_file_name=dependencies_file_path.name,
runtime_envs=runtime_envs,
)
self.created_files.append("agentkit.yaml")
else:
Expand Down Expand Up @@ -544,6 +559,7 @@ def _create_config_file(
description: str,
entry_point_name: str,
dependencies_file_name: str,
runtime_envs: Optional[dict] = None,
):
"""
Create agentkit.yaml configuration file.
Expand All @@ -569,6 +585,8 @@ def _create_config_file(
common_config.description = description
common_config.entry_point = entry_point_name
common_config.dependencies_file = dependencies_file_name
if runtime_envs:
common_config.runtime_envs.update(runtime_envs)
config_manager.update_common_config(common_config)

self._setup_config_launch_type(config_manager, common_config)
Expand Down