@agentforge/patterns 0.1.0 → 0.1.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/README.md +72 -45
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -1,74 +1,91 @@
|
|
|
1
1
|
# @agentforge/patterns
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
> Production-ready agent patterns for the AgentForge framework
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
[](https://www.npmjs.com/package/@agentforge/patterns)
|
|
6
|
+
[](https://www.typescriptlang.org/)
|
|
7
|
+
[](../../LICENSE)
|
|
6
8
|
|
|
7
|
-
|
|
9
|
+
## 🎉 Status: Production Ready & Published
|
|
8
10
|
|
|
9
|
-
**
|
|
11
|
+
**All 4 patterns complete** | **143 tests passing** | **Full TypeScript support** | **Comprehensive documentation**
|
|
10
12
|
|
|
11
|
-
##
|
|
13
|
+
## 🤖 Agent Patterns
|
|
12
14
|
|
|
13
|
-
### ✅ ReAct Pattern (
|
|
15
|
+
### ✅ ReAct Pattern (Reasoning and Action)
|
|
14
16
|
|
|
15
|
-
The ReAct
|
|
16
|
-
1. **Thinks** about what to do next
|
|
17
|
-
2. **Acts** by calling a tool or responding
|
|
18
|
-
3. **Observes** the result
|
|
19
|
-
4. **Repeats** until the task is complete
|
|
17
|
+
The ReAct pattern implements a thought-action-observation loop for exploratory tasks:
|
|
20
18
|
|
|
21
|
-
**
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
- **Fluent Builder** - `ReActAgentBuilder` with method chaining (19 tests)
|
|
26
|
-
- **Integration Tests** - End-to-end scenarios (7 tests)
|
|
19
|
+
1. **Think** - Reason about what to do next
|
|
20
|
+
2. **Act** - Execute a tool or provide final answer
|
|
21
|
+
3. **Observe** - Process the result
|
|
22
|
+
4. **Repeat** - Continue until task complete
|
|
27
23
|
|
|
28
|
-
|
|
24
|
+
**Best for**: Research, exploration, problem-solving, multi-step reasoning
|
|
29
25
|
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
26
|
+
**Features**:
|
|
27
|
+
- Type-safe state with Zod schemas
|
|
28
|
+
- Fluent builder API (`ReActAgentBuilder`)
|
|
29
|
+
- Configurable max iterations and timeouts
|
|
30
|
+
- Comprehensive error handling
|
|
31
|
+
- **55 tests** - Full coverage
|
|
32
|
+
|
|
33
|
+
### ✅ Plan-Execute Pattern
|
|
34
|
+
|
|
35
|
+
The Plan-Execute pattern separates planning from execution for complex, structured tasks:
|
|
36
|
+
|
|
37
|
+
1. **Plan** - Create a multi-step plan
|
|
38
|
+
2. **Execute** - Execute each step (sequential or parallel)
|
|
39
|
+
3. **Replan** (optional) - Adjust based on results
|
|
40
|
+
4. **Finish** - Synthesize final response
|
|
41
|
+
|
|
42
|
+
**Best for**: Complex workflows, data analysis, structured problem-solving
|
|
35
43
|
|
|
36
44
|
**Features**:
|
|
37
|
-
-
|
|
38
|
-
-
|
|
39
|
-
-
|
|
40
|
-
-
|
|
41
|
-
-
|
|
45
|
+
- Structured multi-step planning
|
|
46
|
+
- Sequential & parallel execution
|
|
47
|
+
- Dependency management
|
|
48
|
+
- Adaptive replanning
|
|
49
|
+
- Progress tracking
|
|
50
|
+
- **35+ tests** - Comprehensive coverage
|
|
51
|
+
|
|
52
|
+
### ✅ Reflection Pattern
|
|
42
53
|
|
|
43
|
-
|
|
54
|
+
The Reflection pattern implements iterative self-improvement through critique and revision:
|
|
44
55
|
|
|
45
|
-
The Reflection pattern implements iterative self-improvement through generation, critique, and revision:
|
|
46
56
|
1. **Generate** - Create initial response
|
|
47
|
-
2. **Reflect** - Critique the
|
|
57
|
+
2. **Reflect** - Critique the output
|
|
48
58
|
3. **Revise** - Improve based on critique
|
|
49
59
|
4. **Repeat** - Continue until quality threshold met
|
|
50
60
|
|
|
61
|
+
**Best for**: Content generation, code review, quality optimization
|
|
62
|
+
|
|
51
63
|
**Features**:
|
|
52
|
-
-
|
|
53
|
-
-
|
|
54
|
-
-
|
|
55
|
-
-
|
|
56
|
-
-
|
|
64
|
+
- Iterative improvement cycles
|
|
65
|
+
- Self-critique capabilities
|
|
66
|
+
- Quality-focused optimization
|
|
67
|
+
- Flexible reflection criteria
|
|
68
|
+
- Configurable iteration limits
|
|
69
|
+
- **30+ tests** - Full coverage
|
|
57
70
|
|
|
58
|
-
### ✅ Multi-Agent Pattern
|
|
71
|
+
### ✅ Multi-Agent Pattern
|
|
59
72
|
|
|
60
73
|
The Multi-Agent pattern coordinates multiple specialized agents for complex tasks:
|
|
61
|
-
|
|
74
|
+
|
|
75
|
+
1. **Supervisor** - Routes tasks to workers
|
|
62
76
|
2. **Workers** - Execute specialized tasks
|
|
63
|
-
3. **Aggregator** - Combines results
|
|
77
|
+
3. **Aggregator** - Combines results
|
|
64
78
|
4. **Routing** - Intelligent task distribution
|
|
65
79
|
|
|
80
|
+
**Best for**: Customer support, complex workflows, specialized task distribution
|
|
81
|
+
|
|
66
82
|
**Features**:
|
|
67
|
-
-
|
|
68
|
-
-
|
|
69
|
-
-
|
|
70
|
-
-
|
|
71
|
-
-
|
|
83
|
+
- Specialized worker agents
|
|
84
|
+
- Flexible routing strategies (LLM-based, skill-based, rule-based, round-robin, load-balanced)
|
|
85
|
+
- Parallel execution support
|
|
86
|
+
- Intelligent result aggregation
|
|
87
|
+
- Dynamic worker registration
|
|
88
|
+
- **22+ tests** - Comprehensive coverage
|
|
72
89
|
|
|
73
90
|
## Installation
|
|
74
91
|
|
|
@@ -462,7 +479,17 @@ import {
|
|
|
462
479
|
| **Reflection** | Quality-critical outputs | Iterative improvement | Slow, expensive |
|
|
463
480
|
| **Multi-Agent** | Specialized tasks | Coordinated expertise | High complexity |
|
|
464
481
|
|
|
465
|
-
|
|
482
|
+
📚 **[Pattern Comparison Guide](https://tvscoundrel.github.io/agentforge/guide/patterns/comparison)** - Detailed guidance on choosing the right pattern
|
|
483
|
+
|
|
484
|
+
## Documentation
|
|
485
|
+
|
|
486
|
+
- 📖 **[Full Documentation](https://tvscoundrel.github.io/agentforge/)**
|
|
487
|
+
- 🚀 **[Quick Start](https://tvscoundrel.github.io/agentforge/guide/quick-start)**
|
|
488
|
+
- 🤖 **[ReAct Pattern Guide](https://tvscoundrel.github.io/agentforge/guide/patterns/react)**
|
|
489
|
+
- 📋 **[Plan-Execute Pattern Guide](https://tvscoundrel.github.io/agentforge/guide/patterns/plan-execute)**
|
|
490
|
+
- 🔄 **[Reflection Pattern Guide](https://tvscoundrel.github.io/agentforge/guide/patterns/reflection)**
|
|
491
|
+
- 👥 **[Multi-Agent Pattern Guide](https://tvscoundrel.github.io/agentforge/guide/patterns/multi-agent)**
|
|
492
|
+
- 💡 **[Examples](https://tvscoundrel.github.io/agentforge/examples/react-agent)**
|
|
466
493
|
|
|
467
494
|
## Development
|
|
468
495
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@agentforge/patterns",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.2",
|
|
4
4
|
"description": "Agent patterns (ReAct, Planner-Executor) for AgentForge framework",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.cjs",
|
|
@@ -39,7 +39,7 @@
|
|
|
39
39
|
"@langchain/core": "^0.3.29",
|
|
40
40
|
"@langchain/langgraph": "^0.2.20",
|
|
41
41
|
"zod": "^3.23.8",
|
|
42
|
-
"@agentforge/core": "0.1.
|
|
42
|
+
"@agentforge/core": "0.1.2"
|
|
43
43
|
},
|
|
44
44
|
"devDependencies": {
|
|
45
45
|
"@eslint/js": "^9.17.0",
|