6d658b4f4d
- 工具系统从 kilostar/plugin/tool_plugin/ 迁移到 data/toolset/(manifest.json 声明式) - 新增 plugin_runtime 模块:BaseOrganization / GlobalPluginManager / loader / tool_bridge - 新增 org_task + org_task_event 表及 DAO(alembic 0009) - 新增 /api/v1/plugin 路由(submit/status/stream/install/reload) - 新增 data/plugin/example_dept 示例重型插件 - regulatory_node 支持聊天历史上下文注入 - send_file 改为 artifact 存盘 + SSE 推送下载链接 - 前端 WorkflowFileCard 组件 + ToolSettings README 渲染 - utils 整理:合并 access/role_check、standalone_proxy→ray_compat、删除废弃模块 - 项目结构文档移至 docs/STRUCTURE.md 并详细展开 Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
51 lines
1.3 KiB
Python
51 lines
1.3 KiB
Python
"""agents.json 的 pydantic 模型。"""
|
|
|
|
from __future__ import annotations
|
|
|
|
from typing import List, Literal, Optional
|
|
|
|
from pydantic import BaseModel, Field
|
|
|
|
|
|
class AgentModelRef(BaseModel):
|
|
"""agent 用哪个 provider + 哪个 model。"""
|
|
|
|
provider_title: str
|
|
model_id: str
|
|
|
|
|
|
class AgentDef(BaseModel):
|
|
"""单个专家 agent 定义。
|
|
|
|
``peers`` 列出本 agent 能 ``consult`` 的同事;为空则不能向同事发起咨询。
|
|
``tools`` / ``skills`` 名字按下面顺序解析:
|
|
1. 本组织 toolset/ 里声明的工具
|
|
2. cabinet 全局工具白名单(python_executor 等基础工具)
|
|
"""
|
|
|
|
name: str
|
|
role: str = ""
|
|
system_prompt: str = ""
|
|
model: AgentModelRef
|
|
tools: List[str] = Field(default_factory=list)
|
|
skills: List[str] = Field(default_factory=list)
|
|
peers: List[str] = Field(default_factory=list)
|
|
|
|
|
|
class OrchestrationConfig(BaseModel):
|
|
"""编排策略:第一版只有 react;entry 决定任务进来交给谁。"""
|
|
|
|
type: Literal["react"] = "react"
|
|
entry: str
|
|
|
|
|
|
class AgentsConfig(BaseModel):
|
|
agents: List[AgentDef]
|
|
orchestration: OrchestrationConfig
|
|
|
|
def get(self, name: str) -> Optional[AgentDef]:
|
|
for a in self.agents:
|
|
if a.name == name:
|
|
return a
|
|
return None
|