@aigne/example-workflow-code-execution 1.7.0 → 1.8.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
@@ -92,7 +92,7 @@ The following example demonstrates how to build a code-execution workflow:
92
92
 
93
93
  ```typescript
94
94
  import assert from "node:assert";
95
- import { AIAgent, ExecutionEngine, FunctionAgent } from "@aigne/core";
95
+ import { AIAgent, AIGNE, FunctionAgent } from "@aigne/core";
96
96
  import { OpenAIChatModel } from "@aigne/core/models/openai-chat-model.js";
97
97
  import { z } from "zod";
98
98
 
@@ -123,12 +123,12 @@ const coder = AIAgent.from({
123
123
  You are a proficient coder. You write code to solve problems.
124
124
  Work with the sandbox to execute your code.
125
125
  `,
126
- tools: [sandbox],
126
+ skills: [sandbox],
127
127
  });
128
128
 
129
- const engine = new ExecutionEngine({ model });
129
+ const aigne = new AIGNE({ model });
130
130
 
131
- const result = await engine.call(coder, "10! = ?");
131
+ const result = await aigne.invoke(coder, "10! = ?");
132
132
  console.log(result);
133
133
  // Output:
134
134
  // {
package/index.test.ts CHANGED
@@ -1,5 +1,11 @@
1
- import { test } from "bun:test";
1
+ import { expect, test } from "bun:test";
2
+ import { runExampleTest } from "@aigne/test-utils/run-example-test.js";
2
3
 
3
- test("should successfully execute the workflow-code-execution", () => import("./index.js"), {
4
- timeout: 60000,
5
- });
4
+ test(
5
+ "should successfully run the workflow-code-execution",
6
+ async () => {
7
+ const { code } = await runExampleTest();
8
+ expect(code).toBe(0);
9
+ },
10
+ { timeout: 600000 },
11
+ );
package/index.ts CHANGED
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env bunwrapper
2
2
 
3
3
  import { runChatLoopInTerminal } from "@aigne/cli/utils/run-chat-loop.js";
4
- import { AIAgent, ExecutionEngine, FunctionAgent } from "@aigne/core";
4
+ import { AIAgent, AIGNE, FunctionAgent } from "@aigne/core";
5
5
  import { loadModel } from "@aigne/core/loader/index.js";
6
6
  import { z } from "zod";
7
7
 
@@ -27,13 +27,13 @@ const coder = AIAgent.from({
27
27
  You are a proficient coder. You write code to solve problems.
28
28
  Work with the sandbox to execute your code.
29
29
  `,
30
- tools: [sandbox],
30
+ skills: [sandbox],
31
31
  memory: true,
32
32
  });
33
33
 
34
- const engine = new ExecutionEngine({ model });
34
+ const aigne = new AIGNE({ model });
35
35
 
36
- const user = engine.call(coder);
36
+ const user = aigne.invoke(coder);
37
37
 
38
38
  await runChatLoopInTerminal(user, {
39
39
  welcome:
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aigne/example-workflow-code-execution",
3
- "version": "1.7.0",
3
+ "version": "1.8.0",
4
4
  "description": "A demonstration of using AIGNE Framework to build a code-execution 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-code-execution",
@@ -18,8 +18,11 @@
18
18
  "dependencies": {
19
19
  "openai": "^4.94.0",
20
20
  "zod": "^3.24.2",
21
- "@aigne/core": "^1.11.0",
22
- "@aigne/cli": "^1.7.0"
21
+ "@aigne/core": "^1.12.0",
22
+ "@aigne/cli": "^1.8.0"
23
+ },
24
+ "devDependencies": {
25
+ "@aigne/test-utils": "^0.1.0"
23
26
  },
24
27
  "scripts": {
25
28
  "start": "bun run index.ts",
package/usage.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import assert from "node:assert";
2
- import { AIAgent, ExecutionEngine, FunctionAgent } from "@aigne/core";
2
+ import { AIAgent, AIGNE, FunctionAgent } from "@aigne/core";
3
3
  import { OpenAIChatModel } from "@aigne/core/models/openai-chat-model.js";
4
4
  import { z } from "zod";
5
5
 
@@ -30,12 +30,12 @@ const coder = AIAgent.from({
30
30
  You are a proficient coder. You write code to solve problems.
31
31
  Work with the sandbox to execute your code.
32
32
  `,
33
- tools: [sandbox],
33
+ skills: [sandbox],
34
34
  });
35
35
 
36
- const engine = new ExecutionEngine({ model });
36
+ const aigne = new AIGNE({ model });
37
37
 
38
- const result = await engine.call(coder, "10! = ?");
38
+ const result = await aigne.invoke(coder, "10! = ?");
39
39
  console.log(result);
40
40
  // Output:
41
41
  // {