@gt-fe/eap-cli 0.2.23 → 0.2.25

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (58) hide show
  1. package/README.md +303 -304
  2. package/dist/commands/doctor.js +2 -2
  3. package/dist/commands/doctor.js.map +1 -1
  4. package/dist/commands/login.js +2 -2
  5. package/dist/commands/login.js.map +1 -1
  6. package/dist/commands/use.d.ts +6 -0
  7. package/dist/commands/use.d.ts.map +1 -0
  8. package/dist/commands/use.js +18 -0
  9. package/dist/commands/use.js.map +1 -0
  10. package/dist/index.js +3 -0
  11. package/dist/index.js.map +1 -1
  12. package/dist/lib/config.d.ts +5 -1
  13. package/dist/lib/config.d.ts.map +1 -1
  14. package/dist/lib/config.js +64 -17
  15. package/dist/lib/config.js.map +1 -1
  16. package/dist/playground/server.js +1 -1
  17. package/dist/playground/server.js.map +1 -1
  18. package/dist/program.d.ts.map +1 -1
  19. package/dist/program.js +2 -1
  20. package/dist/program.js.map +1 -1
  21. package/dist/templates/README.md +51 -51
  22. package/dist/templates/agent-api-orchestration/README.md +320 -326
  23. package/dist/templates/agent-api-orchestration/eap.config.json +1 -5
  24. package/dist/templates/agent-api-orchestration/graph.json +35 -35
  25. package/dist/templates/agent-api-orchestration/package.json +1 -1
  26. package/dist/templates/agent-api-orchestration/src/embedded-agent.ts +4 -9
  27. package/dist/templates/agent-api-orchestration/src/platform-user.ts +12 -7
  28. package/dist/templates/agent-api-orchestration/src/project-config.ts +5 -8
  29. package/dist/templates/dag-workflow/README.md +102 -102
  30. package/dist/templates/dag-workflow/agent.manifest.json +19 -19
  31. package/dist/templates/dag-workflow/eap.config.json +1 -5
  32. package/dist/templates/dag-workflow/gitignore +51 -51
  33. package/dist/templates/dag-workflow/graph.json +51 -51
  34. package/dist/templates/dag-workflow/skills/README.md +116 -116
  35. package/dist/templates/plan-and-execute/README.md +109 -109
  36. package/dist/templates/plan-and-execute/agent.manifest.json +19 -19
  37. package/dist/templates/plan-and-execute/eap.config.json +1 -5
  38. package/dist/templates/plan-and-execute/eap.lock.yaml +5 -5
  39. package/dist/templates/plan-and-execute/gitignore +51 -51
  40. package/dist/templates/plan-and-execute/graph.json +49 -49
  41. package/dist/templates/plan-and-execute/skills/README.md +120 -120
  42. package/dist/templates/simple-flow/README.md +87 -87
  43. package/dist/templates/simple-flow/agent.manifest.json +19 -19
  44. package/dist/templates/simple-flow/eap.config.json +1 -5
  45. package/dist/templates/simple-flow/gitignore +51 -51
  46. package/dist/templates/simple-flow/graph.json +32 -32
  47. package/dist/templates/simple-flow/package.json +10 -10
  48. package/dist/templates/simple-flow/skills/README.md +113 -113
  49. package/dist/templates/single-agent-with-tools/README.md +138 -138
  50. package/dist/templates/single-agent-with-tools/agent.manifest.json +19 -19
  51. package/dist/templates/single-agent-with-tools/eap.config.json +1 -5
  52. package/dist/templates/single-agent-with-tools/eap.lock.yaml +5 -5
  53. package/dist/templates/single-agent-with-tools/gitignore +51 -51
  54. package/dist/templates/single-agent-with-tools/graph.json +41 -41
  55. package/dist/templates/single-agent-with-tools/skills/README.md +119 -119
  56. package/dist/templates/single-agent-with-tools/tools/http-weather/toolset.manifest.json +73 -73
  57. package/dist/templates/single-agent-with-tools/tools/web-search/toolset.manifest.json +41 -41
  58. package/package.json +2 -2
