@aigne/core 1.42.0 → 1.43.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/CHANGELOG.md +12 -0
- package/lib/cjs/agents/team-agent.d.ts +19 -0
- package/lib/cjs/agents/team-agent.js +18 -1
- package/lib/cjs/aigne/context.d.ts +4 -1
- package/lib/cjs/aigne/context.js +6 -0
- package/lib/dts/agents/team-agent.d.ts +19 -0
- package/lib/dts/aigne/context.d.ts +4 -1
- package/lib/esm/agents/team-agent.d.ts +19 -0
- package/lib/esm/agents/team-agent.js +18 -1
- package/lib/esm/aigne/context.d.ts +4 -1
- package/lib/esm/aigne/context.js +6 -0
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -12,6 +12,18 @@
|
|
|
12
12
|
* dependencies
|
|
13
13
|
* @aigne/observability bumped to 0.1.0
|
|
14
14
|
|
|
15
|
+
## [1.43.0](https://github.com/AIGNE-io/aigne-framework/compare/core-v1.42.0...core-v1.43.0) (2025-08-04)
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
### Features
|
|
19
|
+
|
|
20
|
+
* add includeAllStepsOutput option to control TeamAgent sequential streaming behavior ([#305](https://github.com/AIGNE-io/aigne-framework/issues/305)) ([0817475](https://github.com/AIGNE-io/aigne-framework/commit/08174751316b940a70463e71971a19a18b92667b))
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
### Bug Fixes
|
|
24
|
+
|
|
25
|
+
* **core:** share skills/agents from context ([#309](https://github.com/AIGNE-io/aigne-framework/issues/309)) ([88dd849](https://github.com/AIGNE-io/aigne-framework/commit/88dd849954c6f3fb68df238be22be3371c734e6e))
|
|
26
|
+
|
|
15
27
|
## [1.42.0](https://github.com/AIGNE-io/aigne-framework/compare/core-v1.41.0...core-v1.42.0) (2025-08-01)
|
|
16
28
|
|
|
17
29
|
|
|
@@ -156,6 +156,13 @@ export interface TeamAgentOptions<I extends Message, O extends Message> extends
|
|
|
156
156
|
* @default false
|
|
157
157
|
*/
|
|
158
158
|
iterateWithPreviousOutput?: boolean;
|
|
159
|
+
/**
|
|
160
|
+
* Controls whether to include output from all intermediate steps in sequential processing.
|
|
161
|
+
*
|
|
162
|
+
* @see TeamAgent.includeAllStepsOutput for detailed documentation
|
|
163
|
+
* @default false
|
|
164
|
+
*/
|
|
165
|
+
includeAllStepsOutput?: boolean;
|
|
159
166
|
}
|
|
160
167
|
/**
|
|
161
168
|
* TeamAgent coordinates a group of agents working together to accomplish tasks.
|
|
@@ -230,6 +237,18 @@ export declare class TeamAgent<I extends Message, O extends Message> extends Age
|
|
|
230
237
|
* @default false
|
|
231
238
|
*/
|
|
232
239
|
iterateWithPreviousOutput?: boolean;
|
|
240
|
+
/**
|
|
241
|
+
* Controls whether to include output from all intermediate steps in sequential processing.
|
|
242
|
+
*
|
|
243
|
+
* When `true`, yields output chunks from every agent in the sequential chain.
|
|
244
|
+
* When `false`, only yields output from the final agent.
|
|
245
|
+
*
|
|
246
|
+
* Only affects sequential processing mode. Useful for debugging and monitoring
|
|
247
|
+
* multi-step agent workflows.
|
|
248
|
+
*
|
|
249
|
+
* @default false
|
|
250
|
+
*/
|
|
251
|
+
includeAllStepsOutput?: boolean;
|
|
233
252
|
/**
|
|
234
253
|
* Process an input message by routing it through the team's agents.
|
|
235
254
|
*
|
|
@@ -83,6 +83,7 @@ class TeamAgent extends agent_js_1.Agent {
|
|
|
83
83
|
};
|
|
84
84
|
this.iterateOn = options.iterateOn;
|
|
85
85
|
this.iterateWithPreviousOutput = options.iterateWithPreviousOutput;
|
|
86
|
+
this.includeAllStepsOutput = options.includeAllStepsOutput;
|
|
86
87
|
}
|
|
87
88
|
/**
|
|
88
89
|
* The processing mode that determines how agents in the team are executed.
|
|
@@ -117,6 +118,18 @@ class TeamAgent extends agent_js_1.Agent {
|
|
|
117
118
|
* @default false
|
|
118
119
|
*/
|
|
119
120
|
iterateWithPreviousOutput;
|
|
121
|
+
/**
|
|
122
|
+
* Controls whether to include output from all intermediate steps in sequential processing.
|
|
123
|
+
*
|
|
124
|
+
* When `true`, yields output chunks from every agent in the sequential chain.
|
|
125
|
+
* When `false`, only yields output from the final agent.
|
|
126
|
+
*
|
|
127
|
+
* Only affects sequential processing mode. Useful for debugging and monitoring
|
|
128
|
+
* multi-step agent workflows.
|
|
129
|
+
*
|
|
130
|
+
* @default false
|
|
131
|
+
*/
|
|
132
|
+
includeAllStepsOutput;
|
|
120
133
|
/**
|
|
121
134
|
* Process an input message by routing it through the team's agents.
|
|
122
135
|
*
|
|
@@ -212,8 +225,12 @@ class TeamAgent extends agent_js_1.Agent {
|
|
|
212
225
|
const output = {};
|
|
213
226
|
for (const agent of this.skills) {
|
|
214
227
|
const o = await options.context.invoke(agent, { ...input, ...output }, { ...options, streaming: true });
|
|
228
|
+
const isLast = agent === this.skills[this.skills.length - 1];
|
|
215
229
|
for await (const chunk of o) {
|
|
216
|
-
yield chunk
|
|
230
|
+
// Only yield the chunk if it is the last agent in the sequence
|
|
231
|
+
if (this.includeAllStepsOutput || isLast) {
|
|
232
|
+
yield chunk;
|
|
233
|
+
}
|
|
217
234
|
(0, stream_utils_js_1.mergeAgentResponseChunk)(output, chunk);
|
|
218
235
|
}
|
|
219
236
|
}
|
|
@@ -73,6 +73,7 @@ export interface Context<U extends UserContext = UserContext> extends TypedEvent
|
|
|
73
73
|
rootId: string;
|
|
74
74
|
model?: ChatModel;
|
|
75
75
|
skills?: Agent[];
|
|
76
|
+
agents: Agent[];
|
|
76
77
|
observer?: AIGNEObserver;
|
|
77
78
|
span?: Span;
|
|
78
79
|
usage: ContextUsage;
|
|
@@ -153,6 +154,7 @@ export declare class AIGNEContext implements Context {
|
|
|
153
154
|
get messageQueue(): MessageQueue;
|
|
154
155
|
get model(): ChatModel | undefined;
|
|
155
156
|
get skills(): Agent<any, any>[] | undefined;
|
|
157
|
+
get agents(): Agent<any, any>[];
|
|
156
158
|
get observer(): AIGNEObserver | undefined;
|
|
157
159
|
get limits(): ContextLimits | undefined;
|
|
158
160
|
get status(): "normal" | "timeout";
|
|
@@ -180,7 +182,7 @@ export declare class AIGNEContext implements Context {
|
|
|
180
182
|
declare class AIGNEContextShared {
|
|
181
183
|
private readonly parent?;
|
|
182
184
|
spans: Span[];
|
|
183
|
-
constructor(parent?: (Pick<Context, "model" | "skills" | "limits" | "observer"> & {
|
|
185
|
+
constructor(parent?: (Pick<Context, "model" | "agents" | "skills" | "limits" | "observer"> & {
|
|
184
186
|
messageQueue?: MessageQueue;
|
|
185
187
|
events?: Emitter<any>;
|
|
186
188
|
}) | undefined);
|
|
@@ -188,6 +190,7 @@ declare class AIGNEContextShared {
|
|
|
188
190
|
readonly events: Emitter<any>;
|
|
189
191
|
get model(): ChatModel | undefined;
|
|
190
192
|
get skills(): Agent<any, any>[] | undefined;
|
|
193
|
+
get agents(): Agent<any, any>[];
|
|
191
194
|
get observer(): AIGNEObserver | undefined;
|
|
192
195
|
get limits(): ContextLimits | undefined;
|
|
193
196
|
addSpan(span: Span): void;
|
package/lib/cjs/aigne/context.js
CHANGED
|
@@ -64,6 +64,9 @@ class AIGNEContext {
|
|
|
64
64
|
get skills() {
|
|
65
65
|
return this.internal.skills;
|
|
66
66
|
}
|
|
67
|
+
get agents() {
|
|
68
|
+
return this.internal.agents;
|
|
69
|
+
}
|
|
67
70
|
get observer() {
|
|
68
71
|
return this.internal.observer;
|
|
69
72
|
}
|
|
@@ -300,6 +303,9 @@ class AIGNEContextShared {
|
|
|
300
303
|
get skills() {
|
|
301
304
|
return this.parent?.skills;
|
|
302
305
|
}
|
|
306
|
+
get agents() {
|
|
307
|
+
return this.parent?.agents ?? [];
|
|
308
|
+
}
|
|
303
309
|
get observer() {
|
|
304
310
|
return this.parent?.observer;
|
|
305
311
|
}
|
|
@@ -156,6 +156,13 @@ export interface TeamAgentOptions<I extends Message, O extends Message> extends
|
|
|
156
156
|
* @default false
|
|
157
157
|
*/
|
|
158
158
|
iterateWithPreviousOutput?: boolean;
|
|
159
|
+
/**
|
|
160
|
+
* Controls whether to include output from all intermediate steps in sequential processing.
|
|
161
|
+
*
|
|
162
|
+
* @see TeamAgent.includeAllStepsOutput for detailed documentation
|
|
163
|
+
* @default false
|
|
164
|
+
*/
|
|
165
|
+
includeAllStepsOutput?: boolean;
|
|
159
166
|
}
|
|
160
167
|
/**
|
|
161
168
|
* TeamAgent coordinates a group of agents working together to accomplish tasks.
|
|
@@ -230,6 +237,18 @@ export declare class TeamAgent<I extends Message, O extends Message> extends Age
|
|
|
230
237
|
* @default false
|
|
231
238
|
*/
|
|
232
239
|
iterateWithPreviousOutput?: boolean;
|
|
240
|
+
/**
|
|
241
|
+
* Controls whether to include output from all intermediate steps in sequential processing.
|
|
242
|
+
*
|
|
243
|
+
* When `true`, yields output chunks from every agent in the sequential chain.
|
|
244
|
+
* When `false`, only yields output from the final agent.
|
|
245
|
+
*
|
|
246
|
+
* Only affects sequential processing mode. Useful for debugging and monitoring
|
|
247
|
+
* multi-step agent workflows.
|
|
248
|
+
*
|
|
249
|
+
* @default false
|
|
250
|
+
*/
|
|
251
|
+
includeAllStepsOutput?: boolean;
|
|
233
252
|
/**
|
|
234
253
|
* Process an input message by routing it through the team's agents.
|
|
235
254
|
*
|
|
@@ -73,6 +73,7 @@ export interface Context<U extends UserContext = UserContext> extends TypedEvent
|
|
|
73
73
|
rootId: string;
|
|
74
74
|
model?: ChatModel;
|
|
75
75
|
skills?: Agent[];
|
|
76
|
+
agents: Agent[];
|
|
76
77
|
observer?: AIGNEObserver;
|
|
77
78
|
span?: Span;
|
|
78
79
|
usage: ContextUsage;
|
|
@@ -153,6 +154,7 @@ export declare class AIGNEContext implements Context {
|
|
|
153
154
|
get messageQueue(): MessageQueue;
|
|
154
155
|
get model(): ChatModel | undefined;
|
|
155
156
|
get skills(): Agent<any, any>[] | undefined;
|
|
157
|
+
get agents(): Agent<any, any>[];
|
|
156
158
|
get observer(): AIGNEObserver | undefined;
|
|
157
159
|
get limits(): ContextLimits | undefined;
|
|
158
160
|
get status(): "normal" | "timeout";
|
|
@@ -180,7 +182,7 @@ export declare class AIGNEContext implements Context {
|
|
|
180
182
|
declare class AIGNEContextShared {
|
|
181
183
|
private readonly parent?;
|
|
182
184
|
spans: Span[];
|
|
183
|
-
constructor(parent?: (Pick<Context, "model" | "skills" | "limits" | "observer"> & {
|
|
185
|
+
constructor(parent?: (Pick<Context, "model" | "agents" | "skills" | "limits" | "observer"> & {
|
|
184
186
|
messageQueue?: MessageQueue;
|
|
185
187
|
events?: Emitter<any>;
|
|
186
188
|
}) | undefined);
|
|
@@ -188,6 +190,7 @@ declare class AIGNEContextShared {
|
|
|
188
190
|
readonly events: Emitter<any>;
|
|
189
191
|
get model(): ChatModel | undefined;
|
|
190
192
|
get skills(): Agent<any, any>[] | undefined;
|
|
193
|
+
get agents(): Agent<any, any>[];
|
|
191
194
|
get observer(): AIGNEObserver | undefined;
|
|
192
195
|
get limits(): ContextLimits | undefined;
|
|
193
196
|
addSpan(span: Span): void;
|
|
@@ -156,6 +156,13 @@ export interface TeamAgentOptions<I extends Message, O extends Message> extends
|
|
|
156
156
|
* @default false
|
|
157
157
|
*/
|
|
158
158
|
iterateWithPreviousOutput?: boolean;
|
|
159
|
+
/**
|
|
160
|
+
* Controls whether to include output from all intermediate steps in sequential processing.
|
|
161
|
+
*
|
|
162
|
+
* @see TeamAgent.includeAllStepsOutput for detailed documentation
|
|
163
|
+
* @default false
|
|
164
|
+
*/
|
|
165
|
+
includeAllStepsOutput?: boolean;
|
|
159
166
|
}
|
|
160
167
|
/**
|
|
161
168
|
* TeamAgent coordinates a group of agents working together to accomplish tasks.
|
|
@@ -230,6 +237,18 @@ export declare class TeamAgent<I extends Message, O extends Message> extends Age
|
|
|
230
237
|
* @default false
|
|
231
238
|
*/
|
|
232
239
|
iterateWithPreviousOutput?: boolean;
|
|
240
|
+
/**
|
|
241
|
+
* Controls whether to include output from all intermediate steps in sequential processing.
|
|
242
|
+
*
|
|
243
|
+
* When `true`, yields output chunks from every agent in the sequential chain.
|
|
244
|
+
* When `false`, only yields output from the final agent.
|
|
245
|
+
*
|
|
246
|
+
* Only affects sequential processing mode. Useful for debugging and monitoring
|
|
247
|
+
* multi-step agent workflows.
|
|
248
|
+
*
|
|
249
|
+
* @default false
|
|
250
|
+
*/
|
|
251
|
+
includeAllStepsOutput?: boolean;
|
|
233
252
|
/**
|
|
234
253
|
* Process an input message by routing it through the team's agents.
|
|
235
254
|
*
|
|
@@ -77,6 +77,7 @@ export class TeamAgent extends Agent {
|
|
|
77
77
|
};
|
|
78
78
|
this.iterateOn = options.iterateOn;
|
|
79
79
|
this.iterateWithPreviousOutput = options.iterateWithPreviousOutput;
|
|
80
|
+
this.includeAllStepsOutput = options.includeAllStepsOutput;
|
|
80
81
|
}
|
|
81
82
|
/**
|
|
82
83
|
* The processing mode that determines how agents in the team are executed.
|
|
@@ -111,6 +112,18 @@ export class TeamAgent extends Agent {
|
|
|
111
112
|
* @default false
|
|
112
113
|
*/
|
|
113
114
|
iterateWithPreviousOutput;
|
|
115
|
+
/**
|
|
116
|
+
* Controls whether to include output from all intermediate steps in sequential processing.
|
|
117
|
+
*
|
|
118
|
+
* When `true`, yields output chunks from every agent in the sequential chain.
|
|
119
|
+
* When `false`, only yields output from the final agent.
|
|
120
|
+
*
|
|
121
|
+
* Only affects sequential processing mode. Useful for debugging and monitoring
|
|
122
|
+
* multi-step agent workflows.
|
|
123
|
+
*
|
|
124
|
+
* @default false
|
|
125
|
+
*/
|
|
126
|
+
includeAllStepsOutput;
|
|
114
127
|
/**
|
|
115
128
|
* Process an input message by routing it through the team's agents.
|
|
116
129
|
*
|
|
@@ -206,8 +219,12 @@ export class TeamAgent extends Agent {
|
|
|
206
219
|
const output = {};
|
|
207
220
|
for (const agent of this.skills) {
|
|
208
221
|
const o = await options.context.invoke(agent, { ...input, ...output }, { ...options, streaming: true });
|
|
222
|
+
const isLast = agent === this.skills[this.skills.length - 1];
|
|
209
223
|
for await (const chunk of o) {
|
|
210
|
-
yield chunk
|
|
224
|
+
// Only yield the chunk if it is the last agent in the sequence
|
|
225
|
+
if (this.includeAllStepsOutput || isLast) {
|
|
226
|
+
yield chunk;
|
|
227
|
+
}
|
|
211
228
|
mergeAgentResponseChunk(output, chunk);
|
|
212
229
|
}
|
|
213
230
|
}
|
|
@@ -73,6 +73,7 @@ export interface Context<U extends UserContext = UserContext> extends TypedEvent
|
|
|
73
73
|
rootId: string;
|
|
74
74
|
model?: ChatModel;
|
|
75
75
|
skills?: Agent[];
|
|
76
|
+
agents: Agent[];
|
|
76
77
|
observer?: AIGNEObserver;
|
|
77
78
|
span?: Span;
|
|
78
79
|
usage: ContextUsage;
|
|
@@ -153,6 +154,7 @@ export declare class AIGNEContext implements Context {
|
|
|
153
154
|
get messageQueue(): MessageQueue;
|
|
154
155
|
get model(): ChatModel | undefined;
|
|
155
156
|
get skills(): Agent<any, any>[] | undefined;
|
|
157
|
+
get agents(): Agent<any, any>[];
|
|
156
158
|
get observer(): AIGNEObserver | undefined;
|
|
157
159
|
get limits(): ContextLimits | undefined;
|
|
158
160
|
get status(): "normal" | "timeout";
|
|
@@ -180,7 +182,7 @@ export declare class AIGNEContext implements Context {
|
|
|
180
182
|
declare class AIGNEContextShared {
|
|
181
183
|
private readonly parent?;
|
|
182
184
|
spans: Span[];
|
|
183
|
-
constructor(parent?: (Pick<Context, "model" | "skills" | "limits" | "observer"> & {
|
|
185
|
+
constructor(parent?: (Pick<Context, "model" | "agents" | "skills" | "limits" | "observer"> & {
|
|
184
186
|
messageQueue?: MessageQueue;
|
|
185
187
|
events?: Emitter<any>;
|
|
186
188
|
}) | undefined);
|
|
@@ -188,6 +190,7 @@ declare class AIGNEContextShared {
|
|
|
188
190
|
readonly events: Emitter<any>;
|
|
189
191
|
get model(): ChatModel | undefined;
|
|
190
192
|
get skills(): Agent<any, any>[] | undefined;
|
|
193
|
+
get agents(): Agent<any, any>[];
|
|
191
194
|
get observer(): AIGNEObserver | undefined;
|
|
192
195
|
get limits(): ContextLimits | undefined;
|
|
193
196
|
addSpan(span: Span): void;
|
package/lib/esm/aigne/context.js
CHANGED
|
@@ -58,6 +58,9 @@ export class AIGNEContext {
|
|
|
58
58
|
get skills() {
|
|
59
59
|
return this.internal.skills;
|
|
60
60
|
}
|
|
61
|
+
get agents() {
|
|
62
|
+
return this.internal.agents;
|
|
63
|
+
}
|
|
61
64
|
get observer() {
|
|
62
65
|
return this.internal.observer;
|
|
63
66
|
}
|
|
@@ -293,6 +296,9 @@ class AIGNEContextShared {
|
|
|
293
296
|
get skills() {
|
|
294
297
|
return this.parent?.skills;
|
|
295
298
|
}
|
|
299
|
+
get agents() {
|
|
300
|
+
return this.parent?.agents ?? [];
|
|
301
|
+
}
|
|
296
302
|
get observer() {
|
|
297
303
|
return this.parent?.observer;
|
|
298
304
|
}
|