feat(agent-core): 增加智能编排与模型工具基础

This commit is contained in:
2026-05-30 00:08:27 +08:00
parent 35b80929b0
commit 7a6c110103
16 changed files with 806 additions and 0 deletions

View File

@@ -0,0 +1,40 @@
from .tools.builtin_tools import BUILTIN_TOOLS
def run_declared_tools(tool_names: list[str], user_input: str) -> list[dict]:
results = []
for tool_name in tool_names:
tool = BUILTIN_TOOLS.get(tool_name)
if tool is None:
results.append(
{
"tool_name": tool_name,
"success": False,
"arguments": {"user_input": user_input},
"result": {},
"error": "工具未注册",
}
)
continue
try:
result = tool(user_input=user_input)
results.append(
{
"tool_name": tool_name,
"success": True,
"arguments": {"user_input": user_input},
"result": result,
"error": "",
}
)
except Exception as exc:
results.append(
{
"tool_name": tool_name,
"success": False,
"arguments": {"user_input": user_input},
"result": {},
"error": str(exc),
}
)
return results