@@ -1,51 +1,51 @@
1
- {
2
- "description": "并行扇出后合并:split 两条普通出边同时进入两个 LLM,再在 merge 汇合。",
3
- "nodes": [
4
- {
5
- "id": "split",
6
- "type": "code",
7
- "config": {
8
- "timeoutMs": 1000,
9
- "code": "const msgs = Array.isArray(state.messages) ? state.messages : [];\nlet text = '';\nfor (let i = msgs.length - 1; i >= 0; i--) {\n if (msgs[i] && msgs[i].role === 'user') { text = String(msgs[i].content || ''); break; }\n}\nreturn { step: 'split', text: String(text).replace(/\\s+/g, ' ').trim() };"
10
- }
11
- },
12
- {
13
- "id": "branch-report",
14
- "type": "llm",
15
- "config": {
16
- "disableTools": true,
17
- "systemPrompt": "从「报告/说明」视角用中文给出简短意见。不要调用工具。"
18
- }
19
- },
20
- {
21
- "id": "branch-task",
22
- "type": "llm",
23
- "config": {
24
- "disableTools": true,
25
- "systemPrompt": "从「任务/排期」视角用中文给出简短意见。不要调用工具。"
26
- }
27
- },
28
- {
29
- "id": "merge",
30
- "type": "llm",
31
- "config": {
32
- "disableTools": true,
33
- "systemPrompt": "综合两个视角的意见,用中文给出最终回复。不要调用工具。"
34
- }
35
- }
36
- ],
37
- "edges": [
38
- { "from": "__start__", "to": "split" },
39
- { "from": "split", "to": "branch-report" },
40
- { "from": "split", "to": "branch-task" },
41
- { "from": "branch-report", "to": "merge" },
42
- { "from": "branch-task", "to": "merge" },
43
- { "from": "merge", "to": "__end__" }
44
- ],
45
- "entryPoint": "split",
46
- "finishPoints": ["merge"],
47
- "config": {
48
- "maxRetries": 3,
49
- "checkpointStore": "memory"
50
- }
51
- }
1
+ {
2
+ "description": "并行扇出后合并:split 两条普通出边同时进入两个 LLM,再在 merge 汇合。",
3
+ "nodes": [
4
+ {
5
+ "id": "split",
6
+ "type": "code",
7
+ "config": {
8
+ "timeoutMs": 1000,
9
+ "code": "const msgs = Array.isArray(state.messages) ? state.messages : [];\nlet text = '';\nfor (let i = msgs.length - 1; i >= 0; i--) {\n if (msgs[i] && msgs[i].role === 'user') { text = String(msgs[i].content || ''); break; }\n}\nreturn { step: 'split', text: String(text).replace(/\\s+/g, ' ').trim() };"
10
+ }
11
+ },
12
+ {
13
+ "id": "branch-report",
14
+ "type": "llm",
15
+ "config": {
16
+ "disableTools": true,
17
+ "systemPrompt": "从「报告/说明」视角用中文给出简短意见。不要调用工具。"
18
+ }
19
+ },
20
+ {
21
+ "id": "branch-task",
22
+ "type": "llm",
23
+ "config": {
24
+ "disableTools": true,
25
+ "systemPrompt": "从「任务/排期」视角用中文给出简短意见。不要调用工具。"
26
+ }
27
+ },
28
+ {
29
+ "id": "merge",
30
+ "type": "llm",
31
+ "config": {
32
+ "disableTools": true,
33
+ "systemPrompt": "综合两个视角的意见,用中文给出最终回复。不要调用工具。"
34
+ }
35
+ }
36
+ ],
37
+ "edges": [
38
+ { "from": "__start__", "to": "split" },
39
+ { "from": "split", "to": "branch-report" },
40
+ { "from": "split", "to": "branch-task" },
41
+ { "from": "branch-report", "to": "merge" },
42
+ { "from": "branch-task", "to": "merge" },
43
+ { "from": "merge", "to": "__end__" }
44
+ ],
45
+ "entryPoint": "split",
46
+ "finishPoints": ["merge"],
47
+ "config": {
48
+ "maxRetries": 3,
49
+ "checkpointStore": "memory"
50
+ }
51
+ }
@@ -1,116 +1,116 @@
1
- # 装配与执行 Skill
2
-
3
- 四种执行模式都可以装配 Skill,但装配与执行是两个步骤。
4
-
5
- ## 普通 SKILL.md 目录
6
-
7
- 1. 把含 `SKILL.md` 的目录放到 `skills/<name>/`,可同时包含 `scripts/`、`references/`。文件夹名与 frontmatter 的 `name` 保持一致;不要嵌套版本目录。
8
- 2. 在根级 `agent.manifest.json` 的 `skillRefs` 中追加 `{ "code": "<name>", "version": "1.0.0" }`,保留已有引用。本地版本来自 `SKILL.md` frontmatter,省略时为 `1.0.0`。
9
- 3. 确认 `eap.config.json` 的 `localSkillDirectories` 包含 `"./skills"`,重启本地运行以重新物化资源。
10
-
11
- 这种装配只需要 `SKILL.md`,无需额外 JSON 清单。可调用工具的 LLM 会获得 Skill 目录信息,通过 `read_file` 阅读正文、通过 `execute_command` 执行脚本。`disableTools: true` 的节点不能这样读取或执行 Skill。模型按文档使用脚本,不等于 Runtime 执行结构化 workflow。
12
-
13
- ## 作为子图执行的完整最小样例
14
-
15
- 本例创建 `request-summary`,由一个 code 节点整理用户请求,输出以“需求记录:”开头的助手消息。须设 `emitReply: true`,否则 `reply` 只出现在 tool 结果 JSON 里。不调用外部工具。
16
-
17
- ```text
18
- skills/
19
- request-summary/
20
- SKILL.md
21
- skill.manifest.json
22
- ```
23
-
24
- 创建 `skills/request-summary/SKILL.md`:
25
-
26
- ```markdown
27
- ---
28
- name: request-summary
29
- description: 整理用户原始请求,生成需求记录。
30
- version: 1.0.0
31
- ---
32
-
33
- 把用户请求中的连续空白整理成一个空格,输出需求记录。
34
- 结构化执行入口在同目录 skill.manifest.json 的 workflow 字段中。
35
- ```
36
-
37
- 创建 `skills/request-summary/skill.manifest.json`:
38
-
39
- ```json
40
- {
41
- "code": "request-summary",
42
- "name": "request-summary",
43
- "version": "1.0.0",
44
- "workflow": {
45
- "nodes": [
46
- {
47
- "id": "record-request",
48
- "type": "code",
49
- "config": {
50
- "timeoutMs": 1000,
51
- "emitReply": true,
52
- "code": "const messages = Array.isArray(state.messages) ? state.messages : []; let input = ''; for (let i = messages.length - 1; i >= 0; i--) { if (messages[i].role === 'user') { input = String(messages[i].content || ''); break; } } return { reply: '需求记录:' + input.replace(/\\s+/g, ' ').trim() };"
53
- }
54
- }
55
- ],
56
- "edges": [
57
- {
58
- "from": "__start__",
59
- "to": "record-request"
60
- },
61
- {
62
- "from": "record-request",
63
- "to": "__end__"
64
- }
65
- ],
66
- "entryPoint": "record-request",
67
- "finishPoints": [
68
- "__end__"
69
- ]
70
- }
71
- }
72
- ```
73
-
74
- 在 Agent 的 `skillRefs` 中追加:
75
-
76
- ```json
77
- { "code": "request-summary", "version": "1.0.0" }
78
- ```
79
-
80
- 这里的 `skill.manifest.json` 为子图提供结构化定义。当前 Runtime 从该清单的 `workflow`(也支持 `graph` / `definitionSnapshot`)读取图对象,**不会自动读取 Skill 目录中的独立 `graph.json`,也不会把 SKILL.md 的自然语言步骤编译成图**。
81
-
82
- 父图的节点必须绑定该 Skill:
83
-
84
- ```json
85
- {
86
- "id": "run-skill",
87
- "type": "subgraph",
88
- "config": { "skillCode": "request-summary" }
89
- }
90
- ```
91
-
92
- `skillCode` 必须与 `skillRefs[].code` 一致;不能只填写 `type: subgraph`。节点还需接入实际控制流,见下面的模板接法。
93
-
94
- ## 接到 DAG 分支
95
-
96
- 用下面的节点替换原 `branch-report`,保留它的 ID;其他节点、所有边、入口和结束配置保持原样:
97
-
98
- ```json
99
- {
100
- "id": "branch-report",
101
- "type": "subgraph",
102
- "config": { "skillCode": "request-summary" }
103
- }
104
- ```
105
-
106
- 图中仍有 `split → branch-report → merge` 与 `split → branch-task → merge` 两条分支。前者输出需求记录,后者输出任务意见,`merge` 读取二者结果。默认未改图时,两个 LLM 分支均为 `disableTools: true`,只添加 Skill 引用不会执行它。
107
-
108
- 此例两条分支在父图中各占一个节点。以后增加多层分支时,要另外验证汇合时机,不要把多条普通入边理解为任意长度分支的等待屏障。
109
-
110
- ## 检查结果
111
-
112
- 改完文件后先执行 `eap validate`,再重启 `eap chat` / `eap dev`,输入“用户登录后导出月报”。应能看到 `request-summary` 的执行记录,以及“需求记录:用户登录后导出月报”的结果被后续步骤使用。
113
-
114
- `eap validate` 能检查父图引用和连边,但通过校验不代表已验证 Skill workflow 的运行行为。若报“子图节点无法解析 Skill workflow”,检查清单中的 `workflow.nodes` 是否非空、`skillCode` 是否匹配、是否已重新物化资源。
115
-
116
- 示例是本地开发资源。上线前按平台要求登记、锁定和发布 Skill 及其依赖。
1
+ # 装配与执行 Skill
2
+
3
+ 四种执行模式都可以装配 Skill,但装配与执行是两个步骤。
4
+
5
+ ## 普通 SKILL.md 目录
6
+
7
+ 1. 把含 `SKILL.md` 的目录放到 `skills/<name>/`,可同时包含 `scripts/`、`references/`。文件夹名与 frontmatter 的 `name` 保持一致;不要嵌套版本目录。
8
+ 2. 在根级 `agent.manifest.json` 的 `skillRefs` 中追加 `{ "code": "<name>", "version": "1.0.0" }`,保留已有引用。本地版本来自 `SKILL.md` frontmatter,省略时为 `1.0.0`。
9
+ 3. 确认 `eap.config.json` 的 `localSkillDirectories` 包含 `"./skills"`,重启本地运行以重新物化资源。
10
+
11
+ 这种装配只需要 `SKILL.md`,无需额外 JSON 清单。可调用工具的 LLM 会获得 Skill 目录信息,通过 `read_file` 阅读正文、通过 `execute_command` 执行脚本。`disableTools: true` 的节点不能这样读取或执行 Skill。模型按文档使用脚本,不等于 Runtime 执行结构化 workflow。
12
+
13
+ ## 作为子图执行的完整最小样例
14
+
15
+ 本例创建 `request-summary`,由一个 code 节点整理用户请求,输出以“需求记录:”开头的助手消息。须设 `emitReply: true`,否则 `reply` 只出现在 tool 结果 JSON 里。不调用外部工具。
16
+
17
+ ```text
18
+ skills/
19
+ request-summary/
20
+ SKILL.md
21
+ skill.manifest.json
22
+ ```
23
+
24
+ 创建 `skills/request-summary/SKILL.md`:
25
+
26
+ ```markdown
27
+ ---
28
+ name: request-summary
29
+ description: 整理用户原始请求,生成需求记录。
30
+ version: 1.0.0
31
+ ---
32
+
33
+ 把用户请求中的连续空白整理成一个空格,输出需求记录。
34
+ 结构化执行入口在同目录 skill.manifest.json 的 workflow 字段中。
35
+ ```
36
+
37
+ 创建 `skills/request-summary/skill.manifest.json`:
38
+
39
+ ```json
40
+ {
41
+ "code": "request-summary",
42
+ "name": "request-summary",
43
+ "version": "1.0.0",
44
+ "workflow": {
45
+ "nodes": [
46
+ {
47
+ "id": "record-request",
48
+ "type": "code",
49
+ "config": {
50
+ "timeoutMs": 1000,
51
+ "emitReply": true,
52
+ "code": "const messages = Array.isArray(state.messages) ? state.messages : []; let input = ''; for (let i = messages.length - 1; i >= 0; i--) { if (messages[i].role === 'user') { input = String(messages[i].content || ''); break; } } return { reply: '需求记录:' + input.replace(/\\s+/g, ' ').trim() };"
53
+ }
54
+ }
55
+ ],
56
+ "edges": [
57
+ {
58
+ "from": "__start__",
59
+ "to": "record-request"
60
+ },
61
+ {
62
+ "from": "record-request",
63
+ "to": "__end__"
64
+ }
65
+ ],
66
+ "entryPoint": "record-request",
67
+ "finishPoints": [
68
+ "__end__"
69
+ ]
70
+ }
71
+ }
72
+ ```
73
+
74
+ 在 Agent 的 `skillRefs` 中追加:
75
+
76
+ ```json
77
+ { "code": "request-summary", "version": "1.0.0" }
78
+ ```
79
+
80
+ 这里的 `skill.manifest.json` 为子图提供结构化定义。当前 Runtime 从该清单的 `workflow`(也支持 `graph` / `definitionSnapshot`)读取图对象,**不会自动读取 Skill 目录中的独立 `graph.json`,也不会把 SKILL.md 的自然语言步骤编译成图**。
81
+
82
+ 父图的节点必须绑定该 Skill:
83
+
84
+ ```json
85
+ {
86
+ "id": "run-skill",
87
+ "type": "subgraph",
88
+ "config": { "skillCode": "request-summary" }
89
+ }
90
+ ```
91
+
92
+ `skillCode` 必须与 `skillRefs[].code` 一致;不能只填写 `type: subgraph`。节点还需接入实际控制流,见下面的模板接法。
93
+
94
+ ## 接到 DAG 分支
95
+
96
+ 用下面的节点替换原 `branch-report`,保留它的 ID;其他节点、所有边、入口和结束配置保持原样:
97
+
98
+ ```json
99
+ {
100
+ "id": "branch-report",
101
+ "type": "subgraph",
102
+ "config": { "skillCode": "request-summary" }
103
+ }
104
+ ```
105
+
106
+ 图中仍有 `split → branch-report → merge` 与 `split → branch-task → merge` 两条分支。前者输出需求记录,后者输出任务意见,`merge` 读取二者结果。默认未改图时,两个 LLM 分支均为 `disableTools: true`,只添加 Skill 引用不会执行它。
107
+
108
+ 此例两条分支在父图中各占一个节点。以后增加多层分支时,要另外验证汇合时机,不要把多条普通入边理解为任意长度分支的等待屏障。
109
+
110
+ ## 检查结果
111
+
112
+ 改完文件后先执行 `eap validate`,再重启 `eap chat` / `eap dev`,输入“用户登录后导出月报”。应能看到 `request-summary` 的执行记录,以及“需求记录:用户登录后导出月报”的结果被后续步骤使用。
113
+
114
+ `eap validate` 能检查父图引用和连边,但通过校验不代表已验证 Skill workflow 的运行行为。若报“子图节点无法解析 Skill workflow”,检查清单中的 `workflow.nodes` 是否非空、`skillCode` 是否匹配、是否已重新物化资源。
115
+
116
+ 示例是本地开发资源。上线前按平台要求登记、锁定和发布 Skill 及其依赖。
@@ -1,109 +1,109 @@
1
- # 规划执行
2
-
3
- 先由 `planner` 写出有序计划(不调用工具),再由 `executor` 按计划逐步调用 `echo-tool`,直到计划完成。没有单独的总结节点。
4
-
5
- `echo-tool` 为本地 code 工具,无需第三方密钥。已声明 `runtime.llm` 时,解不出 Key 则 `eap chat` 启动失败(`no API key resolved`),不会回退为 Echo。
6
-
7
- 计划中的某一步可以是已装配 Skill(图上 `type: subgraph`)。默认图未包含 subgraph。装配方式见 `skills/README.md`。
8
-
9
- ## 图结构
10
-
11
- ```text
12
- ╭───────────╮ ┌─────────────────┐
13
- │ __start__ ├───▶│ planner / llm · │
14
- ╰───────────╯ │ disableTools │
15
- └────────┬────────┘
16
- ▼
17
- ┌─────────────────┐
18
- │ executor / llm │
19
- └────────┬────────┘
20
- ┌───────┴───────┐
21
- call_tools │ │ finish
22
- ▼ ▼
23
- ┌─────────┐ ╭─────────╮
24
- │ tools │ │ __end__ │
25
- └────┬────┘ ╰─────────╯
26
- │
27
- └──▶ executor
28
- ```
29
-
30
- ```mermaid
31
- flowchart LR
32
- start((__start__)) --> planner["planner / llm · disableTools"]
33
- planner --> executor[executor / llm]
34
- executor -->|shouldContinue call_tools| tools[tools / echo-tool]
35
- tools --> executor
36
- executor -->|shouldContinue finish| finish((__end__))
37
- ```
38
-
39
- **适用**:先规划,再按计划逐步执行。
40
-
41
- **不适用**:模型从一开始就按需选择多种工具。此类场景使用「单智能体与工具」模板。
42
-
43
- Session 一轮只有一条助手正文:`planner` 的计划与 `executor` 的结果用空行拼在一起。`finishPoints` 保持 `["__end__"]`。不要把 `planner` 写进去:Runtime 会把它当成 LangGraph 终止点,`executor` 不再跑。节点过程在 llm-turns / Trace。
44
-
45
- ## 1. 配置
46
-
47
- 本地 `eap chat` 不要求 `eap login`。`runtime.llm` 会设置 `EAP_LLM_MODE=local`,用 `eap.config.json` 里的网关和 Token,不走 Foundation 模型路由。`platform.foundationServiceUrl` 默认是测试环境地址,给登录/发布用;纯本地可改为 `null`。
48
-
49
- 把 `runtime.llm.models.*.apiKey` 的 `sk-example-token` 换成与 `baseUrl` 一致的有效 Token,不要提交真实密钥。
50
-
51
- | 项 | 要求 |
52
- |----|------|
53
- | `runtime.llm.models.*.apiKey` | 模板占位 `sk-example-token`,运行前替换 |
54
- | `baseUrl` | 默认 `https://gtaiapi.gtcloud.cn/v1`。须与 Key 所属网关一致 |
55
- | `runtime.tools.mode` | 默认 `mcp`,本地实际执行 `echo-tool` |
56
- | 生效 | 修改 `eap.config.json` 后重新启动 `eap chat` |
57
-
58
- ## 2. 占位符与密钥
59
-
60
- 模型密钥写在 `eap.config.json` 的 `runtime.llm.models.*.apiKey`,模板占位 `sk-example-token`。
61
-
62
- | 环境 | 处理 |
63
- |------|------|
64
- | 本地 | 替换占位 Token;不要提交真实密钥 |
65
- | 生产 | 不使用 `runtime.llm`。模型密钥由 Foundation 模型路由持有 |
66
-
67
- 华为云 UCS「配置项与密钥」:配置项(ConfigMap)只存放非敏感值;密钥(Secret)仅当该 Pod 必须持有敏感值,且须挂载。禁止将 API Key 写入配置项。
68
-
69
- ## 3. 运行
70
-
71
- ```bash
72
- eap validate --strict
73
- eap chat
74
- ```
75
-
76
- `eap chat` 须在交互式终端中运行。启动摘要应为 `Runtime openai-http · mcp · dev`。
77
-
78
- 试跑:`制定三步计划并执行:回显 hello`。预期为先写出计划,再多次调用 `echo-tool`,计划完成后结束。Session 助手正文一条(计划与结果空行拼接)。终端同一轮可按节点分块;节点全文在 llm-turns / Trace。
79
-
80
- 可选:`eap chat --verbose`;`eap dev` 启动 Playground。
81
-
82
- ## 4. 项目结构
83
-
84
- ```text
85
- .
86
- |-- agent.manifest.json
87
- |-- graph.json
88
- |-- eap.config.json
89
- |-- eap.lock.yaml
90
- |-- package.json
91
- |-- .gitignore
92
- |-- skills/README.md
93
- `-- tools/echo-tool/
94
- ```
95
-
96
- 发布与部署以 Portal / Hosting 合同为准。
97
-
98
- ## 5. 故障排除
99
-
100
- | 现象 | 处理 |
101
- |------|------|
102
- | `LLM API error 401` | Key 无效,或与 `baseUrl` 所属网关不一致 |
103
- | 提示先执行 `eap login` | 升级 CLI。本地 `eap chat` 不要求登录 |
104
- | 启动失败,提示 `no API key resolved` | 把 `eap.config.json` 的 `sk-example-token` 换成有效 Token |
105
- | executor 未调用工具 | 确认启动摘要为 `Runtime openai-http · mcp · dev`,且 Key 有效 |
106
- | 执行中途超时 | 整图超时:请求 `config.timeout`,否则图 `config.timeout`,否则 20 分钟。短任务可在图上写更短 |
107
- | 计划写出后图就结束 | 不要把 `planner` 写进 `finishPoints`,保持 `["__end__"]` |
108
- | 请求进入 Foundation 模型路由 | `platform.foundationServiceUrl` 设为 `null`,并取消 `FOUNDATION_SERVICE_URL` |
109
- | 工具未执行 / `NOT_CONFIGURED` | 清单缺 MCP / HTTP / code handler |
1
+ # 规划执行
2
+
3
+ 先由 `planner` 写出有序计划(不调用工具),再由 `executor` 按计划逐步调用 `echo-tool`,直到计划完成。没有单独的总结节点。
4
+
5
+ `echo-tool` 为本地 code 工具,无需第三方密钥。已声明 `runtime.llm` 时,解不出 Key 则 `eap chat` 启动失败(`no API key resolved`),不会回退为 Echo。
6
+
7
+ 计划中的某一步可以是已装配 Skill(图上 `type: subgraph`)。默认图未包含 subgraph。装配方式见 `skills/README.md`。
8
+
9
+ ## 图结构
10
+
11
+ ```text
12
+ ╭───────────╮ ┌─────────────────┐
13
+ │ __start__ ├───▶│ planner / llm · │
14
+ ╰───────────╯ │ disableTools │
15
+ └────────┬────────┘
16
+ ▼
17
+ ┌─────────────────┐
18
+ │ executor / llm │
19
+ └────────┬────────┘
20
+ ┌───────┴───────┐
21
+ call_tools │ │ finish
22
+ ▼ ▼
23
+ ┌─────────┐ ╭─────────╮
24
+ │ tools │ │ __end__ │
25
+ └────┬────┘ ╰─────────╯
26
+ │
27
+ └──▶ executor
28
+ ```
29
+
30
+ ```mermaid
31
+ flowchart LR
32
+ start((__start__)) --> planner["planner / llm · disableTools"]
33
+ planner --> executor[executor / llm]
34
+ executor -->|shouldContinue call_tools| tools[tools / echo-tool]
35
+ tools --> executor
36
+ executor -->|shouldContinue finish| finish((__end__))
37
+ ```
38
+
39
+ **适用**:先规划,再按计划逐步执行。
40
+
41
+ **不适用**:模型从一开始就按需选择多种工具。此类场景使用「单智能体与工具」模板。
42
+
43
+ Session 一轮只有一条助手正文:`planner` 的计划与 `executor` 的结果用空行拼在一起。`finishPoints` 保持 `["__end__"]`。不要把 `planner` 写进去:Runtime 会把它当成 LangGraph 终止点,`executor` 不再跑。节点过程在 llm-turns / Trace。
44
+
45
+ ## 1. 配置
46
+
47
+ 本地 `eap chat` 不要求 `eap login`。`runtime.llm` 会设置 `EAP_LLM_MODE=local`,用 `eap.config.json` 里的网关和 Token,不走 Foundation 模型路由。CLI 登录和发布使用全局 `eap use test|prod` 选择的平台地址。
48
+
49
+ 把 `runtime.llm.models.*.apiKey` 的 `sk-example-token` 换成与 `baseUrl` 一致的有效 Token,不要提交真实密钥。
50
+
51
+ | 项 | 要求 |
52
+ |----|------|
53
+ | `runtime.llm.models.*.apiKey` | 模板占位 `sk-example-token`,运行前替换 |
54
+ | `baseUrl` | 默认 `https://gtaiapi.gtcloud.cn/v1`。须与 Key 所属网关一致 |
55
+ | `runtime.tools.mode` | 默认 `mcp`,本地实际执行 `echo-tool` |
56
+ | 生效 | 修改 `eap.config.json` 后重新启动 `eap chat` |
57
+
58
+ ## 2. 占位符与密钥
59
+
60
+ 模型密钥写在 `eap.config.json` 的 `runtime.llm.models.*.apiKey`,模板占位 `sk-example-token`。
61
+
62
+ | 环境 | 处理 |
63
+ |------|------|
64
+ | 本地 | 替换占位 Token;不要提交真实密钥 |
65
+ | 生产 | 不使用 `runtime.llm`。模型密钥由 Foundation 模型路由持有 |
66
+
67
+ 华为云 UCS「配置项与密钥」:配置项(ConfigMap)只存放非敏感值;密钥(Secret)仅当该 Pod 必须持有敏感值,且须挂载。禁止将 API Key 写入配置项。
68
+
69
+ ## 3. 运行
70
+
71
+ ```bash
72
+ eap validate --strict
73
+ eap chat
74
+ ```
75
+
76
+ `eap chat` 须在交互式终端中运行。启动摘要应为 `Runtime openai-http · mcp · dev`。
77
+
78
+ 试跑:`制定三步计划并执行:回显 hello`。预期为先写出计划,再多次调用 `echo-tool`,计划完成后结束。Session 助手正文一条(计划与结果空行拼接)。终端同一轮可按节点分块;节点全文在 llm-turns / Trace。
79
+
80
+ 可选:`eap chat --verbose`;`eap dev` 启动 Playground。
81
+
82
+ ## 4. 项目结构
83
+
84
+ ```text
85
+ .
86
+ |-- agent.manifest.json
87
+ |-- graph.json
88
+ |-- eap.config.json
89
+ |-- eap.lock.yaml
90
+ |-- package.json
91
+ |-- .gitignore
92
+ |-- skills/README.md
93
+ `-- tools/echo-tool/
94
+ ```
95
+
96
+ 发布与部署以 Portal / Hosting 合同为准。
97
+
98
+ ## 5. 故障排除
99
+
100
+ | 现象 | 处理 |
101
+ |------|------|
102
+ | `LLM API error 401` | Key 无效,或与 `baseUrl` 所属网关不一致 |
103
+ | 提示先执行 `eap login` | 升级 CLI。本地 `eap chat` 不要求登录 |
104
+ | 启动失败,提示 `no API key resolved` | 把 `eap.config.json` 的 `sk-example-token` 换成有效 Token |
105
+ | executor 未调用工具 | 确认启动摘要为 `Runtime openai-http · mcp · dev`,且 Key 有效 |
106
+ | 执行中途超时 | 整图超时:请求 `config.timeout`,否则图 `config.timeout`,否则 20 分钟。短任务可在图上写更短 |
107
+ | 计划写出后图就结束 | 不要把 `planner` 写进 `finishPoints`,保持 `["__end__"]` |
108
+ | 请求进入 Foundation 模型路由 | 配置 `FOUNDATION_SERVICE_URL` |
109
+ | 工具未执行 / `NOT_CONFIGURED` | 清单缺 MCP / HTTP / code handler |
@@ -1,19 +1,19 @@
1
- {
2
- "code": "my-agent",
3
- "name": "my-agent",
4
- "version": "1.0.0",
5
- "description": "先规划,再按计划逐步执行",
6
- "toolRefs": [],
7
- "skillRefs": [],
8
- "prompts": {
9
- "system": "先规划,再按计划逐步执行。用中文回答。"
10
- },
11
- "models": {
12
- "default": "DeepSeek-V4-Pro",
13
- "allowed": ["DeepSeek-V4-Pro", "DeepSeek-V4-Flash"]
14
- },
15
- "metadata": {
16
- "owner": "agent-template",
17
- "tags": ["template"]
18
- }
19
- }
1
+ {
2
+ "code": "my-agent",
3
+ "name": "my-agent",
4
+ "version": "1.0.0",
5
+ "description": "先规划,再按计划逐步执行",
6
+ "toolRefs": [],
7
+ "skillRefs": [],
8
+ "prompts": {
9
+ "system": "先规划,再按计划逐步执行。用中文回答。"
10
+ },
11
+ "models": {
12
+ "default": "DeepSeek-V4-Pro",
13
+ "allowed": ["DeepSeek-V4-Pro", "DeepSeek-V4-Flash"]
14
+ },
15
+ "metadata": {
16
+ "owner": "agent-template",
17
+ "tags": ["template"]
18
+ }
19
+ }
@@ -1,15 +1,11 @@
1
1
  {
2
- "version": "0.2.23",
2
+ "version": "0.2.25",
3
3
  "localToolDirectories": [
4
4
  "./tools"
5
5
  ],
6
6
  "localSkillDirectories": [
7
7
  "./skills"
8
8
  ],
9
- "platform": {
10
- "foundationServiceUrl": "https://eap-foundation-test.gtcloud.cn",
11
- "portalUrl": "https://developer-portal-test.gtcloud.cn"
12
- },
13
9
  "runtime": {
14
10
  "deploymentContext": "dev",
15
11
  "governance": {
@@ -1,5 +1,5 @@
1
- lockfileVersion: 2
2
- resources:
3
- tools: []
4
- skills: []
5
- subagents: []
1
+ lockfileVersion: 2
2
+ resources:
3
+ tools: []
4
+ skills: []
5
+ subagents: []