@aigne/example-workflow-orchestrator 1.9.2 → 1.10.1

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 (4) hide show
  1. package/README.md +44 -3
  2. package/index.ts +12 -16
  3. package/package.json +7 -7
  4. package/usage.ts +1 -1
package/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # Workflow Orchestrator Demo
2
2
 
3
- This is a demonstration of using [AIGNE Framework](https://github.com/AIGNE-io/aigne-framework) to build a orchestrator workflow.
3
+ This is a demonstration of using [AIGNE Framework](https://github.com/AIGNE-io/aigne-framework) to build an orchestrator workflow. The example now supports both one-shot and interactive chat modes, along with customizable model settings and pipeline input/output.
4
4
 
5
5
  ```mermaid
6
6
  flowchart LR
@@ -50,7 +50,14 @@ class style_enforcer processing
50
50
  ```bash
51
51
  export OPENAI_API_KEY=YOUR_OPENAI_API_KEY # Set your OpenAI API key
52
52
 
53
- npx -y @aigne/example-workflow-orchestrator # Run the example
53
+ # Run in one-shot mode (default)
54
+ npx -y @aigne/example-workflow-orchestrator
55
+
56
+ # Run in interactive chat mode
57
+ npx -y @aigne/example-workflow-orchestrator --chat
58
+
59
+ # Use pipeline input
60
+ echo "Research ArcBlock and compile a report about their products and architecture" | npx -y @aigne/example-workflow-orchestrator
54
61
  ```
55
62
 
56
63
  ## Installation
@@ -88,7 +95,41 @@ This ensures Puppeteer configures itself correctly for a Docker environment, pre
88
95
  ### Run the Example
89
96
 
90
97
  ```bash
91
- pnpm start
98
+ pnpm start # Run in one-shot mode (default)
99
+
100
+ # Run in interactive chat mode
101
+ pnpm start -- --chat
102
+
103
+ # Use pipeline input
104
+ echo "Research ArcBlock and compile a report about their products and architecture" | pnpm start
105
+ ```
106
+
107
+ ### Run Options
108
+
109
+ The example supports the following command-line parameters:
110
+
111
+ | Parameter | Description | Default |
112
+ |-----------|-------------|---------|
113
+ | `--chat` | Run in interactive chat mode | Disabled (one-shot mode) |
114
+ | `--model <provider[:model]>` | AI model to use in format 'provider[:model]' where model is optional. Examples: 'openai' or 'openai:gpt-4o-mini' | openai |
115
+ | `--temperature <value>` | Temperature for model generation | Provider default |
116
+ | `--top-p <value>` | Top-p sampling value | Provider default |
117
+ | `--presence-penalty <value>` | Presence penalty value | Provider default |
118
+ | `--frequency-penalty <value>` | Frequency penalty value | Provider default |
119
+ | `--log-level <level>` | Set logging level (ERROR, WARN, INFO, DEBUG, TRACE) | INFO |
120
+ | `--input`, `-i <input>` | Specify input directly | None |
121
+
122
+ #### Examples
123
+
124
+ ```bash
125
+ # Run in chat mode (interactive)
126
+ pnpm start -- --chat
127
+
128
+ # Set logging level
129
+ pnpm start -- --log-level DEBUG
130
+
131
+ # Use pipeline input
132
+ echo "Research ArcBlock and compile a report about their products and architecture" | pnpm start
92
133
  ```
93
134
 
94
135
  ## Example
package/index.ts CHANGED
@@ -1,11 +1,8 @@
1
1
  #!/usr/bin/env bunwrapper
2
2
 
3
3
  import { OrchestratorAgent } from "@aigne/agent-library/orchestrator/index.js";
4
- import { runChatLoopInTerminal } from "@aigne/cli/utils/run-chat-loop.js";
5
- import { AIAgent, AIGNE, MCPAgent } from "@aigne/core";
6
- import { loadModel } from "@aigne/core/loader/index.js";
7
-
8
- const model = await loadModel(null, { parallelToolCalls: false });
4
+ import { runWithAIGNE } from "@aigne/cli/utils/run-with-aigne.js";
5
+ import { AIAgent, MCPAgent } from "@aigne/core";
9
6
 
10
7
  const puppeteer = await MCPAgent.from({
11
8
  command: "npx",
@@ -50,17 +47,16 @@ const agent = OrchestratorAgent.from({
50
47
  tasksConcurrency: 1, // puppeteer can only run one task at a time
51
48
  });
52
49
 
53
- const aigne = new AIGNE({ model });
54
-
55
- const userAgent = aigne.invoke(agent);
56
-
57
- await runChatLoopInTerminal(userAgent, {
58
- welcome: "Welcome to the Orchestrator Agent!",
59
- defaultQuestion: `\
60
- Conduct an in-depth research on ArcBlock using only the official website\
61
- (avoid search engines or third-party sources) and compile a detailed report saved as arcblock.md. \
62
- The report should include comprehensive insights into the company's products \
63
- (with detailed research findings and links), technical architecture, and future plans.`,
50
+ await runWithAIGNE(agent, {
51
+ modelOptions: { parallelToolCalls: false },
52
+ chatLoopOptions: {
53
+ welcome: "Welcome to the Orchestrator Agent!",
54
+ defaultQuestion: `\
55
+ Conduct an in-depth research on ArcBlock using only the official website\
56
+ (avoid search engines or third-party sources) and compile a detailed report saved as arcblock.md. \
57
+ The report should include comprehensive insights into the company's products \
58
+ (with detailed research findings and links), technical architecture, and future plans.`,
59
+ },
64
60
  });
65
61
 
66
62
  process.exit(0);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aigne/example-workflow-orchestrator",
3
- "version": "1.9.2",
3
+ "version": "1.10.1",
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,14 +16,14 @@
16
16
  "README.md"
17
17
  ],
18
18
  "dependencies": {
19
- "openai": "^4.97.0",
20
- "zod": "^3.24.4",
21
- "@aigne/agent-library": "^1.8.1",
22
- "@aigne/cli": "^1.9.1",
23
- "@aigne/core": "^1.15.0"
19
+ "@aigne/agent-library": "^1.10.0",
20
+ "@aigne/core": "^1.17.0",
21
+ "@aigne/openai": "^0.2.0",
22
+ "@aigne/cli": "^1.10.1"
24
23
  },
25
24
  "devDependencies": {
26
- "@aigne/test-utils": "^0.2.0"
25
+ "@types/bun": "^1.2.9",
26
+ "@aigne/test-utils": "^0.3.1"
27
27
  },
28
28
  "scripts": {
29
29
  "start": "bun run index.ts",
package/usage.ts CHANGED
@@ -1,7 +1,7 @@
1
1
  import assert from "node:assert";
2
2
  import { OrchestratorAgent } from "@aigne/agent-library/orchestrator/index.js";
3
3
  import { AIAgent, AIGNE, MCPAgent } from "@aigne/core";
4
- import { OpenAIChatModel } from "@aigne/core/models/openai-chat-model.js";
4
+ import { OpenAIChatModel } from "@aigne/openai";
5
5
 
6
6
  const { OPENAI_API_KEY } = process.env;
7
7
  assert(OPENAI_API_KEY, "Please set the OPENAI_API_KEY environment variable");