@agentforge/patterns 0.16.1 → 0.16.3
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/dist/index.cjs +391 -276
- package/dist/index.d.cts +27 -40
- package/dist/index.d.ts +27 -40
- package/dist/index.js +391 -276
- package/package.json +3 -3
package/dist/index.d.cts
CHANGED
|
@@ -3262,57 +3262,44 @@ declare const ruleBasedRouting: RoutingStrategyImpl;
|
|
|
3262
3262
|
*/
|
|
3263
3263
|
declare function getRoutingStrategy(name: string): RoutingStrategyImpl;
|
|
3264
3264
|
|
|
3265
|
+
declare const DEFAULT_AGGREGATOR_SYSTEM_PROMPT = "You are an aggregator agent responsible for combining results from multiple worker agents.\n\nYour job is to:\n1. Review all completed task results\n2. Synthesize the information into a coherent response\n3. Ensure all aspects of the original query are addressed\n4. Provide a clear, comprehensive final answer\n\nBe concise but thorough in your aggregation.";
|
|
3265
3266
|
/**
|
|
3266
|
-
*
|
|
3267
|
+
* Creates the aggregator node for the multi-agent workflow.
|
|
3267
3268
|
*
|
|
3268
|
-
*
|
|
3269
|
+
* Aggregation precedence is:
|
|
3270
|
+
* 1. `aggregateFn` when provided
|
|
3271
|
+
* 2. `model`-based synthesis when no custom aggregator is configured
|
|
3272
|
+
* 3. simple concatenation of successful worker results as a fallback
|
|
3269
3273
|
*
|
|
3270
|
-
*
|
|
3274
|
+
* The node always returns a partial state with `status: 'completed'` on
|
|
3275
|
+
* success, or `status: 'failed'` plus an error message when aggregation fails.
|
|
3271
3276
|
*/
|
|
3277
|
+
declare function createAggregatorNode(config?: AggregatorConfig): (state: MultiAgentStateType) => Promise<Partial<MultiAgentStateType>>;
|
|
3272
3278
|
|
|
3273
3279
|
/**
|
|
3274
|
-
*
|
|
3275
|
-
|
|
3276
|
-
|
|
3277
|
-
|
|
3278
|
-
*
|
|
3280
|
+
* Creates the supervisor node for the multi-agent workflow.
|
|
3281
|
+
*
|
|
3282
|
+
* The supervisor owns orchestration concerns: it enforces `maxIterations`,
|
|
3283
|
+
* chooses the next worker or workers through the configured routing strategy,
|
|
3284
|
+
* increments framework-managed `currentWorkload` counters for each new
|
|
3285
|
+
* assignment, and routes to the aggregator once all active assignments have
|
|
3286
|
+
* completed. Routing strategies may return a single `targetAgent` or multiple
|
|
3287
|
+
* `targetAgents` for parallel fan-out.
|
|
3279
3288
|
*/
|
|
3280
3289
|
declare function createSupervisorNode(config: SupervisorConfig): (state: MultiAgentStateType) => Promise<Partial<MultiAgentStateType>>;
|
|
3290
|
+
|
|
3281
3291
|
/**
|
|
3282
|
-
*
|
|
3283
|
-
*
|
|
3284
|
-
* **Workload Management Contract:**
|
|
3285
|
-
* The framework automatically manages `currentWorkload` for all workers:
|
|
3286
|
-
* - Incremented by supervisor when task is assigned
|
|
3287
|
-
* - Decremented by worker when task completes (success or failure)
|
|
3288
|
-
*
|
|
3289
|
-
* Custom `executeFn` implementations should NOT modify `currentWorkload`.
|
|
3290
|
-
* The framework will automatically decrement it after execution completes.
|
|
3292
|
+
* Creates a worker node for the multi-agent workflow.
|
|
3291
3293
|
*
|
|
3292
|
-
*
|
|
3293
|
-
*
|
|
3294
|
-
*
|
|
3295
|
-
*
|
|
3296
|
-
*
|
|
3297
|
-
*
|
|
3298
|
-
*
|
|
3299
|
-
* const executeFn = async (state) => ({
|
|
3300
|
-
* completedTasks: [...],
|
|
3301
|
-
* workers: {
|
|
3302
|
-
* 'worker1': {
|
|
3303
|
-
* ...state.workers['worker1'],
|
|
3304
|
-
* skills: [...state.workers['worker1'].skills, 'new-skill'], // ✅ OK
|
|
3305
|
-
* // currentWorkload: ... // ❌ DON'T - framework manages this
|
|
3306
|
-
* }
|
|
3307
|
-
* }
|
|
3308
|
-
* });
|
|
3309
|
-
* ```
|
|
3310
|
-
*/
|
|
3311
|
-
declare function createWorkerNode(config: WorkerConfig): (state: MultiAgentStateType, runConfig?: any) => Promise<Partial<MultiAgentStateType>>;
|
|
3312
|
-
/**
|
|
3313
|
-
* Create an aggregator node that combines worker results
|
|
3294
|
+
* Worker workload is framework-managed. The node decrements
|
|
3295
|
+
* `state.workers[workerId].currentWorkload` after either a successful execution
|
|
3296
|
+
* result or an error result, so custom `executeFn` implementations should not
|
|
3297
|
+
* adjust workloads themselves. Custom execution results are merged into the
|
|
3298
|
+
* returned partial state first, then the decremented worker snapshot is applied
|
|
3299
|
+
* on top to keep handoff and worker state updates while preserving workload
|
|
3300
|
+
* ownership inside the framework.
|
|
3314
3301
|
*/
|
|
3315
|
-
declare function
|
|
3302
|
+
declare function createWorkerNode(config: WorkerConfig): (state: MultiAgentStateType, runConfig?: WorkerExecutionConfig) => Promise<Partial<MultiAgentStateType>>;
|
|
3316
3303
|
|
|
3317
3304
|
/**
|
|
3318
3305
|
* Multi-Agent System Factory
|
package/dist/index.d.ts
CHANGED
|
@@ -3262,57 +3262,44 @@ declare const ruleBasedRouting: RoutingStrategyImpl;
|
|
|
3262
3262
|
*/
|
|
3263
3263
|
declare function getRoutingStrategy(name: string): RoutingStrategyImpl;
|
|
3264
3264
|
|
|
3265
|
+
declare const DEFAULT_AGGREGATOR_SYSTEM_PROMPT = "You are an aggregator agent responsible for combining results from multiple worker agents.\n\nYour job is to:\n1. Review all completed task results\n2. Synthesize the information into a coherent response\n3. Ensure all aspects of the original query are addressed\n4. Provide a clear, comprehensive final answer\n\nBe concise but thorough in your aggregation.";
|
|
3265
3266
|
/**
|
|
3266
|
-
*
|
|
3267
|
+
* Creates the aggregator node for the multi-agent workflow.
|
|
3267
3268
|
*
|
|
3268
|
-
*
|
|
3269
|
+
* Aggregation precedence is:
|
|
3270
|
+
* 1. `aggregateFn` when provided
|
|
3271
|
+
* 2. `model`-based synthesis when no custom aggregator is configured
|
|
3272
|
+
* 3. simple concatenation of successful worker results as a fallback
|
|
3269
3273
|
*
|
|
3270
|
-
*
|
|
3274
|
+
* The node always returns a partial state with `status: 'completed'` on
|
|
3275
|
+
* success, or `status: 'failed'` plus an error message when aggregation fails.
|
|
3271
3276
|
*/
|
|
3277
|
+
declare function createAggregatorNode(config?: AggregatorConfig): (state: MultiAgentStateType) => Promise<Partial<MultiAgentStateType>>;
|
|
3272
3278
|
|
|
3273
3279
|
/**
|
|
3274
|
-
*
|
|
3275
|
-
|
|
3276
|
-
|
|
3277
|
-
|
|
3278
|
-
*
|
|
3280
|
+
* Creates the supervisor node for the multi-agent workflow.
|
|
3281
|
+
*
|
|
3282
|
+
* The supervisor owns orchestration concerns: it enforces `maxIterations`,
|
|
3283
|
+
* chooses the next worker or workers through the configured routing strategy,
|
|
3284
|
+
* increments framework-managed `currentWorkload` counters for each new
|
|
3285
|
+
* assignment, and routes to the aggregator once all active assignments have
|
|
3286
|
+
* completed. Routing strategies may return a single `targetAgent` or multiple
|
|
3287
|
+
* `targetAgents` for parallel fan-out.
|
|
3279
3288
|
*/
|
|
3280
3289
|
declare function createSupervisorNode(config: SupervisorConfig): (state: MultiAgentStateType) => Promise<Partial<MultiAgentStateType>>;
|
|
3290
|
+
|
|
3281
3291
|
/**
|
|
3282
|
-
*
|
|
3283
|
-
*
|
|
3284
|
-
* **Workload Management Contract:**
|
|
3285
|
-
* The framework automatically manages `currentWorkload` for all workers:
|
|
3286
|
-
* - Incremented by supervisor when task is assigned
|
|
3287
|
-
* - Decremented by worker when task completes (success or failure)
|
|
3288
|
-
*
|
|
3289
|
-
* Custom `executeFn` implementations should NOT modify `currentWorkload`.
|
|
3290
|
-
* The framework will automatically decrement it after execution completes.
|
|
3292
|
+
* Creates a worker node for the multi-agent workflow.
|
|
3291
3293
|
*
|
|
3292
|
-
*
|
|
3293
|
-
*
|
|
3294
|
-
*
|
|
3295
|
-
*
|
|
3296
|
-
*
|
|
3297
|
-
*
|
|
3298
|
-
*
|
|
3299
|
-
* const executeFn = async (state) => ({
|
|
3300
|
-
* completedTasks: [...],
|
|
3301
|
-
* workers: {
|
|
3302
|
-
* 'worker1': {
|
|
3303
|
-
* ...state.workers['worker1'],
|
|
3304
|
-
* skills: [...state.workers['worker1'].skills, 'new-skill'], // ✅ OK
|
|
3305
|
-
* // currentWorkload: ... // ❌ DON'T - framework manages this
|
|
3306
|
-
* }
|
|
3307
|
-
* }
|
|
3308
|
-
* });
|
|
3309
|
-
* ```
|
|
3310
|
-
*/
|
|
3311
|
-
declare function createWorkerNode(config: WorkerConfig): (state: MultiAgentStateType, runConfig?: any) => Promise<Partial<MultiAgentStateType>>;
|
|
3312
|
-
/**
|
|
3313
|
-
* Create an aggregator node that combines worker results
|
|
3294
|
+
* Worker workload is framework-managed. The node decrements
|
|
3295
|
+
* `state.workers[workerId].currentWorkload` after either a successful execution
|
|
3296
|
+
* result or an error result, so custom `executeFn` implementations should not
|
|
3297
|
+
* adjust workloads themselves. Custom execution results are merged into the
|
|
3298
|
+
* returned partial state first, then the decremented worker snapshot is applied
|
|
3299
|
+
* on top to keep handoff and worker state updates while preserving workload
|
|
3300
|
+
* ownership inside the framework.
|
|
3314
3301
|
*/
|
|
3315
|
-
declare function
|
|
3302
|
+
declare function createWorkerNode(config: WorkerConfig): (state: MultiAgentStateType, runConfig?: WorkerExecutionConfig) => Promise<Partial<MultiAgentStateType>>;
|
|
3316
3303
|
|
|
3317
3304
|
/**
|
|
3318
3305
|
* Multi-Agent System Factory
|