@aigne/agent-library 1.13.0 → 1.13.2

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
@@ -5,6 +5,31 @@
5
5
 
6
6
  * add schema transform ([#35](https://github.com/AIGNE-io/aigne-framework/issues/35)) ([c7d9a2c](https://github.com/AIGNE-io/aigne-framework/commit/c7d9a2c9fcab8d384d4198db5ff6ba4603846cdf))
7
7
 
8
+ ## [1.13.2](https://github.com/AIGNE-io/aigne-framework/compare/agent-library-v1.13.1...agent-library-v1.13.2) (2025-06-19)
9
+
10
+
11
+ ### Bug Fixes
12
+
13
+ * use `inputKey` instead of implicit $message for AIAgent ([#165](https://github.com/AIGNE-io/aigne-framework/issues/165)) ([8b6e589](https://github.com/AIGNE-io/aigne-framework/commit/8b6e5896bba8209fd2eecb0f5b9263618bffdaf8))
14
+
15
+
16
+ ### Dependencies
17
+
18
+ * The following workspace dependencies were updated
19
+ * dependencies
20
+ * @aigne/core bumped to 1.20.1
21
+ * @aigne/openai bumped to 0.3.2
22
+
23
+ ## [1.13.1](https://github.com/AIGNE-io/aigne-framework/compare/agent-library-v1.13.0...agent-library-v1.13.1) (2025-06-17)
24
+
25
+
26
+ ### Dependencies
27
+
28
+ * The following workspace dependencies were updated
29
+ * dependencies
30
+ * @aigne/core bumped to 1.20.0
31
+ * @aigne/openai bumped to 0.3.1
32
+
8
33
  ## [1.13.0](https://github.com/AIGNE-io/aigne-framework/compare/agent-library-v1.12.6...agent-library-v1.13.0) (2025-06-16)
9
34
 
10
35
 
@@ -1,11 +1,6 @@
1
1
  import { AIAgent } from "@aigne/core";
2
- declare const mapper: AIAgent<{
3
- sourceData: string;
4
- responseSchema: string;
5
- sourceSchema?: string | undefined;
6
- instruction?: string | undefined;
7
- responseData?: string | undefined;
8
- feedback?: string | undefined;
2
+ declare const mapper: AIAgent<string, import("@aigne/core").Message & {
3
+ [x: string]: string;
9
4
  }, {
10
5
  jsonata: string;
11
6
  confidence: number;
@@ -36,7 +36,7 @@ export declare class FSMemory extends MemoryAgent {
36
36
  */
37
37
  constructor(options: FSMemoryOptions);
38
38
  }
39
- interface FSMemoryRetrieverOptions extends AIAgentOptions<FSMemoryRetrieverAgentInput, FSMemoryRetrieverAgentOutput> {
39
+ interface FSMemoryRetrieverOptions extends AIAgentOptions<any, FSMemoryRetrieverAgentInput, FSMemoryRetrieverAgentOutput> {
40
40
  memoryFileName: string;
41
41
  }
42
42
  interface FSMemoryRetrieverAgentInput extends MemoryRetrieverInput {
@@ -47,7 +47,7 @@ interface FSMemoryRetrieverAgentOutput extends Message {
47
47
  content: string;
48
48
  }[];
49
49
  }
50
- interface FSMemoryRecorderOptions extends AIAgentOptions<FSMemoryRecorderAgentInput, FSMemoryRecorderAgentOutput> {
50
+ interface FSMemoryRecorderOptions extends AIAgentOptions<any, FSMemoryRecorderAgentInput, FSMemoryRecorderAgentOutput> {
51
51
  memoryFileName: string;
52
52
  }
53
53
  type FSMemoryRecorderAgentInput = MemoryRecorderInput;
@@ -44,6 +44,7 @@ export interface OrchestratorAgentOptions<I extends Message = Message, O extends
44
44
  * Default: 5
45
45
  */
46
46
  tasksConcurrency?: number;
47
+ inputKey: string;
47
48
  }
48
49
  /**
49
50
  * Orchestrator Agent Class
@@ -74,6 +75,7 @@ export declare class OrchestratorAgent<I extends Message = Message, O extends Me
74
75
  constructor(options: OrchestratorAgentOptions<I, O>);
75
76
  private planner;
76
77
  private completer;
78
+ inputKey: string;
77
79
  /**
78
80
  * Maximum number of iterations
79
81
  * Prevents infinite execution loops
@@ -68,6 +68,7 @@ class OrchestratorAgent extends core_1.Agent {
68
68
  super({ ...options });
69
69
  this.maxIterations = options.maxIterations;
70
70
  this.tasksConcurrency = options.tasksConcurrency;
71
+ this.inputKey = options.inputKey;
71
72
  this.planner = new core_1.AIAgent({
72
73
  name: "llm_orchestration_planner",
73
74
  instructions: orchestrator_prompts_js_1.FULL_PLAN_PROMPT_TEMPLATE,
@@ -81,6 +82,7 @@ class OrchestratorAgent extends core_1.Agent {
81
82
  }
82
83
  planner;
83
84
  completer;
85
+ inputKey;
84
86
  /**
85
87
  * Maximum number of iterations
86
88
  * Prevents infinite execution loops
@@ -109,8 +111,8 @@ class OrchestratorAgent extends core_1.Agent {
109
111
  const { model } = options.context;
110
112
  if (!model)
111
113
  throw new Error("model is required to run OrchestratorAgent");
112
- const objective = (0, core_1.getMessage)(input);
113
- if (!objective)
114
+ const objective = input[this.inputKey];
115
+ if (typeof objective !== "string")
114
116
  throw new Error("Objective is required to run OrchestratorAgent");
115
117
  const result = {
116
118
  objective,
@@ -152,7 +154,7 @@ class OrchestratorAgent extends core_1.Agent {
152
154
  async synthesizePlanResult(planResult, context) {
153
155
  return context.invoke(this.completer, {
154
156
  ...this.getFullPlanInput(planResult),
155
- ...(0, core_1.createMessage)(orchestrator_prompts_js_1.SYNTHESIZE_PLAN_USER_PROMPT_TEMPLATE),
157
+ message: orchestrator_prompts_js_1.SYNTHESIZE_PLAN_USER_PROMPT_TEMPLATE,
156
158
  });
157
159
  }
158
160
  async executeStep(planResult, step, context) {
@@ -172,7 +174,7 @@ class OrchestratorAgent extends core_1.Agent {
172
174
  });
173
175
  let result;
174
176
  if (agent.isInvokable) {
175
- result = getMessageOrJsonString(await context.invoke(agent, prompt));
177
+ result = getMessageOrJsonString(await context.invoke(agent, { message: prompt }));
176
178
  }
177
179
  else {
178
180
  const executor = core_1.AIAgent.from({
@@ -1,11 +1,6 @@
1
1
  import { AIAgent } from "@aigne/core";
2
- declare const mapper: AIAgent<{
3
- sourceData: string;
4
- responseSchema: string;
5
- sourceSchema?: string | undefined;
6
- instruction?: string | undefined;
7
- responseData?: string | undefined;
8
- feedback?: string | undefined;
2
+ declare const mapper: AIAgent<string, import("@aigne/core").Message & {
3
+ [x: string]: string;
9
4
  }, {
10
5
  jsonata: string;
11
6
  confidence: number;
@@ -36,7 +36,7 @@ export declare class FSMemory extends MemoryAgent {
36
36
  */
37
37
  constructor(options: FSMemoryOptions);
38
38
  }
39
- interface FSMemoryRetrieverOptions extends AIAgentOptions<FSMemoryRetrieverAgentInput, FSMemoryRetrieverAgentOutput> {
39
+ interface FSMemoryRetrieverOptions extends AIAgentOptions<any, FSMemoryRetrieverAgentInput, FSMemoryRetrieverAgentOutput> {
40
40
  memoryFileName: string;
41
41
  }
42
42
  interface FSMemoryRetrieverAgentInput extends MemoryRetrieverInput {
@@ -47,7 +47,7 @@ interface FSMemoryRetrieverAgentOutput extends Message {
47
47
  content: string;
48
48
  }[];
49
49
  }
50
- interface FSMemoryRecorderOptions extends AIAgentOptions<FSMemoryRecorderAgentInput, FSMemoryRecorderAgentOutput> {
50
+ interface FSMemoryRecorderOptions extends AIAgentOptions<any, FSMemoryRecorderAgentInput, FSMemoryRecorderAgentOutput> {
51
51
  memoryFileName: string;
52
52
  }
53
53
  type FSMemoryRecorderAgentInput = MemoryRecorderInput;
@@ -44,6 +44,7 @@ export interface OrchestratorAgentOptions<I extends Message = Message, O extends
44
44
  * Default: 5
45
45
  */
46
46
  tasksConcurrency?: number;
47
+ inputKey: string;
47
48
  }
48
49
  /**
49
50
  * Orchestrator Agent Class
@@ -74,6 +75,7 @@ export declare class OrchestratorAgent<I extends Message = Message, O extends Me
74
75
  constructor(options: OrchestratorAgentOptions<I, O>);
75
76
  private planner;
76
77
  private completer;
78
+ inputKey: string;
77
79
  /**
78
80
  * Maximum number of iterations
79
81
  * Prevents infinite execution loops
@@ -1,11 +1,6 @@
1
1
  import { AIAgent } from "@aigne/core";
2
- declare const mapper: AIAgent<{
3
- sourceData: string;
4
- responseSchema: string;
5
- sourceSchema?: string | undefined;
6
- instruction?: string | undefined;
7
- responseData?: string | undefined;
8
- feedback?: string | undefined;
2
+ declare const mapper: AIAgent<string, import("@aigne/core").Message & {
3
+ [x: string]: string;
9
4
  }, {
10
5
  jsonata: string;
11
6
  confidence: number;
@@ -36,7 +36,7 @@ export declare class FSMemory extends MemoryAgent {
36
36
  */
37
37
  constructor(options: FSMemoryOptions);
38
38
  }
39
- interface FSMemoryRetrieverOptions extends AIAgentOptions<FSMemoryRetrieverAgentInput, FSMemoryRetrieverAgentOutput> {
39
+ interface FSMemoryRetrieverOptions extends AIAgentOptions<any, FSMemoryRetrieverAgentInput, FSMemoryRetrieverAgentOutput> {
40
40
  memoryFileName: string;
41
41
  }
42
42
  interface FSMemoryRetrieverAgentInput extends MemoryRetrieverInput {
@@ -47,7 +47,7 @@ interface FSMemoryRetrieverAgentOutput extends Message {
47
47
  content: string;
48
48
  }[];
49
49
  }
50
- interface FSMemoryRecorderOptions extends AIAgentOptions<FSMemoryRecorderAgentInput, FSMemoryRecorderAgentOutput> {
50
+ interface FSMemoryRecorderOptions extends AIAgentOptions<any, FSMemoryRecorderAgentInput, FSMemoryRecorderAgentOutput> {
51
51
  memoryFileName: string;
52
52
  }
53
53
  type FSMemoryRecorderAgentInput = MemoryRecorderInput;
@@ -44,6 +44,7 @@ export interface OrchestratorAgentOptions<I extends Message = Message, O extends
44
44
  * Default: 5
45
45
  */
46
46
  tasksConcurrency?: number;
47
+ inputKey: string;
47
48
  }
48
49
  /**
49
50
  * Orchestrator Agent Class
@@ -74,6 +75,7 @@ export declare class OrchestratorAgent<I extends Message = Message, O extends Me
74
75
  constructor(options: OrchestratorAgentOptions<I, O>);
75
76
  private planner;
76
77
  private completer;
78
+ inputKey: string;
77
79
  /**
78
80
  * Maximum number of iterations
79
81
  * Prevents infinite execution loops
@@ -1,4 +1,4 @@
1
- import { AIAgent, Agent, PromptTemplate, createMessage, getMessage, } from "@aigne/core";
1
+ import { AIAgent, Agent, PromptTemplate, } from "@aigne/core";
2
2
  import { checkArguments } from "@aigne/core/utils/type-utils.js";
3
3
  import fastq from "fastq";
4
4
  import { z } from "zod";
@@ -48,6 +48,7 @@ export class OrchestratorAgent extends Agent {
48
48
  super({ ...options });
49
49
  this.maxIterations = options.maxIterations;
50
50
  this.tasksConcurrency = options.tasksConcurrency;
51
+ this.inputKey = options.inputKey;
51
52
  this.planner = new AIAgent({
52
53
  name: "llm_orchestration_planner",
53
54
  instructions: FULL_PLAN_PROMPT_TEMPLATE,
@@ -61,6 +62,7 @@ export class OrchestratorAgent extends Agent {
61
62
  }
62
63
  planner;
63
64
  completer;
65
+ inputKey;
64
66
  /**
65
67
  * Maximum number of iterations
66
68
  * Prevents infinite execution loops
@@ -89,8 +91,8 @@ export class OrchestratorAgent extends Agent {
89
91
  const { model } = options.context;
90
92
  if (!model)
91
93
  throw new Error("model is required to run OrchestratorAgent");
92
- const objective = getMessage(input);
93
- if (!objective)
94
+ const objective = input[this.inputKey];
95
+ if (typeof objective !== "string")
94
96
  throw new Error("Objective is required to run OrchestratorAgent");
95
97
  const result = {
96
98
  objective,
@@ -132,7 +134,7 @@ export class OrchestratorAgent extends Agent {
132
134
  async synthesizePlanResult(planResult, context) {
133
135
  return context.invoke(this.completer, {
134
136
  ...this.getFullPlanInput(planResult),
135
- ...createMessage(SYNTHESIZE_PLAN_USER_PROMPT_TEMPLATE),
137
+ message: SYNTHESIZE_PLAN_USER_PROMPT_TEMPLATE,
136
138
  });
137
139
  }
138
140
  async executeStep(planResult, step, context) {
@@ -152,7 +154,7 @@ export class OrchestratorAgent extends Agent {
152
154
  });
153
155
  let result;
154
156
  if (agent.isInvokable) {
155
- result = getMessageOrJsonString(await context.invoke(agent, prompt));
157
+ result = getMessageOrJsonString(await context.invoke(agent, { message: prompt }));
156
158
  }
157
159
  else {
158
160
  const executor = AIAgent.from({
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aigne/agent-library",
3
- "version": "1.13.0",
3
+ "version": "1.13.2",
4
4
  "description": "Collection of agent libraries for AIGNE framework",
5
5
  "publishConfig": {
6
6
  "access": "public"
@@ -47,9 +47,9 @@
47
47
  "uuid": "^11.1.0",
48
48
  "yaml": "^2.7.1",
49
49
  "zod": "^3.24.4",
50
- "@aigne/openai": "^0.3.0",
50
+ "@aigne/core": "^1.20.1",
51
51
  "@aigne/sqlite": "^0.1.1",
52
- "@aigne/core": "^1.19.0"
52
+ "@aigne/openai": "^0.3.2"
53
53
  },
54
54
  "devDependencies": {
55
55
  "@types/bun": "^1.2.12",