@aigne/agent-library 1.6.1 → 1.7.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.
package/CHANGELOG.md CHANGED
@@ -2,6 +2,29 @@
2
2
 
3
3
  - chore: release 1.2.0
4
4
 
5
+ ## [1.7.1](https://github.com/AIGNE-io/aigne-framework/compare/agent-library-v1.7.0...agent-library-v1.7.1) (2025-04-30)
6
+
7
+
8
+ ### Dependencies
9
+
10
+ * The following workspace dependencies were updated
11
+ * dependencies
12
+ * @aigne/core bumped to 1.13.0
13
+
14
+ ## [1.7.0](https://github.com/AIGNE-io/aigne-framework/compare/agent-library-v1.6.1...agent-library-v1.7.0) (2025-04-27)
15
+
16
+
17
+ ### Features
18
+
19
+ * support TeamAgent and finalize API naming ([#91](https://github.com/AIGNE-io/aigne-framework/issues/91)) ([033d1b6](https://github.com/AIGNE-io/aigne-framework/commit/033d1b6a7dc5460807476abb35a413ba89a2a664))
20
+
21
+
22
+ ### Dependencies
23
+
24
+ * The following workspace dependencies were updated
25
+ * dependencies
26
+ * @aigne/core bumped to 1.12.0
27
+
5
28
  ## [1.6.1](https://github.com/AIGNE-io/aigne-framework/compare/agent-library-v1.6.0...agent-library-v1.6.1) (2025-04-23)
6
29
 
7
30
 
package/README.md CHANGED
@@ -38,7 +38,7 @@ pnpm add @aigne/agent-library @aigne/core
38
38
  ## Basic Usage
39
39
 
40
40
  ```typescript
41
- import { ExecutionEngine } from "@aigne/core";
41
+ import { AIGNE } from "@aigne/core";
42
42
  import { OpenAIChatModel } from "@aigne/core/models/openai-chat-model.js";
43
43
  import { OrchestratorAgent } from "@aigne/agent-library/orchestrator";
44
44
 
@@ -48,8 +48,8 @@ const model = new OpenAIChatModel({
48
48
  model: "gpt-4-turbo",
49
49
  });
50
50
 
51
- // Create execution engine
52
- const engine = new ExecutionEngine({ model });
51
+ // Create AIGNE
52
+ const aigne = new AIGNE({ model });
53
53
 
54
54
  // Create orchestrator agent
55
55
  const orchestrator = new OrchestratorAgent({
@@ -59,8 +59,8 @@ const orchestrator = new OrchestratorAgent({
59
59
  });
60
60
 
61
61
  // Execute orchestration task
62
- const userAgent = await engine.call(orchestrator);
63
- const result = await userAgent.call("Analyze this article and generate a summary and keywords");
62
+ const userAgent = await aigne.invoke(orchestrator);
63
+ const result = await userAgent.invoke("Analyze this article and generate a summary and keywords");
64
64
  console.log(result);
65
65
  ```
66
66
 
@@ -75,7 +75,7 @@ The library currently provides one specialized agent implementation:
75
75
  ### Creating an Orchestration Workflow
76
76
 
77
77
  ```typescript
78
- import { AIAgent, ExecutionEngine } from "@aigne/core";
78
+ import { AIAgent, AIGNE } from "@aigne/core";
79
79
  import { OpenAIChatModel } from "@aigne/core/models/openai-chat-model.js";
80
80
  import { OrchestratorAgent } from "@aigne/agent-library/orchestrator";
81
81
 
@@ -107,16 +107,16 @@ const editorAgent = AIAgent.from({
107
107
  const orchestrator = new OrchestratorAgent({
108
108
  name: "WorkflowOrchestrator",
109
109
  instructions: "You are responsible for coordinating research, writing, and editing processes.",
110
- tools: [researchAgent, writerAgent, editorAgent],
110
+ skills: [researchAgent, writerAgent, editorAgent],
111
111
  // Optional configuration
112
112
  maxIterations: 30, // Maximum number of iterations
113
113
  tasksConcurrency: 5, // Task concurrency
114
114
  });
115
115
 
116
116
  // Use the orchestrator agent
117
- const engine = new ExecutionEngine({ model });
118
- const userAgent = await engine.call(orchestrator);
119
- const result = await userAgent.call("Applications of artificial intelligence in healthcare");
117
+ const aigne = new AIGNE({ model });
118
+ const userAgent = await aigne.invoke(orchestrator);
119
+ const result = await userAgent.invoke("Applications of artificial intelligence in healthcare");
120
120
  console.log(result);
121
121
  ```
122
122
 
package/README.zh.md CHANGED
@@ -38,7 +38,7 @@ pnpm add @aigne/agent-library @aigne/core
38
38
  ## 基本用法
39
39
 
40
40
  ```typescript
41
- import { ExecutionEngine } from "@aigne/core";
41
+ import { AIGNE } from "@aigne/core";
42
42
  import { OpenAIChatModel } from "@aigne/core/models/openai-chat-model.js";
43
43
  import { OrchestratorAgent } from "@aigne/agent-library/orchestrator";
44
44
 
@@ -49,7 +49,7 @@ const model = new OpenAIChatModel({
49
49
  });
50
50
 
51
51
  // 创建执行引擎
52
- const engine = new ExecutionEngine({ model });
52
+ const aigne = new AIGNE({ model });
53
53
 
54
54
  // 创建编排代理
55
55
  const orchestrator = new OrchestratorAgent({
@@ -59,8 +59,8 @@ const orchestrator = new OrchestratorAgent({
59
59
  });
60
60
 
61
61
  // 执行编排任务
62
- const userAgent = await engine.call(orchestrator);
63
- const result = await userAgent.call("分析这篇文章并生成摘要和关键词");
62
+ const userAgent = await aigne.invoke(orchestrator);
63
+ const result = await userAgent.invoke("分析这篇文章并生成摘要和关键词");
64
64
  console.log(result);
65
65
  ```
66
66
 
@@ -75,7 +75,7 @@ console.log(result);
75
75
  ### 创建编排工作流
76
76
 
77
77
  ```typescript
78
- import { AIAgent, ExecutionEngine } from "@aigne/core";
78
+ import { AIAgent, AIGNE } from "@aigne/core";
79
79
  import { OpenAIChatModel } from "@aigne/core/models/openai-chat-model.js";
80
80
  import { OrchestratorAgent } from "@aigne/agent-library/orchestrator";
81
81
 
@@ -107,16 +107,16 @@ const editorAgent = AIAgent.from({
107
107
  const orchestrator = new OrchestratorAgent({
108
108
  name: "工作流编排器",
109
109
  instructions: "你负责协调研究、写作和编辑流程。",
110
- tools: [researchAgent, writerAgent, editorAgent],
110
+ skills: [researchAgent, writerAgent, editorAgent],
111
111
  // 可选配置
112
112
  maxIterations: 30, // 最大迭代次数
113
113
  tasksConcurrency: 5, // 任务并发数
114
114
  });
115
115
 
116
116
  // 使用编排代理
117
- const engine = new ExecutionEngine({ model });
118
- const userAgent = await engine.call(orchestrator);
119
- const result = await userAgent.call("关于人工智能在医疗领域的应用");
117
+ const aigne = new AIGNE({ model });
118
+ const userAgent = await aigne.invoke(orchestrator);
119
+ const result = await userAgent.invoke("关于人工智能在医疗领域的应用");
120
120
  console.log(result);
121
121
  ```
122
122
 
@@ -38,7 +38,7 @@ class OrchestratorAgent extends core_1.Agent {
38
38
  this.planner = new core_1.AIAgent({
39
39
  name: "llm_orchestration_planner",
40
40
  instructions: orchestrator_prompts_js_1.FULL_PLAN_PROMPT_TEMPLATE,
41
- outputSchema: () => (0, orchestrator_prompts_js_1.getFullPlanSchema)(this.tools),
41
+ outputSchema: () => (0, orchestrator_prompts_js_1.getFullPlanSchema)(this.skills),
42
42
  });
43
43
  this.completer = new core_1.AIAgent({
44
44
  name: "llm_orchestration_completer",
@@ -84,18 +84,18 @@ class OrchestratorAgent extends core_1.Agent {
84
84
  status: planResult.status ? "Complete" : "In Progress",
85
85
  result: planResult.result || "No results yet",
86
86
  },
87
- agents: this.tools.map((i) => ({
87
+ agents: this.skills.map((i) => ({
88
88
  name: i.name,
89
89
  description: i.description,
90
- tools: i.tools.map((i) => ({ name: i.name, description: i.description })),
90
+ tools: i.skills.map((i) => ({ name: i.name, description: i.description })),
91
91
  })),
92
92
  };
93
93
  }
94
94
  async getFullPlan(planResult, context) {
95
- return context.call(this.planner, this.getFullPlanInput(planResult));
95
+ return context.invoke(this.planner, this.getFullPlanInput(planResult));
96
96
  }
97
97
  async synthesizePlanResult(planResult, context) {
98
- return context.call(this.completer, {
98
+ return context.invoke(this.completer, {
99
99
  ...this.getFullPlanInput(planResult),
100
100
  ...(0, core_1.createMessage)(orchestrator_prompts_js_1.SYNTHESIZE_PLAN_USER_PROMPT_TEMPLATE),
101
101
  });
@@ -106,7 +106,7 @@ class OrchestratorAgent extends core_1.Agent {
106
106
  if (!model)
107
107
  throw new Error("model is required to run OrchestratorAgent");
108
108
  const queue = fastq_1.default.promise(async (task) => {
109
- const agent = this.tools.find((agent) => agent.name === task.agent);
109
+ const agent = this.skills.find((skill) => skill.name === task.agent);
110
110
  if (!agent)
111
111
  throw new Error(`Agent ${task.agent} not found`);
112
112
  const prompt = core_1.PromptTemplate.from(orchestrator_prompts_js_1.TASK_PROMPT_TEMPLATE).format({
@@ -116,16 +116,16 @@ class OrchestratorAgent extends core_1.Agent {
116
116
  steps: planResult.steps,
117
117
  });
118
118
  let result;
119
- if (agent.isCallable) {
120
- result = getMessageOrJsonString(await context.call(agent, prompt));
119
+ if (agent.isInvokable) {
120
+ result = getMessageOrJsonString(await context.invoke(agent, prompt));
121
121
  }
122
122
  else {
123
123
  const executor = core_1.AIAgent.from({
124
124
  name: "llm_orchestration_task_executor",
125
125
  instructions: prompt,
126
- tools: agent.tools,
126
+ skills: agent.skills,
127
127
  });
128
- result = getMessageOrJsonString(await context.call(executor, {}));
128
+ result = getMessageOrJsonString(await context.invoke(executor, {}));
129
129
  }
130
130
  return { task, result };
131
131
  }, concurrency);
@@ -137,7 +137,7 @@ class OrchestratorAgent extends core_1.Agent {
137
137
  queue.kill();
138
138
  throw error;
139
139
  }
140
- const result = getMessageOrJsonString(await context.call(core_1.AIAgent.from({
140
+ const result = getMessageOrJsonString(await context.invoke(core_1.AIAgent.from({
141
141
  name: "llm_orchestration_step_synthesizer",
142
142
  instructions: orchestrator_prompts_js_1.SYNTHESIZE_STEP_PROMPT_TEMPLATE,
143
143
  }), { objective: planResult.objective, step, tasks: results }));
@@ -18,7 +18,7 @@ export class OrchestratorAgent extends Agent {
18
18
  this.planner = new AIAgent({
19
19
  name: "llm_orchestration_planner",
20
20
  instructions: FULL_PLAN_PROMPT_TEMPLATE,
21
- outputSchema: () => getFullPlanSchema(this.tools),
21
+ outputSchema: () => getFullPlanSchema(this.skills),
22
22
  });
23
23
  this.completer = new AIAgent({
24
24
  name: "llm_orchestration_completer",
@@ -64,18 +64,18 @@ export class OrchestratorAgent extends Agent {
64
64
  status: planResult.status ? "Complete" : "In Progress",
65
65
  result: planResult.result || "No results yet",
66
66
  },
67
- agents: this.tools.map((i) => ({
67
+ agents: this.skills.map((i) => ({
68
68
  name: i.name,
69
69
  description: i.description,
70
- tools: i.tools.map((i) => ({ name: i.name, description: i.description })),
70
+ tools: i.skills.map((i) => ({ name: i.name, description: i.description })),
71
71
  })),
72
72
  };
73
73
  }
74
74
  async getFullPlan(planResult, context) {
75
- return context.call(this.planner, this.getFullPlanInput(planResult));
75
+ return context.invoke(this.planner, this.getFullPlanInput(planResult));
76
76
  }
77
77
  async synthesizePlanResult(planResult, context) {
78
- return context.call(this.completer, {
78
+ return context.invoke(this.completer, {
79
79
  ...this.getFullPlanInput(planResult),
80
80
  ...createMessage(SYNTHESIZE_PLAN_USER_PROMPT_TEMPLATE),
81
81
  });
@@ -86,7 +86,7 @@ export class OrchestratorAgent extends Agent {
86
86
  if (!model)
87
87
  throw new Error("model is required to run OrchestratorAgent");
88
88
  const queue = fastq.promise(async (task) => {
89
- const agent = this.tools.find((agent) => agent.name === task.agent);
89
+ const agent = this.skills.find((skill) => skill.name === task.agent);
90
90
  if (!agent)
91
91
  throw new Error(`Agent ${task.agent} not found`);
92
92
  const prompt = PromptTemplate.from(TASK_PROMPT_TEMPLATE).format({
@@ -96,16 +96,16 @@ export class OrchestratorAgent extends Agent {
96
96
  steps: planResult.steps,
97
97
  });
98
98
  let result;
99
- if (agent.isCallable) {
100
- result = getMessageOrJsonString(await context.call(agent, prompt));
99
+ if (agent.isInvokable) {
100
+ result = getMessageOrJsonString(await context.invoke(agent, prompt));
101
101
  }
102
102
  else {
103
103
  const executor = AIAgent.from({
104
104
  name: "llm_orchestration_task_executor",
105
105
  instructions: prompt,
106
- tools: agent.tools,
106
+ skills: agent.skills,
107
107
  });
108
- result = getMessageOrJsonString(await context.call(executor, {}));
108
+ result = getMessageOrJsonString(await context.invoke(executor, {}));
109
109
  }
110
110
  return { task, result };
111
111
  }, concurrency);
@@ -117,7 +117,7 @@ export class OrchestratorAgent extends Agent {
117
117
  queue.kill();
118
118
  throw error;
119
119
  }
120
- const result = getMessageOrJsonString(await context.call(AIAgent.from({
120
+ const result = getMessageOrJsonString(await context.invoke(AIAgent.from({
121
121
  name: "llm_orchestration_step_synthesizer",
122
122
  instructions: SYNTHESIZE_STEP_PROMPT_TEMPLATE,
123
123
  }), { objective: planResult.objective, step, tasks: results }));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aigne/agent-library",
3
- "version": "1.6.1",
3
+ "version": "1.7.1",
4
4
  "description": "Collection of agent libraries for AIGNE framework",
5
5
  "publishConfig": {
6
6
  "access": "public"
@@ -41,7 +41,7 @@
41
41
  "dependencies": {
42
42
  "fastq": "^1.19.1",
43
43
  "zod": "^3.24.2",
44
- "@aigne/core": "^1.11.0"
44
+ "@aigne/core": "^1.13.0"
45
45
  },
46
46
  "devDependencies": {
47
47
  "@types/bun": "^1.2.9",