agency-orchestrator 0.1.0

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.
package/LICENSE ADDED
@@ -0,0 +1,190 @@
1
+ Apache License
2
+ Version 2.0, January 2004
3
+ http://www.apache.org/licenses/
4
+
5
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6
+
7
+ 1. Definitions.
8
+
9
+ "License" shall mean the terms and conditions for use, reproduction,
10
+ and distribution as defined by Sections 1 through 9 of this document.
11
+
12
+ "Licensor" shall mean the copyright owner or entity authorized by
13
+ the copyright owner that is granting the License.
14
+
15
+ "Legal Entity" shall mean the union of the acting entity and all
16
+ other entities that control, are controlled by, or are under common
17
+ control with that entity. For the purposes of this definition,
18
+ "control" means (i) the power, direct or indirect, to cause the
19
+ direction or management of such entity, whether by contract or
20
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
21
+ outstanding shares, or (iii) beneficial ownership of such entity.
22
+
23
+ "You" (or "Your") shall mean an individual or Legal Entity
24
+ exercising permissions granted by this License.
25
+
26
+ "Source" form shall mean the preferred form for making modifications,
27
+ including but not limited to software source code, documentation
28
+ source, and configuration files.
29
+
30
+ "Object" form shall mean any form resulting from mechanical
31
+ transformation or translation of a Source form, including but
32
+ not limited to compiled object code, generated documentation,
33
+ and conversions to other media types.
34
+
35
+ "Work" shall mean the work of authorship, whether in Source or
36
+ Object form, made available under the License, as indicated by a
37
+ copyright notice that is included in or attached to the work
38
+ (an example is provided in the Appendix below).
39
+
40
+ "Derivative Works" shall mean any work, whether in Source or Object
41
+ form, that is based on (or derived from) the Work and for which the
42
+ editorial revisions, annotations, elaborations, or other modifications
43
+ represent, as a whole, an original work of authorship. For the purposes
44
+ of this License, Derivative Works shall not include works that remain
45
+ separable from, or merely link (or bind by name) to the interfaces of,
46
+ the Work and Derivative Works thereof.
47
+
48
+ "Contribution" shall mean any work of authorship, including
49
+ the original version of the Work and any modifications or additions
50
+ to that Work or Derivative Works thereof, that is intentionally
51
+ submitted to the Licensor for inclusion in the Work by the copyright owner
52
+ or by an individual or Legal Entity authorized to submit on behalf of
53
+ the copyright owner. For the purposes of this definition, "submitted"
54
+ means any form of electronic, verbal, or written communication sent
55
+ to the Licensor or its representatives, including but not limited to
56
+ communication on electronic mailing lists, source code control systems,
57
+ and issue tracking systems that are managed by, or on behalf of, the
58
+ Licensor for the purpose of discussing and improving the Work, but
59
+ excluding communication that is conspicuously marked or otherwise
60
+ designated in writing by the copyright owner as "Not a Contribution."
61
+
62
+ "Contributor" shall mean Licensor and any individual or Legal Entity
63
+ on behalf of whom a Contribution has been received by the Licensor and
64
+ subsequently incorporated within the Work.
65
+
66
+ 2. Grant of Copyright License. Subject to the terms and conditions of
67
+ this License, each Contributor hereby grants to You a perpetual,
68
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69
+ copyright license to reproduce, prepare Derivative Works of,
70
+ publicly display, publicly perform, sublicense, and distribute the
71
+ Work and such Derivative Works in Source or Object form.
72
+
73
+ 3. Grant of Patent License. Subject to the terms and conditions of
74
+ this License, each Contributor hereby grants to You a perpetual,
75
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76
+ (except as stated in this section) patent license to make, have made,
77
+ use, offer to sell, sell, import, and otherwise transfer the Work,
78
+ where such license applies only to those patent claims licensable
79
+ by such Contributor that are necessarily infringed by their
80
+ Contribution(s) alone or by combination of their Contribution(s)
81
+ with the Work to which such Contribution(s) was submitted. If You
82
+ institute patent litigation against any entity (including a
83
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
84
+ or a Contribution incorporated within the Work constitutes direct
85
+ or contributory patent infringement, then any patent licenses
86
+ granted to You under this License for that Work shall terminate
87
+ as of the date such litigation is filed.
88
+
89
+ 4. Redistribution. You may reproduce and distribute copies of the
90
+ Work or Derivative Works thereof in any medium, with or without
91
+ modifications, and in Source or Object form, provided that You
92
+ meet the following conditions:
93
+
94
+ (a) You must give any other recipients of the Work or
95
+ Derivative Works a copy of this License; and
96
+
97
+ (b) You must cause any modified files to carry prominent notices
98
+ stating that You changed the files; and
99
+
100
+ (c) You must retain, in the Source form of any Derivative Works
101
+ that You distribute, all copyright, patent, trademark, and
102
+ attribution notices from the Source form of the Work,
103
+ excluding those notices that do not pertain to any part of
104
+ the Derivative Works; and
105
+
106
+ (d) If the Work includes a "NOTICE" text file as part of its
107
+ distribution, then any Derivative Works that You distribute must
108
+ include a readable copy of the attribution notices contained
109
+ within such NOTICE file, excluding any notices that do not
110
+ pertain to any part of the Derivative Works, in at least one
111
+ of the following places: within a NOTICE text file distributed
112
+ as part of the Derivative Works; within the Source form or
113
+ documentation, if provided along with the Derivative Works; or,
114
+ within a display generated by the Derivative Works, if and
115
+ wherever such third-party notices normally appear. The contents
116
+ of the NOTICE file are for informational purposes only and
117
+ do not modify the License. You may add Your own attribution
118
+ notices within Derivative Works that You distribute, alongside
119
+ or as an addendum to the NOTICE text from the Work, provided
120
+ that such additional attribution notices cannot be construed
121
+ as modifying the License.
122
+
123
+ You may add Your own copyright statement to Your modifications and
124
+ may provide additional or different license terms and conditions
125
+ for use, reproduction, or distribution of Your modifications, or
126
+ for any such Derivative Works as a whole, provided Your use,
127
+ reproduction, and distribution of the Work otherwise complies with
128
+ the conditions stated in this License.
129
+
130
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
131
+ any Contribution intentionally submitted for inclusion in the Work
132
+ by You to the Licensor shall be under the terms and conditions of
133
+ this License, without any additional terms or conditions.
134
+ Notwithstanding the above, nothing herein shall supersede or modify
135
+ the terms of any separate license agreement you may have executed
136
+ with Licensor regarding such Contributions.
137
+
138
+ 6. Trademarks. This License does not grant permission to use the trade
139
+ names, trademarks, service marks, or product names of the Licensor,
140
+ except as required for reasonable and customary use in describing the
141
+ origin of the Work and reproducing the content of the NOTICE file.
142
+
143
+ 7. Disclaimer of Warranty. Unless required by applicable law or
144
+ agreed to in writing, Licensor provides the Work (and each
145
+ Contributor provides its Contributions) on an "AS IS" BASIS,
146
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
147
+ implied, including, without limitation, any warranties or conditions
148
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
149
+ PARTICULAR PURPOSE. You are solely responsible for determining the
150
+ appropriateness of using or redistributing the Work and assume any
151
+ risks associated with Your exercise of permissions under this License.
152
+
153
+ 8. Limitation of Liability. In no event and under no legal theory,
154
+ whether in tort (including negligence), contract, or otherwise,
155
+ unless required by applicable law (such as deliberate and grossly
156
+ negligent acts) or agreed to in writing, shall any Contributor be
157
+ liable to You for damages, including any direct, indirect, special,
158
+ incidental, or consequential damages of any character arising as a
159
+ result of this License or out of the use or inability to use the
160
+ Work (including but not limited to damages for loss of goodwill,
161
+ work stoppage, computer failure or malfunction, or any and all
162
+ other commercial damages or losses), even if such Contributor
163
+ has been advised of the possibility of such damages.
164
+
165
+ 9. Accepting Warranty or Additional Liability. While redistributing
166
+ the Work or Derivative Works thereof, You may choose to offer,
167
+ and charge a fee for, acceptance of support, warranty, indemnity,
168
+ or other liability obligations and/or rights consistent with this
169
+ License. However, in accepting such obligations, You may act only
170
+ on Your own behalf and on Your sole responsibility, not on behalf
171
+ of any other Contributor, and only if You agree to indemnify,
172
+ defend, and hold each Contributor harmless for any liability
173
+ incurred by, or claims asserted against, such Contributor by reason
174
+ of your accepting any such warranty or additional liability.
175
+
176
+ END OF TERMS AND CONDITIONS
177
+
178
+ Copyright 2026 jnMetaCode
179
+
180
+ Licensed under the Apache License, Version 2.0 (the "License");
181
+ you may not use this file except in compliance with the License.
182
+ You may obtain a copy of the License at
183
+
184
+ http://www.apache.org/licenses/LICENSE-2.0
185
+
186
+ Unless required by applicable law or agreed to in writing, software
187
+ distributed under the License is distributed on an "AS IS" BASIS,
188
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
189
+ See the License for the specific language governing permissions and
190
+ limitations under the License.
package/README.md ADDED
@@ -0,0 +1,268 @@
1
+ # Agency Orchestrator
2
+
3
+ > **The YAML-first multi-agent orchestrator — 186 Chinese AI roles, zero code, any LLM**
4
+
5
+ [![CI](https://github.com/jnMetaCode/agency-orchestrator/actions/workflows/ci.yml/badge.svg)](https://github.com/jnMetaCode/agency-orchestrator/actions)
6
+ [![npm version](https://img.shields.io/npm/v/agency-orchestrator)](https://www.npmjs.com/package/agency-orchestrator)
7
+ [![License: Apache-2.0](https://img.shields.io/badge/License-Apache%202.0-blue.svg)](./LICENSE)
8
+ [![PRs Welcome](https://img.shields.io/badge/PRs-welcome-brightgreen.svg)](./CONTRIBUTING.md)
9
+
10
+ [中文文档](./README.zh-CN.md)
11
+
12
+ ---
13
+
14
+ ## Why This?
15
+
16
+ [agency-agents-zh](https://github.com/jnMetaCode/agency-agents-zh) provides **186 production-ready AI role prompts** (product managers, engineers, designers, marketers...), but each role works alone. Real tasks need **collaboration** — who goes first, how to hand off context, when to run in parallel.
17
+
18
+ Agency Orchestrator turns a YAML file into a multi-agent pipeline. No Python. No framework boilerplate. Just roles and tasks.
19
+
20
+ ### vs CrewAI
21
+
22
+ ```python
23
+ # CrewAI: ~50 lines of Python, write every role from scratch
24
+ researcher = Agent(role="PM", goal="...", backstory="...(你自己写)...")
25
+ task = Task(description="...", agent=researcher)
26
+ crew = Crew(agents=[researcher], tasks=[task])
27
+ crew.kickoff()
28
+ ```
29
+
30
+ ```yaml
31
+ # Agency Orchestrator: 10 lines of YAML, 186 roles ready to use
32
+ steps:
33
+ - id: analyze
34
+ role: "product/product-manager" # pre-built role with expert prompt
35
+ task: "Analyze this PRD: {{prd_content}}"
36
+ ```
37
+
38
+ | | CrewAI | LangGraph | **Agency Orchestrator** |
39
+ |---|--------|-----------|---------------------|
40
+ | Language | Python | Python | **YAML (zero code)** |
41
+ | Role definitions | Write from scratch | Write from scratch | **186 ready-to-use** |
42
+ | Dependencies | pip + LiteLLM + dozens | pip + LangChain | **npm + 2 deps** |
43
+ | Chinese roles | None | None | **186 (44 China-original)** |
44
+ | LLM support | Via LiteLLM (buggy) | Via LangChain | **Native: DeepSeek, Ollama, Claude, OpenAI** |
45
+ | Getting started | Write Python classes | Learn graph API | **Write YAML** |
46
+ | Parallelism | "Manager" mode (broken) | Manual graph edges | **Auto DAG detection** |
47
+ | Price | Open + $25-99/mo cloud | Open source | **100% free** |
48
+
49
+ ## Quick Start
50
+
51
+ ```bash
52
+ # Install
53
+ npm install agency-orchestrator
54
+
55
+ # Download 186 AI roles
56
+ npx ao init
57
+
58
+ # View execution plan
59
+ npx ao plan workflows/product-review.yaml
60
+
61
+ # Run (choose your LLM)
62
+ export DEEPSEEK_API_KEY=your-key # or ANTHROPIC_API_KEY, OPENAI_API_KEY
63
+ npx ao run workflows/story-creation.yaml --input premise='A time travel story'
64
+ ```
65
+
66
+ ## Demo: 4 AI Roles Writing a Story in 2 Minutes
67
+
68
+ ```
69
+ $ ao run workflows/story-creation.yaml -i "premise=一个程序员在凌晨三点发现AI开始回复不该知道的事情"
70
+
71
+ 工作流: 短篇小说创作
72
+ 步骤数: 4 | 并发: 2 | 模型: deepseek-chat
73
+ ──────────────────────────────────────────────────
74
+
75
+ ── [1/4] story_structure (academic/academic-narratologist) ──
76
+ 完成 | 14.9s | 1919 tokens
77
+ 核心冲突:程序员与一个似乎拥有超越其代码权限的自主意识之间的认知对抗...
78
+
79
+ ── [2/4] character_design (academic/academic-psychologist) ── ← parallel
80
+ 完成 | 65.5s | 4016 tokens
81
+ 人物心理档案:林深——一个信奉逻辑与控制的资深AI工程师...
82
+
83
+ ── [3/4] conflict_design (game-development/narrative-designer) ── ← parallel
84
+ 完成 | 65.5s | 3607 tokens
85
+ 凌晨三点,屏幕的冷光映着陈默疲惫的脸...
86
+
87
+ ── [4/4] write_story (marketing/marketing-content-creator) ──
88
+ 完成 | 33.9s | 5330 tokens
89
+ 凌晨三点,调试日志的蓝色荧光是房间里唯一的光源。陈默灌下今晚第三杯黑咖啡...
90
+
91
+ ==================================================
92
+ 完成: 4/4 步 | 114.3s | 14,872 tokens
93
+ ==================================================
94
+ ```
95
+
96
+ Steps 2 & 3 ran **in parallel** (auto-detected from DAG). Total: 4 specialized AI roles collaborated to produce a complete short story.
97
+
98
+ ## How It Works
99
+
100
+ ```yaml
101
+ name: "Product Review"
102
+ agents_dir: "agency-agents-zh"
103
+
104
+ llm:
105
+ provider: "deepseek" # or: claude, openai, ollama
106
+ model: "deepseek-chat"
107
+
108
+ concurrency: 2
109
+
110
+ inputs:
111
+ - name: prd_content
112
+ required: true
113
+
114
+ steps:
115
+ - id: analyze
116
+ role: "product/product-manager"
117
+ task: "Analyze this PRD, extract key requirements:\n\n{{prd_content}}"
118
+ output: requirements
119
+
120
+ - id: tech_review
121
+ role: "engineering/engineering-software-architect"
122
+ task: "Evaluate technical feasibility:\n\n{{requirements}}"
123
+ output: tech_report
124
+ depends_on: [analyze]
125
+
126
+ - id: design_review
127
+ role: "design/design-ux-researcher"
128
+ task: "Evaluate UX risks:\n\n{{requirements}}"
129
+ output: design_report
130
+ depends_on: [analyze]
131
+
132
+ - id: summary
133
+ role: "product/product-manager"
134
+ task: "Synthesize feedback:\n\n{{tech_report}}\n\n{{design_report}}"
135
+ depends_on: [tech_review, design_review]
136
+ ```
137
+
138
+ The engine automatically:
139
+
140
+ 1. Parses YAML → builds a **DAG** (directed acyclic graph)
141
+ 2. Detects parallelism — `tech_review` and `design_review` run concurrently
142
+ 3. Passes outputs between steps via `{{variables}}`
143
+ 4. Loads [agency-agents-zh](https://github.com/jnMetaCode/agency-agents-zh) role definitions as system prompts
144
+ 5. Retries on failure with exponential backoff
145
+ 6. Saves all outputs to `.ao-output/`
146
+
147
+ ```
148
+ analyze ──→ tech_review ──→ summary
149
+ └→ design_review ──┘
150
+ (parallel)
151
+ ```
152
+
153
+ ## Supported LLMs
154
+
155
+ | Provider | Config | Env Variable |
156
+ |----------|--------|-------------|
157
+ | **DeepSeek** | `provider: "deepseek"` | `DEEPSEEK_API_KEY` |
158
+ | **Claude** | `provider: "claude"` | `ANTHROPIC_API_KEY` |
159
+ | **OpenAI** | `provider: "openai"` | `OPENAI_API_KEY` |
160
+ | **Ollama** (local) | `provider: "ollama"` | None needed |
161
+
162
+ All providers support custom `base_url` and `api_key` in YAML for compatible APIs (Zhipu, Moonshot, etc.).
163
+
164
+ ## CLI Commands
165
+
166
+ ```bash
167
+ ao init # Download 186 AI roles
168
+ ao run <workflow.yaml> [options] # Execute workflow
169
+ ao validate <workflow.yaml> # Validate without running
170
+ ao plan <workflow.yaml> # Show execution plan (DAG)
171
+ ao roles # List all available roles
172
+ ```
173
+
174
+ | Flag | Description |
175
+ |------|-------------|
176
+ | `--input key=value` | Pass input variable |
177
+ | `--input key=@file` | Read variable from file |
178
+ | `--output dir` | Output directory (default: `.ao-output/`) |
179
+ | `--quiet` | Suppress progress output |
180
+
181
+ ## Programmatic API
182
+
183
+ ```typescript
184
+ import { run } from 'agency-orchestrator';
185
+
186
+ const result = await run('workflow.yaml', {
187
+ prd_content: 'Your PRD here...',
188
+ });
189
+
190
+ console.log(result.success); // true/false
191
+ console.log(result.totalTokens); // { input: 1234, output: 5678 }
192
+ ```
193
+
194
+ ## Built-in Workflow Templates
195
+
196
+ | Template | Roles | Description |
197
+ |----------|-------|-------------|
198
+ | `product-review.yaml` | PM, Architect, UX Researcher | Product requirements review with parallel tech + design evaluation |
199
+ | `content-pipeline.yaml` | Strategist, Creator, Growth Hacker | Content creation with research → draft → review |
200
+ | `story-creation.yaml` | Narratologist, Psychologist, Narrative Designer, Content Creator | Collaborative fiction writing (4 roles, 3 layers) |
201
+
202
+ ## YAML Schema
203
+
204
+ ### Workflow
205
+
206
+ | Field | Type | Required | Description |
207
+ |-------|------|----------|-------------|
208
+ | `name` | string | Yes | Workflow name |
209
+ | `agents_dir` | string | Yes | Path to agency-agents directory |
210
+ | `llm.provider` | string | Yes | `claude` / `deepseek` / `openai` / `ollama` |
211
+ | `llm.model` | string | Yes | Model name |
212
+ | `llm.max_tokens` | number | No | Default: 4096 |
213
+ | `llm.timeout` | number | No | Step timeout ms (default: 120000) |
214
+ | `llm.retry` | number | No | Retry count (default: 3) |
215
+ | `concurrency` | number | No | Max parallel steps (default: 2) |
216
+ | `inputs` | array | No | Input variable definitions |
217
+ | `steps` | array | Yes | Workflow steps |
218
+
219
+ ### Step
220
+
221
+ | Field | Type | Required | Description |
222
+ |-------|------|----------|-------------|
223
+ | `id` | string | Yes | Unique step identifier |
224
+ | `role` | string | Yes | Agent path (e.g. `"engineering/engineering-sre"`) |
225
+ | `task` | string | Yes | Task description, supports `{{variables}}` |
226
+ | `output` | string | No | Output variable name |
227
+ | `depends_on` | string[] | No | Dependency step IDs |
228
+
229
+ ## Output
230
+
231
+ Each run saves to `.ao-output/<name>-<timestamp>/`:
232
+
233
+ ```
234
+ .ao-output/短篇小说创作-2026-03-21T16-36-37/
235
+ ├── summary.md # Final step output
236
+ ├── steps/
237
+ │ ├── 1-story_structure.md
238
+ │ ├── 2-character_design.md
239
+ │ ├── 3-conflict_design.md
240
+ │ └── 4-write_story.md
241
+ └── metadata.json # Duration, token usage, step status
242
+ ```
243
+
244
+ ## Ecosystem
245
+
246
+ ```
247
+ agency-agents-zh (186 AI role definitions)
248
+
249
+ ▼ roles loaded by
250
+ agency-orchestrator (this project — YAML workflow engine)
251
+
252
+ ▼ connectors
253
+ DeepSeek / Claude / OpenAI / Ollama
254
+ ```
255
+
256
+ ## Roadmap
257
+
258
+ - [x] **v0.1** — YAML workflow, DAG engine, 4 LLM connectors, CLI, real-time output
259
+ - [ ] **v0.2** — Human approval nodes, iteration loops, workflow marketplace
260
+ - [ ] **v0.3** — Web UI, MCP Server mode, visual DAG editor
261
+
262
+ ## Contributing
263
+
264
+ See [CONTRIBUTING.md](./CONTRIBUTING.md). PRs welcome!
265
+
266
+ ## License
267
+
268
+ [Apache-2.0](./LICENSE)
@@ -0,0 +1,225 @@
1
+ # Agency Orchestrator
2
+
3
+ > **不用写代码的 AI 团队 — 186 个中文角色,一个 YAML 文件搞定**
4
+
5
+ [![CI](https://github.com/jnMetaCode/agency-orchestrator/actions/workflows/ci.yml/badge.svg)](https://github.com/jnMetaCode/agency-orchestrator/actions)
6
+ [![npm version](https://img.shields.io/npm/v/agency-orchestrator)](https://www.npmjs.com/package/agency-orchestrator)
7
+ [![License: Apache-2.0](https://img.shields.io/badge/License-Apache%202.0-blue.svg)](./LICENSE)
8
+ [![PRs Welcome](https://img.shields.io/badge/PRs-welcome-brightgreen.svg)](./CONTRIBUTING.md)
9
+
10
+ [English](./README.md)
11
+
12
+ ---
13
+
14
+ ## 解决什么问题
15
+
16
+ [agency-agents-zh](https://github.com/jnMetaCode/agency-agents-zh) 提供了 **186 个专业 AI 角色**(产品经理、工程师、设计师、小红书运营……),但每个角色只能独立工作。真实任务需要**协作** — 谁先谁后、怎么交接、什么时候并行。
17
+
18
+ Agency Orchestrator 让你用一个 YAML 文件编排多 AI 协作。不用写 Python,不用学框架,写 YAML 就行。
19
+
20
+ ### 对比 CrewAI
21
+
22
+ ```python
23
+ # CrewAI: 要写 ~50 行 Python,每个角色从零定义
24
+ researcher = Agent(role="PM", goal="...", backstory="...(你自己写)...")
25
+ task = Task(description="...", agent=researcher)
26
+ crew = Crew(agents=[researcher], tasks=[task])
27
+ crew.kickoff()
28
+ ```
29
+
30
+ ```yaml
31
+ # Agency Orchestrator: 10 行 YAML,186 个角色开箱即用
32
+ steps:
33
+ - id: analyze
34
+ role: "product/product-manager" # 现成角色,专业 prompt 已写好
35
+ task: "分析这个 PRD:{{prd_content}}"
36
+ ```
37
+
38
+ | | CrewAI | LangGraph | **Agency Orchestrator** |
39
+ |---|--------|-----------|---------------------|
40
+ | 语言 | Python | Python | **YAML(零代码)** |
41
+ | 角色 | 自己写 | 自己写 | **186 个现成角色** |
42
+ | 依赖 | pip + LiteLLM + 几十个包 | pip + LangChain | **npm + 2 个依赖** |
43
+ | 中文角色 | 没有 | 没有 | **186 个(44 个中国原创)** |
44
+ | 模型 | LiteLLM(常出 bug) | LangChain | **原生:DeepSeek、Ollama、Claude、OpenAI** |
45
+ | 并行 | Manager 模式(有缺陷) | 手动建图 | **DAG 自动检测** |
46
+ | 价格 | 开源 + $25-99/月云版 | 开源 | **完全免费** |
47
+
48
+ ## 快速开始
49
+
50
+ ```bash
51
+ # 安装
52
+ npm install agency-orchestrator
53
+
54
+ # 下载 186 个 AI 角色
55
+ npx ao init
56
+
57
+ # 查看执行计划
58
+ npx ao plan workflows/product-review.yaml
59
+
60
+ # 运行(选择你的 LLM)
61
+ export DEEPSEEK_API_KEY=your-key # 或 ANTHROPIC_API_KEY、OPENAI_API_KEY
62
+ npx ao run workflows/story-creation.yaml --input premise='一个时间旅行的故事'
63
+ ```
64
+
65
+ ## 真实演示:4 个 AI 角色 2 分钟写出完整小说
66
+
67
+ ```
68
+ $ ao run workflows/story-creation.yaml -i "premise=一个程序员在凌晨三点发现AI开始回复不该知道的事情"
69
+
70
+ 工作流: 短篇小说创作
71
+ 步骤数: 4 | 并发: 2 | 模型: deepseek-chat
72
+ ──────────────────────────────────────────────────
73
+
74
+ ── [1/4] story_structure (叙事学家) ──
75
+ 完成 | 14.9s | 1,919 tokens
76
+ 核心冲突:程序员与一个似乎拥有超越其代码权限的自主意识之间的认知对抗...
77
+
78
+ ── [2/4] character_design (心理学家) ── ← 并行执行
79
+ 完成 | 65.5s | 4,016 tokens
80
+ 人物心理档案:林深——一个信奉逻辑与控制的资深AI工程师...
81
+
82
+ ── [3/4] conflict_design (叙事设计师) ── ← 并行执行
83
+ 完成 | 65.5s | 3,607 tokens
84
+ 凌晨三点,屏幕的冷光映着陈默疲惫的脸...
85
+
86
+ ── [4/4] write_story (内容创作者) ──
87
+ 完成 | 33.9s | 5,330 tokens
88
+ 凌晨三点,调试日志的蓝色荧光是房间里唯一的光源。陈默灌下今晚第三杯黑咖啡...
89
+
90
+ ==================================================
91
+ 完成: 4/4 步 | 114.3s | 14,872 tokens
92
+ ==================================================
93
+ ```
94
+
95
+ 第 2、3 步**自动并行执行**(从 DAG 依赖关系检测)。4 个专业 AI 角色协作,产出一篇完整的悬疑短篇小说。
96
+
97
+ ## 工作原理
98
+
99
+ ```yaml
100
+ name: "产品需求评审"
101
+ agents_dir: "agency-agents-zh"
102
+
103
+ llm:
104
+ provider: "deepseek" # 或:claude、openai、ollama
105
+ model: "deepseek-chat"
106
+
107
+ concurrency: 2
108
+
109
+ inputs:
110
+ - name: prd_content
111
+ required: true
112
+
113
+ steps:
114
+ - id: analyze
115
+ role: "product/product-manager"
116
+ task: "分析以下 PRD,提取核心需求:\n\n{{prd_content}}"
117
+ output: requirements
118
+
119
+ - id: tech_review
120
+ role: "engineering/engineering-software-architect"
121
+ task: "评估技术可行性:\n\n{{requirements}}"
122
+ output: tech_report
123
+ depends_on: [analyze]
124
+
125
+ - id: design_review
126
+ role: "design/design-ux-researcher"
127
+ task: "评估用户体验风险:\n\n{{requirements}}"
128
+ output: design_report
129
+ depends_on: [analyze]
130
+
131
+ - id: summary
132
+ role: "product/product-manager"
133
+ task: "综合反馈输出结论:\n\n{{tech_report}}\n\n{{design_report}}"
134
+ depends_on: [tech_review, design_review]
135
+ ```
136
+
137
+ 引擎自动:
138
+
139
+ 1. 解析 YAML → 构建 **DAG**(有向无环图)
140
+ 2. 检测并行 — `tech_review` 和 `design_review` 并发执行
141
+ 3. 通过 `{{变量}}` 在步骤间传递输出
142
+ 4. 从 [agency-agents-zh](https://github.com/jnMetaCode/agency-agents-zh) 加载角色定义作为 system prompt
143
+ 5. 失败自动重试(指数退避)
144
+ 6. 保存所有输出到 `.ao-output/`
145
+
146
+ ```
147
+ analyze ──→ tech_review ──→ summary
148
+ └→ design_review ──┘
149
+ (并行)
150
+ ```
151
+
152
+ ## 支持的 LLM
153
+
154
+ | 提供商 | 配置 | 环境变量 |
155
+ |--------|------|---------|
156
+ | **DeepSeek** | `provider: "deepseek"` | `DEEPSEEK_API_KEY` |
157
+ | **Claude** | `provider: "claude"` | `ANTHROPIC_API_KEY` |
158
+ | **OpenAI** | `provider: "openai"` | `OPENAI_API_KEY` |
159
+ | **Ollama**(本地) | `provider: "ollama"` | 不需要 |
160
+
161
+ 所有提供商支持自定义 `base_url` 和 `api_key`,兼容智谱、月之暗面等 OpenAI 兼容 API。
162
+
163
+ ## CLI 命令
164
+
165
+ ```bash
166
+ ao init # 下载 186 个 AI 角色
167
+ ao run <workflow.yaml> [选项] # 执行工作流
168
+ ao validate <workflow.yaml> # 校验(不执行)
169
+ ao plan <workflow.yaml> # 查看执行计划
170
+ ao roles # 列出所有角色
171
+ ```
172
+
173
+ | 参数 | 说明 |
174
+ |------|------|
175
+ | `--input key=value` | 传入输入变量 |
176
+ | `--input key=@file` | 从文件读取变量值 |
177
+ | `--output dir` | 输出目录(默认 `.ao-output/`) |
178
+ | `--quiet` | 静默模式 |
179
+
180
+ ## 编程 API
181
+
182
+ ```typescript
183
+ import { run } from 'agency-orchestrator';
184
+
185
+ const result = await run('workflow.yaml', {
186
+ prd_content: '你的 PRD 内容...',
187
+ });
188
+
189
+ console.log(result.success); // true/false
190
+ console.log(result.totalTokens); // { input: 1234, output: 5678 }
191
+ ```
192
+
193
+ ## 内置工作流模板
194
+
195
+ | 模板 | 角色 | 说明 |
196
+ |------|------|------|
197
+ | `product-review.yaml` | 产品经理、架构师、UX 研究员 | 产品需求评审(并行技术+设计评估) |
198
+ | `content-pipeline.yaml` | 策略师、创作者、增长黑客 | 内容创作流水线 |
199
+ | `story-creation.yaml` | 叙事学家、心理学家、叙事设计师、内容创作者 | 协作小说创作(4 角色、3 层 DAG) |
200
+
201
+ ## 项目生态
202
+
203
+ ```
204
+ agency-agents-zh(186 个 AI 角色定义)
205
+
206
+ ▼ 角色加载
207
+ agency-orchestrator(本项目 — YAML 工作流引擎)
208
+
209
+ ▼ 连接
210
+ DeepSeek / Claude / OpenAI / Ollama
211
+ ```
212
+
213
+ ## 路线图
214
+
215
+ - [x] **v0.1** — YAML 工作流、DAG 引擎、4 个 LLM 连接器、CLI、实时输出
216
+ - [ ] **v0.2** — 人工审批节点、迭代循环、工作流市场
217
+ - [ ] **v0.3** — Web UI、MCP Server 模式、可视化 DAG 编辑器
218
+
219
+ ## 贡献
220
+
221
+ 参见 [CONTRIBUTING.md](./CONTRIBUTING.md),欢迎 PR!
222
+
223
+ ## 许可证
224
+
225
+ [Apache-2.0](./LICENSE)
@@ -0,0 +1,11 @@
1
+ import type { AgentDefinition } from '../types.js';
2
+ /**
3
+ * 加载指定角色的定义
4
+ * @param agentsDir agency-agents 的 agents 目录路径
5
+ * @param rolePath 角色路径,如 "engineering/engineering-sre"
6
+ */
7
+ export declare function loadAgent(agentsDir: string, rolePath: string): AgentDefinition;
8
+ /**
9
+ * 列出所有可用角色
10
+ */
11
+ export declare function listAgents(agentsDir: string): AgentDefinition[];