@aigne/example-workflow-orchestrator 1.1.0 → 1.3.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/README.md CHANGED
@@ -98,17 +98,12 @@ Here is the generated report for this example: [arcblock-deep-research.md](./gen
98
98
  ```typescript
99
99
  import assert from "node:assert";
100
100
  import { OrchestratorAgent } from "@aigne/agent-library";
101
- import {
102
- AIAgent,
103
- ChatModelOpenAI,
104
- ExecutionEngine,
105
- MCPAgent,
106
- } from "@aigne/core-next";
101
+ import { AIAgent, OpenAIChatModel, ExecutionEngine, MCPAgent } from "@aigne/core";
107
102
 
108
103
  const { OPENAI_API_KEY } = process.env;
109
104
  assert(OPENAI_API_KEY, "Please set the OPENAI_API_KEY environment variable");
110
105
 
111
- const model = new ChatModelOpenAI({
106
+ const model = new OpenAIChatModel({
112
107
  apiKey: OPENAI_API_KEY,
113
108
  });
114
109
 
@@ -158,8 +153,7 @@ const writer = AIAgent.from({
158
153
 
159
154
  const proofreader = AIAgent.from({
160
155
  name: "proofreader",
161
- description:
162
- "Review the short story for grammar, spelling, and punctuation errors",
156
+ description: "Review the short story for grammar, spelling, and punctuation errors",
163
157
  instructions: `Review the short story for grammar, spelling, and punctuation errors.
164
158
  Identify any awkward phrasing or structural issues that could improve clarity.
165
159
  Provide detailed feedback on corrections.`,
@@ -190,18 +184,17 @@ const agent = OrchestratorAgent.from({
190
184
 
191
185
  const engine = new ExecutionEngine({ model });
192
186
 
193
- const result = await engine.run(
194
- `\
195
- Conduct an in-depth research on ArcBlock using only the official website\
187
+ const result = await engine.call(
188
+ agent,
189
+ `Conduct an in-depth research on ArcBlock using only the official website\
196
190
  (avoid search engines or third-party sources) and compile a detailed report saved as arcblock.md. \
197
191
  The report should include comprehensive insights into the company's products \
198
192
  (with detailed research findings and links), technical architecture, and future plans.`,
199
- agent
200
193
  );
201
194
  console.log(result);
202
195
  // Output:
203
196
  // {
204
- // text: "Having completed the research and documentation tasks focused on ArcBlock, the final deliverable, a comprehensive report titled \"arcblock.md,\" has been created. ...",
197
+ // $message: "Having completed the research and documentation tasks focused on ArcBlock, the final deliverable, a comprehensive report titled \"arcblock.md,\" has been created. ...",
205
198
  // }
206
199
  ```
207
200
 
package/index.ts CHANGED
@@ -4,25 +4,23 @@ import assert from "node:assert";
4
4
  import { OrchestratorAgent } from "@aigne/agent-library";
5
5
  import {
6
6
  AIAgent,
7
- ChatModelOpenAI,
8
7
  ExecutionEngine,
9
8
  MCPAgent,
9
+ OpenAIChatModel,
10
10
  runChatLoopInTerminal,
11
- } from "@aigne/core-next";
11
+ } from "@aigne/core";
12
12
 
13
13
  const { OPENAI_API_KEY } = process.env;
14
14
  assert(OPENAI_API_KEY, "Please set the OPENAI_API_KEY environment variable");
15
15
 
16
- const model = new ChatModelOpenAI({
16
+ const model = new OpenAIChatModel({
17
17
  apiKey: OPENAI_API_KEY,
18
18
  });
19
19
 
20
20
  const puppeteer = await MCPAgent.from({
21
21
  command: "npx",
22
22
  args: ["-y", "@modelcontextprotocol/server-puppeteer"],
23
- env: {
24
- ...(process.env as Record<string, string>),
25
- },
23
+ env: process.env as Record<string, string>,
26
24
  });
27
25
 
28
26
  const finder = AIAgent.from({
@@ -94,7 +92,7 @@ const agent = OrchestratorAgent.from({
94
92
 
95
93
  const engine = new ExecutionEngine({ model });
96
94
 
97
- const userAgent = await engine.run(agent);
95
+ const userAgent = engine.call(agent);
98
96
 
99
97
  await runChatLoopInTerminal(userAgent, {
100
98
  welcome: "Welcome to the Orchestrator Agent!",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aigne/example-workflow-orchestrator",
3
- "version": "1.1.0",
3
+ "version": "1.3.0",
4
4
  "description": "A demonstration of using AIGNE Framework to build a orchestrator workflow",
5
5
  "author": "Arcblock <blocklet@arcblock.io> https://github.com/blocklet",
6
6
  "homepage": "https://github.com/AIGNE-io/aigne-framework/tree/main/examples/workflow-orchestrator",
@@ -16,11 +16,13 @@
16
16
  "README.md"
17
17
  ],
18
18
  "dependencies": {
19
+ "openai": "^4.89.0",
19
20
  "zod": "^3.24.2",
20
- "@aigne/agent-library": "^1.1.0",
21
- "@aigne/core-next": "^1.1.0"
21
+ "@aigne/agent-library": "^1.3.0",
22
+ "@aigne/core": "^1.3.0"
22
23
  },
23
24
  "scripts": {
24
- "start": "npx -y bun run index.ts"
25
+ "start": "npx -y bun run index.ts",
26
+ "lint": "tsc --noEmit"
25
27
  }
26
28
  }
package/usage.ts CHANGED
@@ -1,11 +1,11 @@
1
1
  import assert from "node:assert";
2
2
  import { OrchestratorAgent } from "@aigne/agent-library";
3
- import { AIAgent, ChatModelOpenAI, ExecutionEngine, MCPAgent } from "@aigne/core-next";
3
+ import { AIAgent, ExecutionEngine, MCPAgent, OpenAIChatModel } from "@aigne/core";
4
4
 
5
5
  const { OPENAI_API_KEY } = process.env;
6
6
  assert(OPENAI_API_KEY, "Please set the OPENAI_API_KEY environment variable");
7
7
 
8
- const model = new ChatModelOpenAI({
8
+ const model = new OpenAIChatModel({
9
9
  apiKey: OPENAI_API_KEY,
10
10
  });
11
11
 
@@ -86,16 +86,15 @@ const agent = OrchestratorAgent.from({
86
86
 
87
87
  const engine = new ExecutionEngine({ model });
88
88
 
89
- const result = await engine.run(
90
- `\
91
- Conduct an in-depth research on ArcBlock using only the official website\
89
+ const result = await engine.call(
90
+ agent,
91
+ `Conduct an in-depth research on ArcBlock using only the official website\
92
92
  (avoid search engines or third-party sources) and compile a detailed report saved as arcblock.md. \
93
93
  The report should include comprehensive insights into the company's products \
94
94
  (with detailed research findings and links), technical architecture, and future plans.`,
95
- agent,
96
95
  );
97
96
  console.log(result);
98
97
  // Output:
99
98
  // {
100
- // text: "Having completed the research and documentation tasks focused on ArcBlock, the final deliverable, a comprehensive report titled \"arcblock.md,\" has been created. ...",
99
+ // $message: "Having completed the research and documentation tasks focused on ArcBlock, the final deliverable, a comprehensive report titled \"arcblock.md,\" has been created. ...",
101
100
  // }