fix tool initialization failure

This commit is contained in:
2026-03-12 11:36:37 +08:00
parent 33faedc1b1
commit fe7ff9a516

View File

@@ -75,23 +75,40 @@ def build_route(
**_: Any, **_: Any,
): ):
cmd_opt = [ cmd_opt = [
"--pipeline.pipeline-id", pipeline_id, "--pipeline.pipeline-id",
pipeline_id,
"route", # ------------ "route", # ------------
"--llm-name", llm_name, "--llm-name",
"--api-key", api_key, llm_name,
"--pipeline-id", pipeline_id, "--api-key",
"--prompt-set-id", prompt_set, api_key,
"tool_node", # ------------ "--pipeline-id",
"--llm-name", llm_name, pipeline_id,
"--api-key", api_key, "--prompt-set-id",
"--pipeline-id", pipeline_id, prompt_set,
"--prompt-set-id", prompt_set,
] ]
if tool_keys: if tool_keys:
cmd_opt.extend( cmd_opt.extend(
["--tool-manager-config.client-tool-manager.tool-keys", *tool_keys] ["--tool-manager-config.client-tool-manager.tool-keys", *tool_keys]
) )
# Tyro parses list options greedily across positional subcommands; repeat a
# parent-level option to terminate list parsing before `tool_node`.
cmd_opt.extend(["--pipeline-id", pipeline_id])
cmd_opt.extend(
[
"tool_node", # ------------
"--llm-name",
llm_name,
"--api-key",
api_key,
"--pipeline-id",
pipeline_id,
"--prompt-set-id",
prompt_set,
]
)
return _build_and_load_pipeline_config(pipeline_id, pipeline_config_dir, cmd_opt) return _build_and_load_pipeline_config(pipeline_id, pipeline_config_dir, cmd_opt)
@@ -106,13 +123,18 @@ def build_react(
**_: Any, **_: Any,
): ):
cmd_opt = [ cmd_opt = [
"--pipeline.pipeline-id", pipeline_id, "--pipeline.pipeline-id",
pipeline_id,
"react", # ------------ "react", # ------------
"--llm-name", llm_name, "--llm-name",
"--api-key", api_key, llm_name,
"--pipeline-id", pipeline_id, "--api-key",
"--prompt-set-id", prompt_set, api_key,
] "--pipeline-id",
pipeline_id,
"--prompt-set-id",
prompt_set,
]
if tool_keys: if tool_keys:
cmd_opt.extend( cmd_opt.extend(
["--tool-manager-config.client-tool-manager.tool-keys", *tool_keys] ["--tool-manager-config.client-tool-manager.tool-keys", *tool_keys]
@@ -146,22 +168,31 @@ def build_deep_agent(
) )
cmd_opt = [ cmd_opt = [
"--pipeline.pipeline-id", pipeline_id, "--pipeline.pipeline-id",
pipeline_id,
"deepagent", "deepagent",
"--llm-name", llm_name, "--llm-name",
"--api-key", api_key, llm_name,
"--pipeline-id", pipeline_id, "--api-key",
"--prompt-set-id", prompt_set, api_key,
backend_subcommand, "--pipeline-id",
pipeline_id,
"--prompt-set-id",
prompt_set,
] ]
if tool_keys: if tool_keys:
cmd_opt.extend( cmd_opt.extend(
["--tool-manager-config.client-tool-manager.tool-keys", *tool_keys] ["--tool-manager-config.client-tool-manager.tool-keys", *tool_keys]
) )
# Same greedy-list behavior as `build_route`; terminate before backend subcommand.
cmd_opt.extend(["--pipeline-id", pipeline_id])
cmd_opt.append(backend_subcommand)
return _build_and_load_pipeline_config(pipeline_id, pipeline_config_dir, cmd_opt) return _build_and_load_pipeline_config(pipeline_id, pipeline_config_dir, cmd_opt)
# {pipeline_id: build_function} # {pipeline_id: build_function}
GRAPH_BUILD_FNCS = { GRAPH_BUILD_FNCS = {
"routing": build_route, "routing": build_route,