@aigne/agent-library 1.19.0 → 1.20.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
@@ -13,6 +13,36 @@
13
13
  * @aigne/core bumped to 1.22.0
14
14
  * @aigne/openai bumped to 0.3.4
15
15
 
16
+ ## [1.20.1](https://github.com/AIGNE-io/aigne-framework/compare/agent-library-v1.20.0...agent-library-v1.20.1) (2025-07-09)
17
+
18
+
19
+ ### Dependencies
20
+
21
+ * The following workspace dependencies were updated
22
+ * dependencies
23
+ * @aigne/core bumped to 1.32.1
24
+ * @aigne/openai bumped to 0.8.1
25
+
26
+ ## [1.20.0](https://github.com/AIGNE-io/aigne-framework/compare/agent-library-v1.19.0...agent-library-v1.20.0) (2025-07-08)
27
+
28
+
29
+ ### Features
30
+
31
+ * **core:** add jinja syntax support for prompt builder ([#230](https://github.com/AIGNE-io/aigne-framework/issues/230)) ([74436a7](https://github.com/AIGNE-io/aigne-framework/commit/74436a7faac0c59a32b0153481386162649f4357))
32
+
33
+
34
+ ### Bug Fixes
35
+
36
+ * wrong type AgenticMemoryRetrieverOptions ([0893e02](https://github.com/AIGNE-io/aigne-framework/commit/0893e0271ea6870a420f8c6fd59022ab6566b9c2))
37
+
38
+
39
+ ### Dependencies
40
+
41
+ * The following workspace dependencies were updated
42
+ * dependencies
43
+ * @aigne/core bumped to 1.32.0
44
+ * @aigne/openai bumped to 0.8.0
45
+
16
46
  ## [1.19.0](https://github.com/AIGNE-io/aigne-framework/compare/agent-library-v1.18.0...agent-library-v1.19.0) (2025-07-04)
17
47
 
18
48
 
@@ -1,6 +1,6 @@
1
- import { type AgentOptions, AIAgent, MemoryAgent, type MemoryAgentOptions, type MemoryRecorderInput, type MemoryRecorderOutput, type Message, type PromptBuilder } from "@aigne/core";
1
+ import { type AgentInvokeOptions, type AgentOptions, AIAgent, MemoryAgent, type MemoryAgentOptions, MemoryRecorder, type MemoryRecorderInput, type MemoryRecorderOutput, type Message, type PromptBuilder } from "@aigne/core";
2
2
  import { type DefaultMemoryStorageOptions } from "../default-memory/default-memory-storage/index.js";
3
- import { type DefaultMemoryRecorderOptions } from "../default-memory/index.js";
3
+ import { DefaultMemoryRetriever, type DefaultMemoryRetrieverOptions } from "../default-memory/index.js";
4
4
  import { MemoryStorage } from "../default-memory/storage.js";
5
5
  export interface AgenticMemoryOptions extends Partial<MemoryAgentOptions>, Omit<AgenticMemoryRecorderOptions, "storage" | keyof AgentOptions>, Omit<AgenticMemoryRetrieverOptions, "storage" | keyof AgentOptions> {
6
6
  storage?: MemoryStorage | DefaultMemoryStorageOptions;
@@ -9,7 +9,9 @@ export declare class AgenticMemory extends MemoryAgent {
9
9
  constructor(options?: AgenticMemoryOptions);
10
10
  storage: MemoryStorage;
11
11
  }
12
- export interface AgenticMemoryRetrieverOptions extends DefaultMemoryRecorderOptions {
12
+ export interface AgenticMemoryRetrieverOptions extends DefaultMemoryRetrieverOptions {
13
+ }
14
+ export declare class AgenticMemoryRetriever extends DefaultMemoryRetriever {
13
15
  }
14
16
  export interface AgenticMemoryRecorderOptions extends AgentOptions<MemoryRecorderInput, MemoryRecorderOutput> {
15
17
  storage: MemoryStorage;
@@ -26,3 +28,11 @@ export interface AgenticMemoryExtractorOutput extends Message {
26
28
  content: string;
27
29
  }[];
28
30
  }
31
+ export declare class AgenticMemoryRecorder extends MemoryRecorder {
32
+ constructor(options: AgenticMemoryRecorderOptions);
33
+ private storage;
34
+ private inputKey?;
35
+ private outputKey?;
36
+ private agent;
37
+ process(input: MemoryRecorderInput, options: AgentInvokeOptions): Promise<MemoryRecorderOutput>;
38
+ }
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.AgenticMemory = void 0;
3
+ exports.AgenticMemoryRecorder = exports.AgenticMemoryRetriever = exports.AgenticMemory = void 0;
4
4
  const core_1 = require("@aigne/core");
5
5
  const type_utils_js_1 = require("@aigne/core/utils/type-utils.js");
6
6
  const zod_1 = require("zod");
@@ -26,6 +26,7 @@ class AgenticMemory extends core_1.MemoryAgent {
26
26
  exports.AgenticMemory = AgenticMemory;
27
27
  class AgenticMemoryRetriever extends index_js_2.DefaultMemoryRetriever {
28
28
  }
29
+ exports.AgenticMemoryRetriever = AgenticMemoryRetriever;
29
30
  class AgenticMemoryRecorder extends core_1.MemoryRecorder {
30
31
  constructor(options) {
31
32
  super(options);
@@ -69,3 +70,4 @@ class AgenticMemoryRecorder extends core_1.MemoryRecorder {
69
70
  };
70
71
  }
71
72
  }
73
+ exports.AgenticMemoryRecorder = AgenticMemoryRecorder;
@@ -167,7 +167,7 @@ class OrchestratorAgent extends core_1.Agent {
167
167
  const agent = this.skills.find((skill) => skill.name === task.agent);
168
168
  if (!agent)
169
169
  throw new Error(`Agent ${task.agent} not found`);
170
- const prompt = core_1.PromptTemplate.from(orchestrator_prompts_js_1.TASK_PROMPT_TEMPLATE).format({
170
+ const prompt = await core_1.PromptTemplate.from(orchestrator_prompts_js_1.TASK_PROMPT_TEMPLATE).format({
171
171
  objective: planResult.objective,
172
172
  step,
173
173
  task,
@@ -102,7 +102,7 @@ export interface FullPlanInput extends Message {
102
102
  /**
103
103
  * @hidden
104
104
  */
105
- export declare const FULL_PLAN_PROMPT_TEMPLATE = "You are tasked with orchestrating a plan to complete an objective.\nYou can analyze results from the previous steps already executed to decide if the objective is complete.\nYour plan must be structured in sequential steps, with each step containing independent parallel subtasks.\n\n<objective>\n{{objective}}\n</objective>\n\n<steps_completed>\n{{#steps}}\n- Step: {{step.description}}\n Result: {{result}}\n{{/steps}}\n</steps_completed>\n\n<previous_plan_status>\n{{plan.status}}\n</previous_plan_status>\n\n<previous_plan_result>\n{{plan.result}}\n</previous_plan_result>\n\nYou have access to the following Agents(which are collections of tools/functions):\n\n<agents>\n{{#agents}}\n- Agent: {{name}}\n Description: {{description}}\n Functions:\n {{#tools}}\n - Tool: {{name}}\n Description: {{description}}\n {{/tools}}\n{{/agents}}\n</agents>\n\n- If the previous plan results achieve the objective, return isComplete=true.\n- Otherwise, generate remaining steps needed.\n- Generate a plan with all remaining steps needed.\n- Steps are sequential, but each Step can have parallel subtasks.\n- For each Step, specify a description of the step and independent subtasks that can run in parallel.\n- For each subtask specify:\n 1. Clear description of the task that an LLM can execute\n 2. Name of 1 Agent to use for the task";
105
+ export declare const FULL_PLAN_PROMPT_TEMPLATE = "You are tasked with orchestrating a plan to complete an objective.\nYou can analyze results from the previous steps already executed to decide if the objective is complete.\nYour plan must be structured in sequential steps, with each step containing independent parallel subtasks.\n\n<objective>\n{{objective}}\n</objective>\n\n<steps_completed>\n{% for step in steps %}\n- Step: {{step.description}}\n Result: {{result}}\n{% endfor %}\n</steps_completed>\n\n<previous_plan_status>\n{{plan.status}}\n</previous_plan_status>\n\n<previous_plan_result>\n{{plan.result}}\n</previous_plan_result>\n\nYou have access to the following Agents(which are collections of tools/functions):\n\n<agents>\n{% for agent in agents %}\n- Agent: {{agent.name}}\n Description: {{agent.description}}\n Functions:\n {% for tool in tools %}\n - Tool: {{tool.name}}\n Description: {{tool.description}}\n {% endfor %}\n{% endfor %}\n</agents>\n\n- If the previous plan results achieve the objective, return isComplete=true.\n- Otherwise, generate remaining steps needed.\n- Generate a plan with all remaining steps needed.\n- Steps are sequential, but each Step can have parallel subtasks.\n- For each Step, specify a description of the step and independent subtasks that can run in parallel.\n- For each subtask specify:\n 1. Clear description of the task that an LLM can execute\n 2. Name of 1 Agent to use for the task";
106
106
  /**
107
107
  * @hidden
108
108
  */
@@ -115,7 +115,7 @@ export interface TaskPromptInput extends Message {
115
115
  /**
116
116
  * @hidden
117
117
  */
118
- export declare const TASK_PROMPT_TEMPLATE = "You are part of a larger workflow to achieve the step then the objective:\n\n<objective>\n{{objective}}\n</objective>\n\n<step>\n{{step.description}}\n</step>\n\nYour job is to accomplish only the following task:\n\n<task>\n{{task.description}}\n</task>\n\nResults so far that may provide helpful context:\n\n<steps_completed>\n{{#steps}}\n- Step: {{step.description}}\n Result: {{result}}\n{{/steps}}\n</steps_completed>\n";
118
+ export declare const TASK_PROMPT_TEMPLATE = "You are part of a larger workflow to achieve the step then the objective:\n\n<objective>\n{{objective}}\n</objective>\n\n<step>\n{{step.description}}\n</step>\n\nYour job is to accomplish only the following task:\n\n<task>\n{{task.description}}\n</task>\n\nResults so far that may provide helpful context:\n\n<steps_completed>\n{% for step in steps %}\n- Step: {{step.description}}\n Result: {{step.result}}\n{% endfor %}\n</steps_completed>\n";
119
119
  /**
120
120
  * @hidden
121
121
  */
@@ -127,4 +127,4 @@ export interface SynthesizeStepPromptInput extends Message {
127
127
  /**
128
128
  * @hidden
129
129
  */
130
- export declare const SYNTHESIZE_STEP_PROMPT_TEMPLATE = "Synthesize the results of these parallel tasks into a cohesive result\n\n<objective>\n{{objective}}\n</objective>\n\n<step>\n{{step.description}}\n</step>\n\n<tasks>\n{{#tasks}}\n- Task: {{task.description}}\n Result: {{result}}\n{{/tasks}}\n</tasks>\n";
130
+ export declare const SYNTHESIZE_STEP_PROMPT_TEMPLATE = "Synthesize the results of these parallel tasks into a cohesive result\n\n<objective>\n{{objective}}\n</objective>\n\n<step>\n{{step.description}}\n</step>\n\n<tasks>\n{% for task in tasks %}\n- Task: {{task.description}}\n Result: {{task.result}}\n{% endfor %}\n</tasks>\n";
@@ -47,10 +47,10 @@ Your plan must be structured in sequential steps, with each step containing inde
47
47
  </objective>
48
48
 
49
49
  <steps_completed>
50
- {{#steps}}
50
+ {% for step in steps %}
51
51
  - Step: {{step.description}}
52
52
  Result: {{result}}
53
- {{/steps}}
53
+ {% endfor %}
54
54
  </steps_completed>
55
55
 
56
56
  <previous_plan_status>
@@ -64,15 +64,15 @@ Your plan must be structured in sequential steps, with each step containing inde
64
64
  You have access to the following Agents(which are collections of tools/functions):
65
65
 
66
66
  <agents>
67
- {{#agents}}
68
- - Agent: {{name}}
69
- Description: {{description}}
67
+ {% for agent in agents %}
68
+ - Agent: {{agent.name}}
69
+ Description: {{agent.description}}
70
70
  Functions:
71
- {{#tools}}
72
- - Tool: {{name}}
73
- Description: {{description}}
74
- {{/tools}}
75
- {{/agents}}
71
+ {% for tool in tools %}
72
+ - Tool: {{tool.name}}
73
+ Description: {{tool.description}}
74
+ {% endfor %}
75
+ {% endfor %}
76
76
  </agents>
77
77
 
78
78
  - If the previous plan results achieve the objective, return isComplete=true.
@@ -106,10 +106,10 @@ Your job is to accomplish only the following task:
106
106
  Results so far that may provide helpful context:
107
107
 
108
108
  <steps_completed>
109
- {{#steps}}
109
+ {% for step in steps %}
110
110
  - Step: {{step.description}}
111
- Result: {{result}}
112
- {{/steps}}
111
+ Result: {{step.result}}
112
+ {% endfor %}
113
113
  </steps_completed>
114
114
  `;
115
115
  /**
@@ -127,9 +127,9 @@ Synthesize the results of these parallel tasks into a cohesive result
127
127
  </step>
128
128
 
129
129
  <tasks>
130
- {{#tasks}}
130
+ {% for task in tasks %}
131
131
  - Task: {{task.description}}
132
- Result: {{result}}
133
- {{/tasks}}
132
+ Result: {{task.result}}
133
+ {% endfor %}
134
134
  </tasks>
135
135
  `;
@@ -1,6 +1,6 @@
1
- import { type AgentOptions, AIAgent, MemoryAgent, type MemoryAgentOptions, type MemoryRecorderInput, type MemoryRecorderOutput, type Message, type PromptBuilder } from "@aigne/core";
1
+ import { type AgentInvokeOptions, type AgentOptions, AIAgent, MemoryAgent, type MemoryAgentOptions, MemoryRecorder, type MemoryRecorderInput, type MemoryRecorderOutput, type Message, type PromptBuilder } from "@aigne/core";
2
2
  import { type DefaultMemoryStorageOptions } from "../default-memory/default-memory-storage/index.js";
3
- import { type DefaultMemoryRecorderOptions } from "../default-memory/index.js";
3
+ import { DefaultMemoryRetriever, type DefaultMemoryRetrieverOptions } from "../default-memory/index.js";
4
4
  import { MemoryStorage } from "../default-memory/storage.js";
5
5
  export interface AgenticMemoryOptions extends Partial<MemoryAgentOptions>, Omit<AgenticMemoryRecorderOptions, "storage" | keyof AgentOptions>, Omit<AgenticMemoryRetrieverOptions, "storage" | keyof AgentOptions> {
6
6
  storage?: MemoryStorage | DefaultMemoryStorageOptions;
@@ -9,7 +9,9 @@ export declare class AgenticMemory extends MemoryAgent {
9
9
  constructor(options?: AgenticMemoryOptions);
10
10
  storage: MemoryStorage;
11
11
  }
12
- export interface AgenticMemoryRetrieverOptions extends DefaultMemoryRecorderOptions {
12
+ export interface AgenticMemoryRetrieverOptions extends DefaultMemoryRetrieverOptions {
13
+ }
14
+ export declare class AgenticMemoryRetriever extends DefaultMemoryRetriever {
13
15
  }
14
16
  export interface AgenticMemoryRecorderOptions extends AgentOptions<MemoryRecorderInput, MemoryRecorderOutput> {
15
17
  storage: MemoryStorage;
@@ -26,3 +28,11 @@ export interface AgenticMemoryExtractorOutput extends Message {
26
28
  content: string;
27
29
  }[];
28
30
  }
31
+ export declare class AgenticMemoryRecorder extends MemoryRecorder {
32
+ constructor(options: AgenticMemoryRecorderOptions);
33
+ private storage;
34
+ private inputKey?;
35
+ private outputKey?;
36
+ private agent;
37
+ process(input: MemoryRecorderInput, options: AgentInvokeOptions): Promise<MemoryRecorderOutput>;
38
+ }
@@ -102,7 +102,7 @@ export interface FullPlanInput extends Message {
102
102
  /**
103
103
  * @hidden
104
104
  */
105
- export declare const FULL_PLAN_PROMPT_TEMPLATE = "You are tasked with orchestrating a plan to complete an objective.\nYou can analyze results from the previous steps already executed to decide if the objective is complete.\nYour plan must be structured in sequential steps, with each step containing independent parallel subtasks.\n\n<objective>\n{{objective}}\n</objective>\n\n<steps_completed>\n{{#steps}}\n- Step: {{step.description}}\n Result: {{result}}\n{{/steps}}\n</steps_completed>\n\n<previous_plan_status>\n{{plan.status}}\n</previous_plan_status>\n\n<previous_plan_result>\n{{plan.result}}\n</previous_plan_result>\n\nYou have access to the following Agents(which are collections of tools/functions):\n\n<agents>\n{{#agents}}\n- Agent: {{name}}\n Description: {{description}}\n Functions:\n {{#tools}}\n - Tool: {{name}}\n Description: {{description}}\n {{/tools}}\n{{/agents}}\n</agents>\n\n- If the previous plan results achieve the objective, return isComplete=true.\n- Otherwise, generate remaining steps needed.\n- Generate a plan with all remaining steps needed.\n- Steps are sequential, but each Step can have parallel subtasks.\n- For each Step, specify a description of the step and independent subtasks that can run in parallel.\n- For each subtask specify:\n 1. Clear description of the task that an LLM can execute\n 2. Name of 1 Agent to use for the task";
105
+ export declare const FULL_PLAN_PROMPT_TEMPLATE = "You are tasked with orchestrating a plan to complete an objective.\nYou can analyze results from the previous steps already executed to decide if the objective is complete.\nYour plan must be structured in sequential steps, with each step containing independent parallel subtasks.\n\n<objective>\n{{objective}}\n</objective>\n\n<steps_completed>\n{% for step in steps %}\n- Step: {{step.description}}\n Result: {{result}}\n{% endfor %}\n</steps_completed>\n\n<previous_plan_status>\n{{plan.status}}\n</previous_plan_status>\n\n<previous_plan_result>\n{{plan.result}}\n</previous_plan_result>\n\nYou have access to the following Agents(which are collections of tools/functions):\n\n<agents>\n{% for agent in agents %}\n- Agent: {{agent.name}}\n Description: {{agent.description}}\n Functions:\n {% for tool in tools %}\n - Tool: {{tool.name}}\n Description: {{tool.description}}\n {% endfor %}\n{% endfor %}\n</agents>\n\n- If the previous plan results achieve the objective, return isComplete=true.\n- Otherwise, generate remaining steps needed.\n- Generate a plan with all remaining steps needed.\n- Steps are sequential, but each Step can have parallel subtasks.\n- For each Step, specify a description of the step and independent subtasks that can run in parallel.\n- For each subtask specify:\n 1. Clear description of the task that an LLM can execute\n 2. Name of 1 Agent to use for the task";
106
106
  /**
107
107
  * @hidden
108
108
  */
@@ -115,7 +115,7 @@ export interface TaskPromptInput extends Message {
115
115
  /**
116
116
  * @hidden
117
117
  */
118
- export declare const TASK_PROMPT_TEMPLATE = "You are part of a larger workflow to achieve the step then the objective:\n\n<objective>\n{{objective}}\n</objective>\n\n<step>\n{{step.description}}\n</step>\n\nYour job is to accomplish only the following task:\n\n<task>\n{{task.description}}\n</task>\n\nResults so far that may provide helpful context:\n\n<steps_completed>\n{{#steps}}\n- Step: {{step.description}}\n Result: {{result}}\n{{/steps}}\n</steps_completed>\n";
118
+ export declare const TASK_PROMPT_TEMPLATE = "You are part of a larger workflow to achieve the step then the objective:\n\n<objective>\n{{objective}}\n</objective>\n\n<step>\n{{step.description}}\n</step>\n\nYour job is to accomplish only the following task:\n\n<task>\n{{task.description}}\n</task>\n\nResults so far that may provide helpful context:\n\n<steps_completed>\n{% for step in steps %}\n- Step: {{step.description}}\n Result: {{step.result}}\n{% endfor %}\n</steps_completed>\n";
119
119
  /**
120
120
  * @hidden
121
121
  */
@@ -127,4 +127,4 @@ export interface SynthesizeStepPromptInput extends Message {
127
127
  /**
128
128
  * @hidden
129
129
  */
130
- export declare const SYNTHESIZE_STEP_PROMPT_TEMPLATE = "Synthesize the results of these parallel tasks into a cohesive result\n\n<objective>\n{{objective}}\n</objective>\n\n<step>\n{{step.description}}\n</step>\n\n<tasks>\n{{#tasks}}\n- Task: {{task.description}}\n Result: {{result}}\n{{/tasks}}\n</tasks>\n";
130
+ export declare const SYNTHESIZE_STEP_PROMPT_TEMPLATE = "Synthesize the results of these parallel tasks into a cohesive result\n\n<objective>\n{{objective}}\n</objective>\n\n<step>\n{{step.description}}\n</step>\n\n<tasks>\n{% for task in tasks %}\n- Task: {{task.description}}\n Result: {{task.result}}\n{% endfor %}\n</tasks>\n";
@@ -1,6 +1,6 @@
1
- import { type AgentOptions, AIAgent, MemoryAgent, type MemoryAgentOptions, type MemoryRecorderInput, type MemoryRecorderOutput, type Message, type PromptBuilder } from "@aigne/core";
1
+ import { type AgentInvokeOptions, type AgentOptions, AIAgent, MemoryAgent, type MemoryAgentOptions, MemoryRecorder, type MemoryRecorderInput, type MemoryRecorderOutput, type Message, type PromptBuilder } from "@aigne/core";
2
2
  import { type DefaultMemoryStorageOptions } from "../default-memory/default-memory-storage/index.js";
3
- import { type DefaultMemoryRecorderOptions } from "../default-memory/index.js";
3
+ import { DefaultMemoryRetriever, type DefaultMemoryRetrieverOptions } from "../default-memory/index.js";
4
4
  import { MemoryStorage } from "../default-memory/storage.js";
5
5
  export interface AgenticMemoryOptions extends Partial<MemoryAgentOptions>, Omit<AgenticMemoryRecorderOptions, "storage" | keyof AgentOptions>, Omit<AgenticMemoryRetrieverOptions, "storage" | keyof AgentOptions> {
6
6
  storage?: MemoryStorage | DefaultMemoryStorageOptions;
@@ -9,7 +9,9 @@ export declare class AgenticMemory extends MemoryAgent {
9
9
  constructor(options?: AgenticMemoryOptions);
10
10
  storage: MemoryStorage;
11
11
  }
12
- export interface AgenticMemoryRetrieverOptions extends DefaultMemoryRecorderOptions {
12
+ export interface AgenticMemoryRetrieverOptions extends DefaultMemoryRetrieverOptions {
13
+ }
14
+ export declare class AgenticMemoryRetriever extends DefaultMemoryRetriever {
13
15
  }
14
16
  export interface AgenticMemoryRecorderOptions extends AgentOptions<MemoryRecorderInput, MemoryRecorderOutput> {
15
17
  storage: MemoryStorage;
@@ -26,3 +28,11 @@ export interface AgenticMemoryExtractorOutput extends Message {
26
28
  content: string;
27
29
  }[];
28
30
  }
31
+ export declare class AgenticMemoryRecorder extends MemoryRecorder {
32
+ constructor(options: AgenticMemoryRecorderOptions);
33
+ private storage;
34
+ private inputKey?;
35
+ private outputKey?;
36
+ private agent;
37
+ process(input: MemoryRecorderInput, options: AgentInvokeOptions): Promise<MemoryRecorderOutput>;
38
+ }
@@ -20,9 +20,9 @@ export class AgenticMemory extends MemoryAgent {
20
20
  }
21
21
  storage;
22
22
  }
23
- class AgenticMemoryRetriever extends DefaultMemoryRetriever {
23
+ export class AgenticMemoryRetriever extends DefaultMemoryRetriever {
24
24
  }
25
- class AgenticMemoryRecorder extends MemoryRecorder {
25
+ export class AgenticMemoryRecorder extends MemoryRecorder {
26
26
  constructor(options) {
27
27
  super(options);
28
28
  this.storage = options.storage;
@@ -147,7 +147,7 @@ export class OrchestratorAgent extends Agent {
147
147
  const agent = this.skills.find((skill) => skill.name === task.agent);
148
148
  if (!agent)
149
149
  throw new Error(`Agent ${task.agent} not found`);
150
- const prompt = PromptTemplate.from(TASK_PROMPT_TEMPLATE).format({
150
+ const prompt = await PromptTemplate.from(TASK_PROMPT_TEMPLATE).format({
151
151
  objective: planResult.objective,
152
152
  step,
153
153
  task,
@@ -102,7 +102,7 @@ export interface FullPlanInput extends Message {
102
102
  /**
103
103
  * @hidden
104
104
  */
105
- export declare const FULL_PLAN_PROMPT_TEMPLATE = "You are tasked with orchestrating a plan to complete an objective.\nYou can analyze results from the previous steps already executed to decide if the objective is complete.\nYour plan must be structured in sequential steps, with each step containing independent parallel subtasks.\n\n<objective>\n{{objective}}\n</objective>\n\n<steps_completed>\n{{#steps}}\n- Step: {{step.description}}\n Result: {{result}}\n{{/steps}}\n</steps_completed>\n\n<previous_plan_status>\n{{plan.status}}\n</previous_plan_status>\n\n<previous_plan_result>\n{{plan.result}}\n</previous_plan_result>\n\nYou have access to the following Agents(which are collections of tools/functions):\n\n<agents>\n{{#agents}}\n- Agent: {{name}}\n Description: {{description}}\n Functions:\n {{#tools}}\n - Tool: {{name}}\n Description: {{description}}\n {{/tools}}\n{{/agents}}\n</agents>\n\n- If the previous plan results achieve the objective, return isComplete=true.\n- Otherwise, generate remaining steps needed.\n- Generate a plan with all remaining steps needed.\n- Steps are sequential, but each Step can have parallel subtasks.\n- For each Step, specify a description of the step and independent subtasks that can run in parallel.\n- For each subtask specify:\n 1. Clear description of the task that an LLM can execute\n 2. Name of 1 Agent to use for the task";
105
+ export declare const FULL_PLAN_PROMPT_TEMPLATE = "You are tasked with orchestrating a plan to complete an objective.\nYou can analyze results from the previous steps already executed to decide if the objective is complete.\nYour plan must be structured in sequential steps, with each step containing independent parallel subtasks.\n\n<objective>\n{{objective}}\n</objective>\n\n<steps_completed>\n{% for step in steps %}\n- Step: {{step.description}}\n Result: {{result}}\n{% endfor %}\n</steps_completed>\n\n<previous_plan_status>\n{{plan.status}}\n</previous_plan_status>\n\n<previous_plan_result>\n{{plan.result}}\n</previous_plan_result>\n\nYou have access to the following Agents(which are collections of tools/functions):\n\n<agents>\n{% for agent in agents %}\n- Agent: {{agent.name}}\n Description: {{agent.description}}\n Functions:\n {% for tool in tools %}\n - Tool: {{tool.name}}\n Description: {{tool.description}}\n {% endfor %}\n{% endfor %}\n</agents>\n\n- If the previous plan results achieve the objective, return isComplete=true.\n- Otherwise, generate remaining steps needed.\n- Generate a plan with all remaining steps needed.\n- Steps are sequential, but each Step can have parallel subtasks.\n- For each Step, specify a description of the step and independent subtasks that can run in parallel.\n- For each subtask specify:\n 1. Clear description of the task that an LLM can execute\n 2. Name of 1 Agent to use for the task";
106
106
  /**
107
107
  * @hidden
108
108
  */
@@ -115,7 +115,7 @@ export interface TaskPromptInput extends Message {
115
115
  /**
116
116
  * @hidden
117
117
  */
118
- export declare const TASK_PROMPT_TEMPLATE = "You are part of a larger workflow to achieve the step then the objective:\n\n<objective>\n{{objective}}\n</objective>\n\n<step>\n{{step.description}}\n</step>\n\nYour job is to accomplish only the following task:\n\n<task>\n{{task.description}}\n</task>\n\nResults so far that may provide helpful context:\n\n<steps_completed>\n{{#steps}}\n- Step: {{step.description}}\n Result: {{result}}\n{{/steps}}\n</steps_completed>\n";
118
+ export declare const TASK_PROMPT_TEMPLATE = "You are part of a larger workflow to achieve the step then the objective:\n\n<objective>\n{{objective}}\n</objective>\n\n<step>\n{{step.description}}\n</step>\n\nYour job is to accomplish only the following task:\n\n<task>\n{{task.description}}\n</task>\n\nResults so far that may provide helpful context:\n\n<steps_completed>\n{% for step in steps %}\n- Step: {{step.description}}\n Result: {{step.result}}\n{% endfor %}\n</steps_completed>\n";
119
119
  /**
120
120
  * @hidden
121
121
  */
@@ -127,4 +127,4 @@ export interface SynthesizeStepPromptInput extends Message {
127
127
  /**
128
128
  * @hidden
129
129
  */
130
- export declare const SYNTHESIZE_STEP_PROMPT_TEMPLATE = "Synthesize the results of these parallel tasks into a cohesive result\n\n<objective>\n{{objective}}\n</objective>\n\n<step>\n{{step.description}}\n</step>\n\n<tasks>\n{{#tasks}}\n- Task: {{task.description}}\n Result: {{result}}\n{{/tasks}}\n</tasks>\n";
130
+ export declare const SYNTHESIZE_STEP_PROMPT_TEMPLATE = "Synthesize the results of these parallel tasks into a cohesive result\n\n<objective>\n{{objective}}\n</objective>\n\n<step>\n{{step.description}}\n</step>\n\n<tasks>\n{% for task in tasks %}\n- Task: {{task.description}}\n Result: {{task.result}}\n{% endfor %}\n</tasks>\n";
@@ -43,10 +43,10 @@ Your plan must be structured in sequential steps, with each step containing inde
43
43
  </objective>
44
44
 
45
45
  <steps_completed>
46
- {{#steps}}
46
+ {% for step in steps %}
47
47
  - Step: {{step.description}}
48
48
  Result: {{result}}
49
- {{/steps}}
49
+ {% endfor %}
50
50
  </steps_completed>
51
51
 
52
52
  <previous_plan_status>
@@ -60,15 +60,15 @@ Your plan must be structured in sequential steps, with each step containing inde
60
60
  You have access to the following Agents(which are collections of tools/functions):
61
61
 
62
62
  <agents>
63
- {{#agents}}
64
- - Agent: {{name}}
65
- Description: {{description}}
63
+ {% for agent in agents %}
64
+ - Agent: {{agent.name}}
65
+ Description: {{agent.description}}
66
66
  Functions:
67
- {{#tools}}
68
- - Tool: {{name}}
69
- Description: {{description}}
70
- {{/tools}}
71
- {{/agents}}
67
+ {% for tool in tools %}
68
+ - Tool: {{tool.name}}
69
+ Description: {{tool.description}}
70
+ {% endfor %}
71
+ {% endfor %}
72
72
  </agents>
73
73
 
74
74
  - If the previous plan results achieve the objective, return isComplete=true.
@@ -102,10 +102,10 @@ Your job is to accomplish only the following task:
102
102
  Results so far that may provide helpful context:
103
103
 
104
104
  <steps_completed>
105
- {{#steps}}
105
+ {% for step in steps %}
106
106
  - Step: {{step.description}}
107
- Result: {{result}}
108
- {{/steps}}
107
+ Result: {{step.result}}
108
+ {% endfor %}
109
109
  </steps_completed>
110
110
  `;
111
111
  /**
@@ -123,9 +123,9 @@ Synthesize the results of these parallel tasks into a cohesive result
123
123
  </step>
124
124
 
125
125
  <tasks>
126
- {{#tasks}}
126
+ {% for task in tasks %}
127
127
  - Task: {{task.description}}
128
- Result: {{result}}
129
- {{/tasks}}
128
+ Result: {{task.result}}
129
+ {% endfor %}
130
130
  </tasks>
131
131
  `;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aigne/agent-library",
3
- "version": "1.19.0",
3
+ "version": "1.20.1",
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.8.0",
49
49
  "zod": "^3.25.67",
50
- "@aigne/core": "^1.31.0",
51
- "@aigne/openai": "^0.7.1",
52
- "@aigne/sqlite": "^0.3.0"
50
+ "@aigne/core": "^1.32.1",
51
+ "@aigne/sqlite": "^0.3.0",
52
+ "@aigne/openai": "^0.8.1"
53
53
  },
54
54
  "devDependencies": {
55
55
  "@types/bun": "^1.2.17",