@agentforge/patterns 0.16.22 → 0.16.24
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/README.md +22 -22
- package/dist/index.d.cts +12 -6
- package/dist/index.d.ts +12 -6
- package/package.json +3 -3
package/README.md
CHANGED
|
@@ -6,13 +6,13 @@
|
|
|
6
6
|
[](https://www.typescriptlang.org/)
|
|
7
7
|
[](../../LICENSE)
|
|
8
8
|
|
|
9
|
-
##
|
|
9
|
+
## Status: Production Ready & Published
|
|
10
10
|
|
|
11
11
|
**All 4 patterns complete** | **143 tests passing** | **Full TypeScript support** | **Comprehensive documentation**
|
|
12
12
|
|
|
13
|
-
##
|
|
13
|
+
## Agent Patterns
|
|
14
14
|
|
|
15
|
-
###
|
|
15
|
+
### ReAct Pattern (Reasoning and Action)
|
|
16
16
|
|
|
17
17
|
The ReAct pattern implements a thought-action-observation loop for exploratory tasks:
|
|
18
18
|
|
|
@@ -30,7 +30,7 @@ The ReAct pattern implements a thought-action-observation loop for exploratory t
|
|
|
30
30
|
- Comprehensive error handling
|
|
31
31
|
- **55 tests** - Full coverage
|
|
32
32
|
|
|
33
|
-
###
|
|
33
|
+
### Plan-Execute Pattern
|
|
34
34
|
|
|
35
35
|
The Plan-Execute pattern separates planning from execution for complex, structured tasks:
|
|
36
36
|
|
|
@@ -49,7 +49,7 @@ The Plan-Execute pattern separates planning from execution for complex, structur
|
|
|
49
49
|
- Progress tracking
|
|
50
50
|
- **35+ tests** - Comprehensive coverage
|
|
51
51
|
|
|
52
|
-
###
|
|
52
|
+
### Reflection Pattern
|
|
53
53
|
|
|
54
54
|
The Reflection pattern implements iterative self-improvement through critique and revision:
|
|
55
55
|
|
|
@@ -68,7 +68,7 @@ The Reflection pattern implements iterative self-improvement through critique an
|
|
|
68
68
|
- Configurable iteration limits
|
|
69
69
|
- **30+ tests** - Full coverage
|
|
70
70
|
|
|
71
|
-
###
|
|
71
|
+
### Multi-Agent Pattern
|
|
72
72
|
|
|
73
73
|
The Multi-Agent pattern coordinates multiple specialized agents for complex tasks:
|
|
74
74
|
|
|
@@ -284,19 +284,19 @@ console.log(result.response); // Aggregated response
|
|
|
284
284
|
|
|
285
285
|
## Documentation
|
|
286
286
|
|
|
287
|
-
###
|
|
288
|
-
-
|
|
289
|
-
-
|
|
290
|
-
-
|
|
291
|
-
-
|
|
287
|
+
### Pattern Guides (GitHub Pages)
|
|
288
|
+
- **[ReAct Pattern Guide](https://tvscoundrel.github.io/agentforge/guide/patterns/react)** - Comprehensive ReAct usage guide
|
|
289
|
+
- **[Plan-Execute Pattern Guide](https://tvscoundrel.github.io/agentforge/guide/patterns/plan-execute)** - Comprehensive Plan-Execute guide
|
|
290
|
+
- **[Reflection Pattern Guide](https://tvscoundrel.github.io/agentforge/guide/patterns/reflection)** - Comprehensive Reflection guide
|
|
291
|
+
- **[Multi-Agent Pattern Guide](https://tvscoundrel.github.io/agentforge/guide/patterns/multi-agent)** - Comprehensive Multi-Agent guide
|
|
292
292
|
|
|
293
|
-
###
|
|
293
|
+
### Examples (GitHub Pages)
|
|
294
294
|
- **[ReAct Examples](https://tvscoundrel.github.io/agentforge/examples/react-agent)** - ReAct pattern examples
|
|
295
295
|
- **[Plan-Execute Examples](https://tvscoundrel.github.io/agentforge/examples/plan-execute)** - Plan-Execute pattern examples
|
|
296
296
|
- **[Reflection Examples](https://tvscoundrel.github.io/agentforge/examples/reflection)** - Reflection pattern examples
|
|
297
297
|
- **[Multi-Agent Examples](https://tvscoundrel.github.io/agentforge/examples/multi-agent)** - Multi-Agent pattern examples
|
|
298
298
|
|
|
299
|
-
###
|
|
299
|
+
### Source Documentation
|
|
300
300
|
For contributors and advanced users, detailed implementation docs are available in the repository:
|
|
301
301
|
- [Pattern Comparison](./docs/pattern-comparison.md) - Detailed pattern comparison
|
|
302
302
|
- [ReAct Implementation](./docs/react-pattern.md) - ReAct implementation details
|
|
@@ -499,17 +499,17 @@ import {
|
|
|
499
499
|
| **Reflection** | Quality-critical outputs | Iterative improvement | Slow, expensive |
|
|
500
500
|
| **Multi-Agent** | Specialized tasks | Coordinated expertise | High complexity |
|
|
501
501
|
|
|
502
|
-
|
|
502
|
+
- **[Pattern Comparison Guide](https://tvscoundrel.github.io/agentforge/guide/patterns/comparison)** - Detailed guidance on choosing the right pattern
|
|
503
503
|
|
|
504
504
|
## Documentation
|
|
505
505
|
|
|
506
|
-
-
|
|
507
|
-
-
|
|
508
|
-
-
|
|
509
|
-
-
|
|
510
|
-
-
|
|
511
|
-
-
|
|
512
|
-
-
|
|
506
|
+
- **[Full Documentation](https://tvscoundrel.github.io/agentforge/)**
|
|
507
|
+
- **[Quick Start](https://tvscoundrel.github.io/agentforge/guide/quick-start)**
|
|
508
|
+
- **[ReAct Pattern Guide](https://tvscoundrel.github.io/agentforge/guide/patterns/react)**
|
|
509
|
+
- **[Plan-Execute Pattern Guide](https://tvscoundrel.github.io/agentforge/guide/patterns/plan-execute)**
|
|
510
|
+
- **[Reflection Pattern Guide](https://tvscoundrel.github.io/agentforge/guide/patterns/reflection)**
|
|
511
|
+
- **[Multi-Agent Pattern Guide](https://tvscoundrel.github.io/agentforge/guide/patterns/multi-agent)**
|
|
512
|
+
- **[Examples](https://tvscoundrel.github.io/agentforge/examples/react-agent)**
|
|
513
513
|
|
|
514
514
|
## Development
|
|
515
515
|
|
|
@@ -530,7 +530,7 @@ pnpm test:coverage
|
|
|
530
530
|
pnpm typecheck
|
|
531
531
|
```
|
|
532
532
|
|
|
533
|
-
##
|
|
533
|
+
## Links
|
|
534
534
|
|
|
535
535
|
- [GitHub Repository](https://github.com/TVScoundrel/agentforge)
|
|
536
536
|
- [npm Package](https://www.npmjs.com/package/@agentforge/patterns)
|
package/dist/index.d.cts
CHANGED
|
@@ -206,6 +206,11 @@ type ReActStateType = typeof ReActState.State;
|
|
|
206
206
|
* @module langgraph/patterns/react/types
|
|
207
207
|
*/
|
|
208
208
|
|
|
209
|
+
type ReActTool = Tool<unknown, unknown>;
|
|
210
|
+
type ReActToolInput = Omit<ReActTool, 'invoke' | 'execute'> & Pick<Tool<never, unknown>, 'invoke' | 'execute'>;
|
|
211
|
+
type ReActToolSource = ToolRegistry | ReActToolInput[];
|
|
212
|
+
type ReActCheckpointer = BaseCheckpointSaver | true;
|
|
213
|
+
type ReActAgentGraph = CompiledStateGraph<ReActStateType, unknown>;
|
|
209
214
|
/**
|
|
210
215
|
* Configuration for creating a ReAct agent
|
|
211
216
|
*/
|
|
@@ -218,7 +223,7 @@ interface ReActAgentConfig {
|
|
|
218
223
|
* Tools available to the agent
|
|
219
224
|
* Can be a ToolRegistry or an array of Tools
|
|
220
225
|
*/
|
|
221
|
-
tools:
|
|
226
|
+
tools: ReActToolSource;
|
|
222
227
|
/**
|
|
223
228
|
* System prompt for the agent
|
|
224
229
|
* @default "You are a helpful assistant that uses tools to solve problems."
|
|
@@ -270,7 +275,7 @@ interface ReActAgentConfig {
|
|
|
270
275
|
* });
|
|
271
276
|
* ```
|
|
272
277
|
*/
|
|
273
|
-
checkpointer?:
|
|
278
|
+
checkpointer?: ReActCheckpointer;
|
|
274
279
|
/**
|
|
275
280
|
* Enable tool call deduplication to prevent calling the same tool with identical parameters multiple times
|
|
276
281
|
* @default true
|
|
@@ -309,6 +314,7 @@ type StopConditionFn = (state: ReActStateType) => boolean;
|
|
|
309
314
|
*
|
|
310
315
|
* @module langgraph/patterns/react/prompts
|
|
311
316
|
*/
|
|
317
|
+
|
|
312
318
|
/**
|
|
313
319
|
* Default system prompt for ReAct agents
|
|
314
320
|
*/
|
|
@@ -399,7 +405,7 @@ declare const DEFAULT_REACT_SYSTEM_PROMPT = "You are a helpful assistant that us
|
|
|
399
405
|
* // Format: {parent_thread_id}:worker:hr
|
|
400
406
|
* ```
|
|
401
407
|
*/
|
|
402
|
-
declare function createReActAgent(config: ReActAgentConfig, options?: ReActBuilderOptions):
|
|
408
|
+
declare function createReActAgent(config: ReActAgentConfig, options?: ReActBuilderOptions): ReActAgentGraph;
|
|
403
409
|
|
|
404
410
|
/**
|
|
405
411
|
* ReAct Agent Builder
|
|
@@ -442,7 +448,7 @@ declare class ReActAgentBuilder {
|
|
|
442
448
|
*
|
|
443
449
|
* @param tools - Tool registry or array of tools
|
|
444
450
|
*/
|
|
445
|
-
withTools(tools:
|
|
451
|
+
withTools(tools: ReActToolSource): this;
|
|
446
452
|
/**
|
|
447
453
|
* Set the system prompt (optional)
|
|
448
454
|
*
|
|
@@ -516,14 +522,14 @@ declare class ReActAgentBuilder {
|
|
|
516
522
|
* .build();
|
|
517
523
|
* ```
|
|
518
524
|
*/
|
|
519
|
-
withCheckpointer(checkpointer:
|
|
525
|
+
withCheckpointer(checkpointer: ReActCheckpointer): this;
|
|
520
526
|
/**
|
|
521
527
|
* Build the ReAct agent
|
|
522
528
|
*
|
|
523
529
|
* @returns A compiled LangGraph StateGraph
|
|
524
530
|
* @throws Error if required configuration is missing
|
|
525
531
|
*/
|
|
526
|
-
build():
|
|
532
|
+
build(): ReActAgentGraph;
|
|
527
533
|
}
|
|
528
534
|
/**
|
|
529
535
|
* Create a new ReAct agent builder
|
package/dist/index.d.ts
CHANGED
|
@@ -206,6 +206,11 @@ type ReActStateType = typeof ReActState.State;
|
|
|
206
206
|
* @module langgraph/patterns/react/types
|
|
207
207
|
*/
|
|
208
208
|
|
|
209
|
+
type ReActTool = Tool<unknown, unknown>;
|
|
210
|
+
type ReActToolInput = Omit<ReActTool, 'invoke' | 'execute'> & Pick<Tool<never, unknown>, 'invoke' | 'execute'>;
|
|
211
|
+
type ReActToolSource = ToolRegistry | ReActToolInput[];
|
|
212
|
+
type ReActCheckpointer = BaseCheckpointSaver | true;
|
|
213
|
+
type ReActAgentGraph = CompiledStateGraph<ReActStateType, unknown>;
|
|
209
214
|
/**
|
|
210
215
|
* Configuration for creating a ReAct agent
|
|
211
216
|
*/
|
|
@@ -218,7 +223,7 @@ interface ReActAgentConfig {
|
|
|
218
223
|
* Tools available to the agent
|
|
219
224
|
* Can be a ToolRegistry or an array of Tools
|
|
220
225
|
*/
|
|
221
|
-
tools:
|
|
226
|
+
tools: ReActToolSource;
|
|
222
227
|
/**
|
|
223
228
|
* System prompt for the agent
|
|
224
229
|
* @default "You are a helpful assistant that uses tools to solve problems."
|
|
@@ -270,7 +275,7 @@ interface ReActAgentConfig {
|
|
|
270
275
|
* });
|
|
271
276
|
* ```
|
|
272
277
|
*/
|
|
273
|
-
checkpointer?:
|
|
278
|
+
checkpointer?: ReActCheckpointer;
|
|
274
279
|
/**
|
|
275
280
|
* Enable tool call deduplication to prevent calling the same tool with identical parameters multiple times
|
|
276
281
|
* @default true
|
|
@@ -309,6 +314,7 @@ type StopConditionFn = (state: ReActStateType) => boolean;
|
|
|
309
314
|
*
|
|
310
315
|
* @module langgraph/patterns/react/prompts
|
|
311
316
|
*/
|
|
317
|
+
|
|
312
318
|
/**
|
|
313
319
|
* Default system prompt for ReAct agents
|
|
314
320
|
*/
|
|
@@ -399,7 +405,7 @@ declare const DEFAULT_REACT_SYSTEM_PROMPT = "You are a helpful assistant that us
|
|
|
399
405
|
* // Format: {parent_thread_id}:worker:hr
|
|
400
406
|
* ```
|
|
401
407
|
*/
|
|
402
|
-
declare function createReActAgent(config: ReActAgentConfig, options?: ReActBuilderOptions):
|
|
408
|
+
declare function createReActAgent(config: ReActAgentConfig, options?: ReActBuilderOptions): ReActAgentGraph;
|
|
403
409
|
|
|
404
410
|
/**
|
|
405
411
|
* ReAct Agent Builder
|
|
@@ -442,7 +448,7 @@ declare class ReActAgentBuilder {
|
|
|
442
448
|
*
|
|
443
449
|
* @param tools - Tool registry or array of tools
|
|
444
450
|
*/
|
|
445
|
-
withTools(tools:
|
|
451
|
+
withTools(tools: ReActToolSource): this;
|
|
446
452
|
/**
|
|
447
453
|
* Set the system prompt (optional)
|
|
448
454
|
*
|
|
@@ -516,14 +522,14 @@ declare class ReActAgentBuilder {
|
|
|
516
522
|
* .build();
|
|
517
523
|
* ```
|
|
518
524
|
*/
|
|
519
|
-
withCheckpointer(checkpointer:
|
|
525
|
+
withCheckpointer(checkpointer: ReActCheckpointer): this;
|
|
520
526
|
/**
|
|
521
527
|
* Build the ReAct agent
|
|
522
528
|
*
|
|
523
529
|
* @returns A compiled LangGraph StateGraph
|
|
524
530
|
* @throws Error if required configuration is missing
|
|
525
531
|
*/
|
|
526
|
-
build():
|
|
532
|
+
build(): ReActAgentGraph;
|
|
527
533
|
}
|
|
528
534
|
/**
|
|
529
535
|
* Create a new ReAct agent builder
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@agentforge/patterns",
|
|
3
|
-
"version": "0.16.
|
|
3
|
+
"version": "0.16.24",
|
|
4
4
|
"description": "Production-ready agent workflow patterns for TypeScript including ReAct and Planner-Executor, built on LangGraph.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.cjs",
|
|
@@ -41,13 +41,13 @@
|
|
|
41
41
|
"url": "https://github.com/TVScoundrel/agentforge/issues"
|
|
42
42
|
},
|
|
43
43
|
"dependencies": {
|
|
44
|
-
"@agentforge/core": "0.16.
|
|
44
|
+
"@agentforge/core": "0.16.24",
|
|
45
45
|
"@langchain/core": "^1.1.17",
|
|
46
46
|
"@langchain/langgraph": "^1.1.2",
|
|
47
47
|
"zod": "^3.23.8"
|
|
48
48
|
},
|
|
49
49
|
"devDependencies": {
|
|
50
|
-
"@agentforge/testing": "0.16.
|
|
50
|
+
"@agentforge/testing": "0.16.24",
|
|
51
51
|
"@eslint/js": "^9.17.0",
|
|
52
52
|
"@types/node": "^22.10.2",
|
|
53
53
|
"eslint": "^9.17.0",
|