| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158 |
- # ════════════════════════════════════════════════════════════
- # Assembler — 配置组装师
- # ════════════════════════════════════════════════════════════
- #
- # 将 Analyst + Retriever + Prompter 的输出合并为完整 YAML
- agentId: builder-assembler
- name: 配置组装师
- description: >
- 将需求分析、参考配置、systemPrompt 三份输入合并组装为
- 一个完整的、符合 schema 的 agent YAML 配置文件。
- type: chain
- model:
- provider: dashscope
- name: qwen3-max-2026-01-23
- temperature: 0.1
- maxTokens: 4096
- systemPrompt: |
- 你是 agent 配置组装专家。你将三份专家分析材料合并为一份完整的 YAML 配置。
- 严格遵循 lambdagent 的 YAML schema 规范。
- chain:
- steps:
- - name: merge_inputs
- prompt: |
- 将以下三份专家材料合并为一份 agent 配置草案。
- 【需求分析 (Analyst)】
- {analyst_output}
- 【参考配置 (Retriever)】
- {retriever_output}
- 【SystemPrompt (Prompter)】
- {prompter_output}
- ## 字段映射规则
- agentId: 根据核心能力生成 kebab-case 标识(如 stock-analyzer, csv-processor)
- name: 中文名称,简洁(如 "股票分析助手")
- description: 一句话描述
- type: 取 Analyst 的 agent_type
- model:
- provider: 根据 Analyst 的 tier 映射
- - high → anthropic (claude-sonnet-4-20250514) 或 dashscope (qwen3-max-2026-01-23)
- - medium → dashscope (qwen-plus)
- - low → dashscope (qwen-plus) 或 moonshot (moonshot-v1-128k)
- temperature: 推理任务 0.1-0.3, 创作任务 0.5-0.8
- maxTokens: 一般 2048, 长文 4096
- systemPrompt: 直接使用 Prompter 的 PROMPT_V1
- react/chain/router/parallel: 根据 type 生成对应配置块
- - react: maxSteps 根据任务复杂度 5-15, toolTimeout 30
- - chain: 根据 Analyst 分析的步骤构建 steps
- memory:
- enabled: Analyst 的 memory_required
- strategy: local
- size: 20
- ttl: 3600
- mcp:
- localTools: 从 Analyst 的 tools_needed 映射
- - shell → shell
- - file → file
- - browser → browser
- - search → 添加到 onlineTool (example-mcp-server)
- - 始终包含 terminate
- onlineTool: 如果需要 search,添加 example-mcp-server
- policy: { mode: auto }
- guard:
- - safety=high → dangerousCommandBlock: true, highRiskConfirmation: true
- - safety=medium → highRiskConfirmation: true
- - 始终设 maxOutputLength: 5000
- rag: 如果 Analyst 的 rag_required=true,添加 rag 配置
- app.mcp.custom: 如果有 onlineTool,添加 example-mcp-server 节点配置
- 如果 Retriever 有相关参考配置,优先复用其验证过的参数值。
- 输出完整 YAML,不省略任何字段。
- outputParser: text
- - name: fill_defaults
- prompt: |
- 检查以下 YAML 配置,补全缺失的默认值并修正格式问题。
- {merge_inputs}
- ## 默认值检查清单
- 1. agentId — 必须存在,kebab-case
- 2. name — 必须存在
- 3. description — 必须存在
- 4. type — 必须是 react/chain/router/parallel 之一
- 5. model.provider — 必须在支持列表: anthropic, openai, dashscope, deepseek, zhipu, moonshot, ollama
- 6. model.name — 必须与 provider 匹配
- 7. model.temperature — [0.0, 2.0], 默认 0.3
- 8. model.maxTokens — 默认 2048
- 9. react.maxSteps — 默认 10 (仅 type=react)
- 10. react.observationEnabled — 默认 true
- 11. react.toolTimeout — 默认 30
- 12. memory.enabled — 默认 true
- 13. memory.strategy — 默认 local
- 14. memory.size — 默认 20
- 15. memory.ttl — 默认 3600
- 16. mcp.localTools — 必须包含 terminate
- 17. mcp.policy.mode — 默认 auto
- 18. guard.maxOutputLength — 默认 5000
- ## provider → model name 映射表
- anthropic: claude-sonnet-4-20250514, claude-opus-4-20250514
- openai: gpt-4o, gpt-4o-mini
- dashscope: qwen3-max-2026-01-23, qwen-max, qwen-plus
- deepseek: deepseek-chat, deepseek-reasoner
- zhipu: glm-4-plus, glm-4-flash
- moonshot: moonshot-v1-128k
- ollama: llama3, qwen2
- 输出补全后的完整 YAML。
- outputParser: text
- - name: validate_output
- prompt: |
- 最终验证以下 YAML 配置,确保可以直接部署运行。
- {fill_defaults}
- ## 验证项
- 1. YAML 语法合法性(缩进、引号、特殊字符转义)
- 2. 必填字段完整: agentId, name, type, systemPrompt, model
- 3. type 与子配置匹配: type=react 必须有 react 块, type=chain 必须有 chain 块
- 4. model.provider + model.name 组合合法
- 5. mcp.localTools 中的工具名合法
- 6. systemPrompt 不为空且长度 > 50 字符
- 7. 如果有 onlineTool,必须有对应的 app.mcp.custom.nodes 配置
- 8. guard 配置合理(不冲突)
- 如果发现问题,直接修复后输出。
- 如果没有问题,原样输出完整 YAML。
- 最终输出必须是纯 YAML(不要包裹在 markdown 代码块中)。
- outputParser: text
- guard:
- validator: "'agentId' in x and 'systemPrompt' in x and 'model' in x"
- retry: 2
- memory:
- enabled: false
|